Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts

    Possible to define a pseudo class inline?

    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,
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    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?
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,460
    Thanks
    1
    Thanked 23 Times in 21 Posts
    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.
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #4
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    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>
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #5
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts
    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.
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    NL
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Working draft at w3.org: http://www.w3.org/TR/css-style-attr

  • #7
    Regular Coder
    Join Date
    Oct 2002
    Posts
    380
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:
    Code:
    <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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •