Page 2 of 2

Posted: Thu May 25, 2006 3:14 am
by GM
d11wtq wrote:
Hockey wrote:Does anyone know if CSS has any future plans to support calculations on it's values...
I've been wondering this although I've never looked into it. I've often thought it would be useful if I could have 25% width less 4 pixels or something.
Me too - I'd love to see support for variables too, so that you could change all the colours in the site by changing the values of a couple of variables.

Posted: Thu May 25, 2006 4:01 am
by onion2k
GM wrote:Me too - I'd love to see support for variables too, so that you could change all the colours in the site by changing the values of a couple of variables.

Code: Select all

h1 { font-family: verdana; }
.class1 { float: left; width: 50%; font-weight: bold; }
.class2 { float: right; width: 100%; text-decoration: none; }
.class3 { text-decoration: underline; clear: both; }
h1, .class1, class2, .class3 { color: #FF8800; }
Obviously it'd be trivial to replace the last line with a line of PHP to vary the color..

Posted: Thu May 25, 2006 7:10 am
by GM
Thanks onion2k - it's a neat way of doing it, but I meant something along the lines of:

Code: Select all

var $light_background = #DDDDDD;
var $light_shadow = #999999;

.class1 {
    color: $light_background;
    border-left: $light_shadow;
    ...
}
from a readability point of view, it's nicer.

Posted: Thu May 25, 2006 10:14 am
by RobertGonzalez
Sounds a little hacky, but I have got in the habit of using two style sheets. One that has all the color information, another that has formatting information. That way, when I want to change colors, I edit one little file and (as Emeril Lagase would say) BAM!

Posted: Fri May 26, 2006 10:00 am
by Bill H
That doesn't sound hacky at all to me. It sounds brilliant.

I've been doing it for some time. Thought it was brilliant when I read it in a DevNetwork Forum post and adopted it as my standard practice. Actually, I use three style sheets, formatting, font and color. When I class my elements I then combine the three classes in the definition.

Makes site changes simple and easy, and it makes the design process easier for me because the three sheets means fewer definitions overall. Less to remember when I'm coding and, unless I'm mistaken, less for the viewer's browser to cache.

Posted: Fri May 26, 2006 10:25 am
by RobertGonzalez
Well, don't I feel like a hackless stud now... :wink:

I find that it makes development a ton easier. Sort of like general web development. Code in modules, assemble modules, make great things. Modify as needed in a cute little compact piece of code. Sweeeet.

Posted: Fri May 26, 2006 11:40 am
by Bill H
Actually, it was this Forum that finally made a "CSS believer" out of me.

I found it unwieldy and difficult at first, I'm an "old dog" and 63 years of age, but the people on this forum led me to an understanding of the process that now has me convinced that designing web pages would be unbelievably difficult without CSS.

I'm no preacher. If you want to use tables I'm perfectly happy to let you do so. But other than for tabular data, I have found layout with CSS to be just a whole lot easier and faster. And more fun.
:)

Posted: Fri May 26, 2006 12:01 pm
by RobertGonzalez
Bill H wrote:Actually, it was this Forum that finally made a "CSS believer" out of me.

I found it unwieldy and difficult at first, I'm an "old dog" and 63 years of age, but the people on this forum led me to an understanding of the process that now has me convinced that designing web pages would be unbelievably difficult without CSS.

I'm no preacher. If you want to use tables I'm perfectly happy to let you do so. But other than for tabular data, I have found layout with CSS to be just a whole lot easier and faster. And more fun.
:)
Very well said. I am "half an old dog" at almost 32, but I was in the same boat. Then, once I got the hang of it, and once I learned that there are some pretty neat features of table design FOR TABULAR DATA, I never thought about developing a layout with a table again. Now the hard part is going back to what I have done and making it's code pretty :wink: .