I was wondering if anyone knows of a way to incorporate pixel width paddings or margins to a fluid column design, without the need for extra html markup.
To further illustrate, consider a simple html/css layout like this one:
<style>
.cont{width:500px;height:200px;border:1px solid black;}
.col{float:left;}
#foo{background-color:blue;width:10%;}
#bar{background-color:yellow;width:30%;}
#baz{background-color:red;width:60%;}
</style>
<div class="cont">
<div class="col" id="foo">Foo</div>
<div class="col" id="bar">Bar</div>
<div class="col" id="baz">Baz</div>
</div>
This displays correctly (disregarding miscellaneous css display bugs that can be taken care of). However, once you add, say, a 10px padding to the col
class, the floats no longer display inline. The same goes if you wanted to put a 3px border to the col
class. I've seen css techniques where people will use a negative margin to reverse the added pixels created from the box model, but it still won't reduce the <div>
width. So basically, what I want is a technique that will allow me to keep a 10% width, but 10px of that 10% be padding (or margin or what not).