开发者

Three DIVs next to each other with fluid horizontal width

开发者 https://www.devze.com 2023-03-23 11:05 出处:网络
I need to know how to align all three divs next to eachother with all different background-images and the ce开发者_开发百科nter one needs to be 989px the left div and right div their widths doesn\'t m

I need to know how to align all three divs next to eachother with all different background-images and the ce开发者_开发百科nter one needs to be 989px the left div and right div their widths doesn't matter.


In a nutshell.. http://jsfiddle.net/hobobne/qyGC5/

<style>
.sides {display: inline-block; width: 100px; border: 2px dotted green;}
#main {display: inline-block; width: 200px; border: 2px dotted blue;} /* you can change this to 989px */
</style>
<div class="sides">side 1</div><div id="main">main</div><div class="sides">side 2</div>

EDIT: The final solution: http://jsfiddle.net/hobobne/qyGC5/4/


<style type="text/css">
  #wrapper {
  }

  #wrapper div {
    float : left;
  }

  #wrapper #left {
    width : 300px;
    background-image : "/path/to/an_image";
  }
  #wrapper #center {
    width : 989px;
    background-image : "/path/to/another_image";
  }
  #wrapper #left {
    width : 200px;
    background-image : "/you/get/the/idea";
  }
</style>

<div id="wrapper">
  <div id="left"></div>
  <div id="center"></div>
  <div id="right"></div>
</div>
0

精彩评论

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

关注公众号