shubhamj
shubhamj

Reputation: 938

html css align text such that text is always on right of the image not below it

html css align text such that text is always on right of the image not below it.Thanks for the help!Css for img1 is down below.

enter image description here

  <img id="img1" src="../images/1.jpg">
 <div style="box-shadow: 0 0 15px #666;">
 <p style="text-align: justify;height: auto;min-height: 280px;font-  family: sans-serif,monospace;padding:10px;padding: 10px;box-shadow: 0 0 15px #666;font-size: 20px;color: #000;">
   <br>A photovoltaic system for residential, commercial, or industrial energy supply consists of the solar array and a number of components often summarized as the&nbsp;balance of system&nbsp;(BOS). The term originates from the fact that some BOS-components are balancing the power-generating subsystem of the solar array with the power-using side, the load. BOS-components include:<br>
    Power-conditioning equipment and 
    Structures for mounting, 
    Typically one or more DC to&nbsp;AC&nbsp;power converters, also    known    as&nbsp;inverters,
   An energy storage device, 
   A racking system that supports the solar array, 
   Electrical wiring and interconnections, 
   Electrical protection devices and 
   Mounting for other components.

   Optionally, a balance of system may include any or all of the    following:&nbsp;
   renewable energy credit&nbsp;revenue-grade meter,&nbsp;  
    maximum power point tracker&nbsp;(MPPT),&nbsp;
   battery&nbsp;system and&nbsp;charger,&nbsp;
    GPS&nbsp;solar tracker,&nbsp;
    energy management software,&nbsp;
    solar irradiance&nbsp;sensors,&nbsp;
    anemometer, or 
    task-specific accessories 

    designed to meet specialized requirements for a system owner</p>

 #img1 {
box-shadow: 10px 10px 50px #333;
float: left;
height: 280px;
margin: 0 20px 20px 0;
max-width: 300px;
width: 240px;

}

Upvotes: 0

Views: 136

Answers (2)

Anand
Anand

Reputation: 13

Use the css float property for the image and set the value as 'left'. For example:

image{
       float:left;
} 

Now the text will flow around the image like how you showed in the image.

Upvotes: 0

Teuta Koraqi
Teuta Koraqi

Reputation: 1898

You can use flex property for this, or you can set width for image container and text container(and of course, float property):

.main-container {
  display: flex;
}
p {
  margin-top: 0;
  margin-left: 10px;
}
<div style="box-shadow: 0 0 15px #666;" class="main-container">
<div class="image">
  <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD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Ubd1mmoPtVM+yaxh4H3TX8pWaW3nZKuqD7QJp9u61jAlsMZt+65Zpm37rlvQiwy3UOUAC57AuCKGzBuYsIA3O4SzJH2Hzu2HtCEjw3Z7h9UpRK2Otmv5/VW1uUixzje5J/Mq1zbv4U0Q9juvyp1+UgCb91cHuk4IexzWKjWKXuuSqg2MaxU6p9pb+FJRVDGNU+12rylv4XeUVQDJm5VDMfaXJ7KpOydELYzr28qDUn2kySoB2+iqiFsb1yfKkT7d0lc7b+VN9gnRC2N65PYqrpuUsP4UO8p0QbGNYk91zpilSoJTqhbDmXlBmkNu6Hc2Q5ibK1HyS2CLzfupQVC3qjLZ//Z" alt="" >
</div>

 
  
  
  
  <div class="text-container">
  <p style="text-align: justify;height: auto;min-height: 280px;font-  family: sans-serif,monospace;padding:10px;padding: 10px;font-size: 20px;color: #000;">
A photovoltaic system for residential, commercial, or industrial energy supply consists of the solar array and a number of components often summarized as the&nbsp;balance of system&nbsp;(BOS). The term originates from the fact that some BOS-components are balancing the power-generating subsystem of the solar array with the power-using side, the load. BOS-components include:<br>
    Power-conditioning equipment and 
    Structures for mounting, 
    Typically one or more DC to&nbsp;AC&nbsp;power converters, also    known    as&nbsp;inverters,
   An energy storage device, 
   A racking system that supports the solar array, 
   Electrical wiring and interconnections, 
   Electrical protection devices and 
   Mounting for other components.

   Optionally, a balance of system may include any or all of the    following:&nbsp;
   renewable energy credit&nbsp;revenue-grade meter,&nbsp;  
    maximum power point tracker&nbsp;(MPPT),&nbsp;
   battery&nbsp;system and&nbsp;charger,&nbsp;
    GPS&nbsp;solar tracker,&nbsp;
    energy management software,&nbsp;
    solar irradiance&nbsp;sensors,&nbsp;
    anemometer, or 
    task-specific accessories 

    designed to meet specialized requirements for a system owner. 
    </p>
    </div>  
    </div>

Upvotes: 1

Related Questions