Uros
Uros

Reputation: 1

Floating two divs, one with fixed width

here's my case. I want two divs to be side by side. The left one holds the text and the right one holds image. The right one needs to be fixed width. I did follow the solution from one previous question (the difference was that in that case the left div was fixed width) and it's not working for me.

Here's the HTML (the two divs are bold written - vsebina in icon):

<div class="background"> 
  <div class="content"> 
    <div class="leftCol"> 
      <div id="Storitve">
        <div class="contentBox">
          <div class="contentBoxLeft">
            <div class="title">Vzdrževanje</div>
          </div>
          <div class="contentBoxRight">
            <div class="vsebina"> 
            </div>
            <div class="icon">
            </div>
          </div>
        </div 
      </div> 
    </div>
  <div class="rightCol"> 
  </div> 
  <div class="clear"> </div> 
</div> 
<div class="clear"> </div> 
</div> 

Here's the CSS:

   .vsebina {background-color:#876392;}
    .icon {background-color:#872472; width:150px; float:right; height:auto;}

THX for any help! Uros

Upvotes: 0

Views: 897

Answers (2)

Manish
Manish

Reputation: 6286

Try this:

.vsebina
{
    background-color: #876392;
    float: left;
}
.icon
{
    background-color: #872472;
    width: 150px;
    float: left;
    height: auto;
}

Upvotes: 0

Vinay B R
Vinay B R

Reputation: 8421

try

display:inline-block;
float:left;

on left div

Upvotes: 1

Related Questions