A Conversation for The H2G2 Programmers' Corner

CSS Tutorial(s) wanted

Post 1

six7s

Hi there,

I'm experimenting with CSS and, although what I have written so far is 'effective', I suspect it ain't 'efficient'

In other words, I know so little that I have no idea how much I don't know...

The words CLASS and CASCADING makes me think/hope that CSS must support OO-type inheritance... but, for want of knowing, I ain't using any... or at least what I am using is far from 'elegant'

Added to this, I'm still enough of a newbie that I don't know/can't think of the right 'key words' for a (Google) search string

So, rather than read the first 10 zillion pages from each and every search, I thought I'd ask a human smiley - smiley

Scenario:
I want to have four headers that are all share 14 attributes - the only difference being font-size

e.g.

.head12
{
color: #000066;
font-family: Verdana, Arial,Helvetica,sans-serif ! important;
font-size: 12pt ! important;
font-style: normal ! important;
font-weight: bold ! important;
line-height: 200% ! important;
margin-top: 0em;
margin-bottom: 0em;
text-align: left ! important;
text-decoration: none ! important;
text-transform: none ! important;
}


What I want to do is, rather than making each similar tag 11 lines long, I'd like one 'parent' class with 10 lines that each 'child' inherits... sort of like so:

.head20
{
inherits : headParent;
font-size: 20pt ! important;
}


.head16
{
inherits : headParent;
font-size: 16pt ! important;
}

etc, etc for .head14 and .head10 where .headParent has all the other 'attributes'









So... two questions (for now smiley - silly)

1. Am I even remotely close to what can/does work with CSS?
2. Do you have any idea where to find a suitable tutorial?

Cheers
six7s




CSS Tutorial(s) wanted

Post 2

Peet (the Pedantic Punctuation Policeman, Muse of Lateral Programming Ideas, Eggcups-Spurtle-and-Spoonswinner, BBC Cheese Namer & Zaphodista)

Not exactly a tutorial, but check out http://www.meyerweb.com/eric/css/edge/ ... smiley - geek


CSS Tutorial(s) wanted

Post 3

six7s

Duly bookmarked!

Thanks Peet smiley - ok


CSS Tutorial(s) wanted

Post 4

six7s

Thanks again...

following links from the CSS/edge site, I found http://www.w3.org/TR/REC-CSS2/cascade.html#value-def-inherit and I think/hope that's what I'm looking for

Now all I need is some more of that elusive stuff called time...


CSS Tutorial(s) wanted

Post 5

sainttobox

I think there should be some reference at www.w3schools.org
I actually wasted a lot of time to read about CSS to no benefit, until I realised that I just had to grasp one simple principle - that is the syntax, perhaps you only need an editor which have support for css - like crimson edit (only for windows, else emacs probably have support for css in some packages.)


Greetings saint-tobox


Key: Complain about this post

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more