Jeff, you are a programmer, aren’t you? So I fail to see your problem. Okay, I agree with you, that there are some alignment issues in CSS, sometimes things are extremely easy to do with tables and extremely hard to do with CSS, but that is a different issue.
Regarding your request with turning CSS into a programming language, why don’t you make CSS templates, run them through your own written pre-processor and dynamically serve the result? Nothing is easier than doing a bit of search and replace using PHP (or any other language with regex) to transform your CSS templates into real CSS.
People building huge webpages are used to the fact, that pretty much no HTML is static, but everything is dynamically created by PHP, Perl, Ruby, Pyhton, Java or some other kind of comparable language. I bet Stackoverflow works like this. At the same time you request that CSS must be all static and “interpreted” by the browser. The same way I can request that all HTML must be static and there is a HTML Meta language that makes all HTML processing in the browser.
At the time being, you have two options: Either you do things in the browser using JavaScript (JS can transform/alter HTML, just like it can transform/alter CSS on the fly, no big deal) or you do it on the server. The later case has the advantage that your page also displays right if the browser has no JS support or JS is turned off. As you decided to do HTML generation on the server, why do you want CSS generation to happen on the client? Why doesn’t your PHP code also dynamically create the CSS for you?
If you don’t want to use PHP, use any other pre-processor. There exists tons of free pre-processor, written in C (very fast!) that you can use as a replacement to the GCC C-Pre-Processor (which doesn’t work right if you are not feeding in C/C++ source files).
#define ROUNDED_CORNERS
-moz-border-radius: @radius;
-webkit-border-radius: @radius;
border-radius: @radius
#define BLUE #3bbfce
#define MARGIN 16px
#header {
ROUNDED_CORNERS;
}
#footer {
ROUNDED_CORNERS;
}
.content_navigation {
border-color = COLOR;
}
.border {
padding = MARGIN;
margin = MARGIN;
border-color = COLOR;
}
A C-like pre-processor cannot perform calculations, but other pre-processors can.
And have you ever considered to create your OWN layouting language? Instead of using HTML/CSS, have you considered using a language that perfectly fits your personal needs and then have a big PHP library that transforms your own language into HTML/CSS whenever needed? To not kill your servers, you could cache the result and only re-translate a template if it has changed. Your meta language Markup is also translated to HTML on Stackoverflow, why not doing the same for the whole rest of the page as well? It is not a performance issue and using a high level language, it’s not such a big coding issue either.