470,602 Members | 1,649 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,602 developers. It's quick & easy.

CSS inheritance?

Hi there,

Here goes the silly question of the day, by a total newbie. I have this two
css defined:

.HoverMe
{
font: bold 10px Verdana, sans-serif;
....
border-color: #FFC8A4 #7D3302 #3F1A01 #FF9A57;
}

..ClickMe
{
font: bold 10px Verdana, sans-serif;
border-color: #FFC8A4 #7D3302 #3F1A01 #FF9A57;
....
cursor: pointer;
}

They are very similar, only ".ClickMe" adds a final "cursor: pointer;"
element. Well, is it possible to do something like this:

..ClickMe : HoverMe
{
cursor: pointer;
}

One css inherits its members to another one, which adds the new required
element. Is it possible or do I really need to go to sleep? :)

Thanks in advance,

-Benton
Dec 5 '06 #1
3 1451
Benton <co*******@gmail.comwrote:
I have this two css defined:

.HoverMe
{
font: bold 10px Verdana, sans-serif;
...
border-color: #FFC8A4 #7D3302 #3F1A01 #FF9A57;
}

.ClickMe
{
font: bold 10px Verdana, sans-serif;
border-color: #FFC8A4 #7D3302 #3F1A01 #FF9A57;
...
cursor: pointer;
}

They are very similar, only ".ClickMe" adds a final "cursor:
pointer;" element. Well, is it possible to do something like
this:

.ClickMe : HoverMe
{
cursor: pointer;
}
Yes, almost. You do it like this:

a, b {
/* stuff that will be applied to both 'a' and 'b' */
}
b {
/* stuff that will only be applied to 'b' */
}

--
David Håsäther

Dec 5 '06 #2
Benton wrote:
One css inherits its members to another one, which adds the new required
element.
http://dorward.me.uk/www/css/inheritance/ discusses the subject.

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Dec 5 '06 #3
Scripsit Benton:
Here goes the silly question of the day, by a total newbie.
No need to mention such things; we can see it from the clueless class names,
the use of 10px and Verdana, and from your asking about inheritance (which
usually means no inheritance is relevant).
I have
this two css defined:
So you have two CSS rules. What makes you think there's some inheritance?
They are very similar, only ".ClickMe" adds a final "cursor: pointer;"
element.
The idea of changing the cursor is twisted. It typically means trying to
make a link look like a non-link, or vice versa.
Well, is it possible to do something like this:

.ClickMe : HoverMe
Try learning CSS, not inventing it.

David Håsäther referred, at an abstract level, to the technique that can be
used to achieve a situation where some elements share some property settings
while one (or both) may have settings of its own as well. It has _nothing_
to do with inheritance.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Dec 7 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Graham Banks | last post: by
4 posts views Thread by JKop | last post: by
5 posts views Thread by Morgan Cheng | last post: by
10 posts views Thread by davidrubin | last post: by
14 posts views Thread by Steve Jorgensen | last post: by
22 posts views Thread by Matthew Louden | last post: by
45 posts views Thread by Ben Blank | last post: by
6 posts views Thread by Bart Simpson | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.