I am using a grid system for my web page layout, much like the Grid 960 layout. I have a bunch of predefined classes for all the grid widths. When I want a div to be a certain width, I simply do:
<div class="grid_4">
...
</div>
However, for some of my divs I add borders so I created a custom border class that I add to those divs for which I want a border.
.right-border {
border-right: 1px solid #e1e1e1;
}
<div class="grid_4 right-border">
....
</div>
The problem is that when I add a border, the grid system fails since there isn't enough room across the page to fit all the divs (since one of them has a border). I can manually adjust every div I add a border to, but I want a cleaner solution since every width of every grid is different (depending on which grid class I use).
Is there a way to get the current divs width, and simply subtract 1 for those divs that have a class of right-border? I'm thinking this is likely only doable with jQuery, but perhaps theres some CSS magic I don't know about that will accomplish this.
Any ideas?
divwidth.