Can I define the target property of <a> with CSS?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mikek12004
    New Member
    • Sep 2008
    • 200

    #1

    Can I define the target property of <a> with CSS?

    Supose you want to make sure that its link on your websites open in the same browser window not a new one, in HTML you would have inside every a tag to define target='_self' for every link does CSS has any such property for me to avoid all thia trouble?
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Originally posted by mikek12004
    …, in HTML you would have inside every a tag to define target='_self' for every link
    well, usually this is default behaviour (at least when using relative paths, I think). further, target is not allowed in the strict doctype html variants.

    and of course you can tweak you favourite browser to open the link target where you want ;)

    Originally posted by mikek12004
    does CSS has any such property for me to avoid all thia trouble?
    nope, CSS deals with layout (how the browser displays your page)

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      If you must do this for whatever reason, it'd usually be to try to ensure it opens in a new window (unless someone tweaks their browser), then you could use JavaScript to set the property of each link.

      Comment

      Working...