开发者

Centered wrapper in full width divs

开发者 https://www.devze.com 2023-02-07 18:33 出处:网络
I found this thread on here which answers my question. I want to ask a question relating to this thread, but I\'m not sure how to comment on the thread...excuse my ignorance :)

I found this thread on here which answers my question. I want to ask a question relating to this thread, but I'm not sure how to comment on the thread...excuse my ignorance :)

I followed the instructions of the ticked answer and it worked. Then in my content div I want three divs, but when I float one left...my background-color ont he content div won't stretch. So it looks something like:

html:

<div id="content">

   <div class="wrapper">

<div id="content1></div>
<div id="content2></div>
<div id="content3></div>

   </div>
</div>

CSS开发者_运维技巧:

#content 1 {
    width:300px;
    float:left;
}
#content 2 {
    width:300px;
    float:left;
}
#content 3 {
    width:300px;
    float:right;
}

I will probably have to link you guys to the site before youc an understand what I'm waffling about. But it's not online yet so I just thought someone might be aware of an issue with floating divs left or right when using this wrapper class technique?

Colm


I ask only because you didn't mention it, but did you clear your floats after the floating divs? Make sure you do like this:

<div style="clear: both;"></div>

or you could put:

overflow: hidden; width: 100%;

in the style attribute of your wrapping div.

Try these options and see if they work for you.

0

精彩评论

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

关注公众号