Web Analytics Made Easy -
StatCounter Is there any code to put in CSS in order the links to open in a new window? - CodingForum

Announcement

Collapse
No announcement yet.

Is there any code to put in CSS in order the links to open in a new window?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is there any code to put in CSS in order the links to open in a new window?

    Is there any code to put in CSS in order the links to open in a new window?
    (similar to target _blank in a css file)

  • #2
    I'm guessing you meant “similar to target _blank in [an HTML] file”. No, you can't do this with CSS. You need to use either the target attribute or JavaScript.

    My personal take is that you shouldn't mess with the user's preferences this regard: if the user clicks normally the content should open in the same window; if the user Shift+left-clicks, the content should open in a new window; and if the user Ctrl+left-clicks or middle-clicks, content should open in a new tab. In other words, let the user decide.

    Comment


    • #3
      What a stupid question i was asking some months ago

      Comment


      • #4
        I agree with Arbitrator here, let the user decide.
        .
        .

        Comment


        • #5
          The user can decide anyway since at least some modern browsers allow you to configure for yourself how you want different links to work regardless of how the author coded them.
          Stephen
          Learn Modern JavaScript - http://javascriptexample.net/
          Helping others to solve their computer problem at http://www.felgall.com/

          Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

          Comment

          Working...
          X