CSS

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

GM
Forum Contributor
Posts: 365
Joined: Wed Apr 26, 2006 4:19 am
Location: Italy

Post 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.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post 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..
GM
Forum Contributor
Posts: 365
Joined: Wed Apr 26, 2006 4:19 am
Location: Italy

Post 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.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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!
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post 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.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post 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.
:)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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: .
Post Reply