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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 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
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,338
    Thanks
    29
    Thanked 282 Times in 276 Posts
    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.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #3
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What a stupid question i was asking some months ago

  • #4
    Regular Coder Jutlander's Avatar
    Join Date
    Jun 2007
    Location
    In my own sick little world :P
    Posts
    425
    Thanks
    1
    Thanked 12 Times in 12 Posts
    I agree with Arbitrator here, let the user decide.
    .
    .

  • #5
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    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.


  •  

    Posting Permissions

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