...

View Full Version : Possible to define a pseudo class inline?



WA
11-07-2002, 12:53 AM
I've always wondered, is it possible to define a psuedo class, such as:

P a:hover { color:red}

as an inline style directly inside the P tag, or does the word "class" literally mean it has to be defined as such?

Thanks,

joh6nn
11-07-2002, 02:39 AM
i've thought about this before, and i came to the conclusion that it can't be done inline. i couldn't figure out to even go about doing it; what would the mark-up look like?

Alex Vincent
11-07-2002, 03:01 AM
I'm not as familiar with pseudo-classes as I should be, but there shouldn't be a problem. Psuedo-classes are selectors, and the display:inline; setting is a style rule, iirc.

joh6nn
11-07-2002, 04:18 AM
i think you're misunderstanding what George is asking, Alex. he's not trying to set some paragraph to display: inline; when the appropriate pseudo-class is true. he's trying to use inline styles, to set a pseudo-class. eg:

<P STYLE="pseudo-class: whatever;"></P>

WA
11-07-2002, 07:01 AM
Yep. Just to clarify, I wish to display a pseudo class as an inline style, something like John had cited:

<p STYLE="a:hover:color:red">

Just doesn't seem technically possible.

MCookie
11-07-2002, 10:42 AM
Working draft at w3.org: http://www.w3.org/TR/css-style-attr

Kiwi
11-07-2002, 12:13 PM
Alex's answer was correct (I have no idea if he understood the question or not). The pseduoclass is a selector. Inline styles contain rules. These are not the same thing and can't be combined that way.

Something that might be similar and I think would be useful, but I haven't worked out if it's possible. Is it possible to have an inline element (such as a link) inherit the class of its parent? So you have code something like this:
<p class="para1">
<a href="blah.html">here</a>
More text
</p>Now, I want all the <a ..> tags to have the class para1. Then I can define the pseudo classes in the style definitions. But this doesn't seem to work. I have to assign the class to each element within the block. Pseudo class properties don't seem to be inherited.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum