SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast jitao's Avatar
    Join Date
    Feb 2003
    Location
    Shanghai
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question What the contextual selector does not work?

    Here is the original HTML:
    HTML Code:
     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> css test</TITLE>
    <style type="text/css">
    body {
    background-color: black; 
    color:aqua;
    }
    p {
    color: #0000FF;
    }
    .sidebar { 
    color:#ffffff;
    }
    p.sidebar a:link, p.sidebar a:visited {
    font-weight: bold;
    color: white;
    }
    h3{
    color: green;
    }
    </style>
    </HEAD>
    <BODY>
    <p class="sidebar"> white text group 1,
    <h3> <a href="link.html"> and so will this link. </a>Other text has what color</h3>
    </p>
    <p class="sidebar"> white text group 2,
    <span> <a href="link.html"> and so will this link. </a> Other text has what color</span>
    </p>
    <hr>
    <a href="">This is a normal link</a>;
    </BODY>
    </HTML>
    Why the conextual selector works fine if it is within a span tag, but it does not work if a link is contained by a heading tag?

    Thank you!

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,217
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    you cannot put an H3 inside a P

    tip: always validate your html, and once your html is okay, then validate your css
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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