简体   繁体   中英

3 divs middle centered sides zoomable all in one vertically centered div

i spend almost 2 days and have no idea how to do this. here is some code:

<div id='wrapper'>
  <div id='left'>
  </div
  <div id='middle'>
      <div id='centeredinmiddle'>
      </div>
  </div>
  <div id='right'>
  </div>
</div>

What i need is : wrapper centered vertically, left and right zoomable lets say 20% of window width each, middle static width: 700px, centeredinmiddle - centered horizontally in middle.

i am not sure is it poassible but i hope it is.

http://jsfiddle.net/cJqAu/

change the order of your floated divs -->

<div id='wrapper'>
  <div id='left'>
      foo bar
  </div>
    <div id='right'>
    bar foo
  </div>
  <div id='middle'>
     <div id='centeredinmiddle'>
        lorem ipsum dolor sit amet and so on...
     </div>
  </div>
</div>

and add some small style rules to the right and left div:

#wrapper
{
  width: 70%;
  margin-left: 15%;
  /*this is not a beautiful and nice attempt, but it works*/
}
#left
{
  float: left;
  width: 10%;
}
#right
{
 float: right;
 width: 10%;
}
#centeredinmiddle
{
  /*no need for further style rules if you nicely adjust the others ;)*/
}

just adjust the width of wrapper and there you go

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM