Note that there are some explanatory texts on larger screens.

plurals
  1. POLeft floating div's with bottom border not the same size
    primarykey
    data
    text
    <p>My designer uses this technique in a lot of designs and I can't decide the best way of css'ing this so it's automagically fluid (as it's going into a cms)</p> <p>Basically, when floating a 2column div structure I would like there to be a bottom border per div. I would put the border on a wrapping element but there needs to be a gap between the two divs (margin-right). The problem is that the two divs are different sizes depending on content. height:100% will not seem to do the trick (even when making the parent 100%). I need the two divs's borders to be level with each other.</p> <p>Attached is some sample code pre any formatting css- only successful way I have been able to do this is by setting the height per container, which in this case will not work, needs to be fluid.</p> <p>Thank you !!</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;What's the best way?!&lt;/title&gt; &lt;style type="text/css"&gt; div.col50&gt;div{width:45%; float:left; border-bottom:1px solid #000;} div.col50&gt;div+div{margin:0 0 0 5%;} div.col50+div.col50{margin:50px 0 0;} div.col50:before, div.col50:after { content: "\0020"; display: block; height: 0; overflow: hidden; } div.col50:after { clear: both; } div.col50{zoom:1;} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="col50"&gt; &lt;div&gt; &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt; &lt;/div&gt; &lt;div&gt; &lt;p&gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload