SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Sep 2002
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem with <a> tag in css

    The code below will not work. I want the links to open up in their own window with CSS. can anyone help me ?

    <html>

    <style type="text/css">
    <!--
    a { target: _blank }
    -->
    </style>

    <body>

    <a href="http://www.yahoo.com">yahoo</a>
    <a href="http://www.google.com">google</a>

    </body>

    </html>

  2. #2
    SitePoint Member
    Join Date
    Sep 2002
    Location
    East Coast
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CSS is not made to do that. If you want an image to open in a new window you add the target"_blank" to the href.
    I owe you one witty remark - Wax

  3. #3
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You'd also have to use the Transitional or Frameset HTML 4.1 or XHTML 1.0 doctypes, too. Alternatively, you could use JavaScript to open up a new window in HTML 4.1 Strict, XHTML 1.0 Strict or XHTML 1.1. CSS isn't up to that task, though. :-)

    And just a minor clarification, you'd place the target="_blank" within the anchor tag, like so:
    Code:
    <a href="..WEB_PAGE.." target="_blank">...</a>
    ~~Ian

  4. #4
    SitePoint Member
    Join Date
    Sep 2002
    Location
    East Coast
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ya know I had completely forgotten about that.

    And I think Ian is following me
    I owe you one witty remark - Wax


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
  •