开发者

Floating two divs, one with fixed width

开发者 https://www.devze.com 2023-01-17 16:47 出处:网络
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 quest

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ževan开发者_开发问答je</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


try

display:inline-block;
float:left;

on left div


Try this:

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

精彩评论

暂无评论...
验证码 换一张
取 消