css -- new window for hyperlinks

Discussion in 'HTML' started by one.1more@gmail.com, Mar 5, 2007.

  1. Guest

    I have a 15 page website.
    Every single page is linked to a external style sheet style.css. Now,
    when ever i click i link in my website, it opens in the same window. i
    want the hyperlinks to open in a new window. i know how to do it for a
    single link (using target _blank) but i don't want to do it 100
    times.
    is there something i can do in the external style sheet? like adding
    a:something { }
     
    , Mar 5, 2007
    #1
    1. Advertising

  2. Scripsit :

    > I have a 15 page website.


    Would it be different if there were 42 pages?

    > Every single page is linked to a external style sheet style.css.


    OK. Though it has nothing to do with your question.

    > Now,
    > when ever i click i link in my website, it opens in the same window.


    Perhaps. It depends on the way you click. Among other things.

    > i want the hyperlinks to open in a new window.


    Stop wanting that. Problem solved.

    > i know how to do it for a
    > single link (using target _blank)


    Too bad (if your site has some meaningful content).

    > but i don't want to do it 100 times.


    Fine.

    > is there something i can do in the external style sheet? like adding
    > a:something { }


    Thank &Deity;, no.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Mar 5, 2007
    #2
    1. Advertising

  3. Guest

    > Thank &Deity;, no.
    I was researching for a way and i actually found it
    the solution is { target-new:window} ref:http://www.w3.org/TR/css3-
    hyperlinks/#the-target-new
    But it created a new problem
    in the style.css, i have two styles #header and #content. all the
    pages are divided into a div with header style and a div with content
    style

    After using the method. this is how my style looks ( i condensed it)
    #header { font-size:18;}
    #content{font-size:14;target-new:window;}
    The problem: all the links in the header part of my pages open into
    new windows too. i just want the content windows' hyperlinks to open
    in new windows. how do i fix this?



    On Mar 5, 4:48 pm, "Jukka K. Korpela" <> wrote:
    > Scripsit :
    >
    > > I have a 15 page website.

    >
    > Would it be different if there were 42 pages?
    >
    > > Every single page is linked to a external style sheet style.css.

    >
    > OK. Though it has nothing to do with your question.
    >
    > > Now,
    > > when ever i click i link in my website, it opens in the same window.

    >
    > Perhaps. It depends on the way you click. Among other things.
    >
    > > i want the hyperlinks to open in a new window.

    >
    > Stop wanting that. Problem solved.
    >
    > > i know how to do it for a
    > > single link (using target _blank)

    >
    > Too bad (if your site has some meaningful content).
    >
    > > but i don't want to do it 100 times.

    >
    > Fine.
    >
    > > is there something i can do in the external style sheet? like adding
    > > a:something { }

    >
    > Thank &Deity;, no.
    >
    > --
    > Jukka K. Korpela ("Yucca")http://www.cs.tut.fi/~jkorpela/
     
    , Mar 5, 2007
    #3
  4. Ed Seedhouse Guest

    On 5 Mar 2007 13:15:27 -0800, wrote:

    >I have a 15 page website.
    >Every single page is linked to a external style sheet style.css. Now,
    >when ever i click i link in my website, it opens in the same window. i
    >want the hyperlinks to open in a new window. i know how to do it for a
    >single link (using target _blank) but i don't want to do it 100
    >times.
    >is there something i can do in the external style sheet? like adding
    >a:something { }


    Don't do it at all. It is an outdated practice that drives users away
    from your site.
     
    Ed Seedhouse, Mar 5, 2007
    #4
  5. wrote:
    > I have a 15 page website.
    > Every single page is linked to a external style sheet style.css. Now,
    > when ever i click i link in my website, it opens in the same window. i
    > want the hyperlinks to open in a new window. i know how to do it for a
    > single link (using target _blank) but i don't want to do it 100
    > times.
    > is there something i can do in the external style sheet? like adding
    > a:something { }
    >


    Let's put aside all the reasons why your links should not open in new
    windows ans say CSS is for controlling the presentation not the
    mechanics or the behavior of a web document (The only exception it can
    think of where the technical distinction is blurred is with the
    pseudo-classes :hover, :focus and :active) If you want to change
    behavior universally like that, aside of hard-coding the attribute I
    would say JavaScript would be the way...

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Mar 5, 2007
    #5
  6. wrote:

    > I was researching for a way and i actually found it
    > the solution is { target-new:window} ref:http://www.w3.org/TR/css3-
    > hyperlinks/#the-target-new


    That CSS3, IE still doesn't support all of CSS2.1 you're going to get
    very spotty support for CSS3.

    > But it created a new problem
    > in the style.css, i have two styles #header and #content. all the
    > pages are divided into a div with header style and a div with content
    > style
    >
    > After using the method. this is how my style looks ( i condensed it)
    > #header { font-size:18;}

    ^^^
    > #content{font-size:14;target-new:window;}

    ^^^
    Invalid, 18 and 14[what]? Miles? Need units for most CSS value lengths.

    > The problem: all the links in the header part of my pages open into
    > new windows too. i just want the content windows' hyperlinks to open
    > in new windows. how do i fix this?
    >

    Who knows? We cannot see your markup...no URL!

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Mar 5, 2007
    #6
  7. Guest

    >Who knows? We cannot see your markup...no URL!
    here is css3.css
    -----------------------------------------------------
    body {
    font-family:arial,helvetica,sans-serif;
    font-size:12px;
    }
    #header {
    border: 1px solid #bbb;
    height: 80px;
    padding: 10px;
    font-size: 12px;
    }
    #content {
    border: 1px solid #bbb;
    height: 600px;
    padding: 10px;
    font-size: 14px;
    target-new:window;

    }
    -------------------------------------------------------------------------------------
    here is index.html
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
    www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="css3.css" rel="stylesheet" type="text/css" />

    </head>

    <body>
    <div id="header">
    <a href="http://google.com">link in header
    </a>
    </div>
    <div id="content">
    <a href="http://yahoo.com">Link in footer
    </a>
    </div>
    </body>

    </html>


    --------------------------------------------------------------------------------------------------------------------------












    On Mar 5, 6:28 pm, "Jonathan N. Little" <> wrote:
    > wrote:
    > > I was researching for a way and i actually found it
    > > the solution is { target-new:window} ref:http://www.w3.org/TR/css3-
    > > hyperlinks/#the-target-new

    >
    > That CSS3, IE still doesn't support all of CSS2.1 you're going to get
    > very spotty support for CSS3.
    >
    > > But it created a new problem
    > > in the style.css, i have two styles #header and #content. all the
    > > pages are divided into a div with header style and a div with content
    > > style

    >
    > > After using the method. this is how my style looks ( i condensed it)
    > > #header { font-size:18;}

    >
    > ^^^> #content{font-size:14;target-new:window;}
    >
    > ^^^
    > Invalid, 18 and 14[what]? Miles? Need units for most CSS value lengths.
    >
    > > The problem: all the links in the header part of my pages open into
    > > new windows too. i just want the content windows' hyperlinks to open
    > > in new windows. how do i fix this?

    >
    > Who knows? We cannot see your markup...no URL!
    >
    > --
    > Take care,
    >
    > Jonathan
    > -------------------
    > LITTLE WORKS STUDIOhttp://www.LittleWorksStudio.com
     
    , Mar 6, 2007
    #7
  8. Scripsit Jonathan N. Little:

    > wrote:
    >
    >> I was researching for a way and i actually found it
    >> the solution is { target-new:window} ref:http://www.w3.org/TR/css3-
    >> hyperlinks/#the-target-new

    >
    > That CSS3, IE still doesn't support all of CSS2.1 you're going to get
    > very spotty support for CSS3.


    There is no CSS 3 except as a collection of various drafts, some of them
    obsolete, some of them obsolescent, and some of them possibly progressing to
    recommendation status some day.

    A few of the huge number of new properties proposed in CSS 3 drafts have
    been experimentally implemented, usually with many restrictions, in some
    browsers. Thank &Deity;, as I wrote, the target properties don't belong even
    to this "experimentally implemented" set.

    > Who knows? We cannot see your markup...no URL!


    Who cares? The poster is either a troll or a clueless
    newbie who has firmly decided to remain a clueless newbie, as judged from
    the continued clueless posting style.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Mar 6, 2007
    #8
  9. Jukka K. Korpela wrote:
    > Scripsit Jonathan N. Little:
    >
    >> wrote:
    >>
    >>> I was researching for a way and i actually found it
    >>> the solution is { target-new:window} ref:http://www.w3.org/TR/css3-
    >>> hyperlinks/#the-target-new

    >>
    >> That CSS3, IE still doesn't support all of CSS2.1 you're going to get
    >> very spotty support for CSS3.

    >
    > There is no CSS 3 except as a collection of various drafts, some of them
    > obsolete, some of them obsolescent, and some of them possibly
    > progressing to recommendation status some day.


    Totally agree, I debated whether or not to mention it to OP but figure
    it would probably just confuse him more! Only a hand full of browsers
    have 'tried' to support some of CSS3 proposal properties, but with it
    all so tenuous I would tell developers it is a waste of time.

    As to this 'target-new' property the OP is futzing about, I do not have
    a browser that supports it, but then again if supported probably
    overridden by browser settings. I have must set to open new windows into
    a tab, the way *I* what it! But it is probably trying to convince the OP
    this.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Mar 6, 2007
    #9
  10. Andy Dingley Guest

    On 5 Mar, 21:15, wrote:
    > I have a 15 page website.


    > i want the hyperlinks to open in a new window.


    > is there something i can do in the external style sheet?


    No.

    If you really want this, then the easiest way is the simple way of
    using a target attribute on each <a>. Just find a smart way of
    applying this change. Now's a good day to learn about good editors and
    "regular expressions" (try jEdit)


    It's unpopular locally to do this, but if you _really_ want to, then
    it's your site.
     
    Andy Dingley, Mar 6, 2007
    #10
  11. Scripsit Andy Dingley:

    >> i want the hyperlinks to open in a new window.

    - -
    > If you really want this, then the easiest way is the simple way of
    > using a target attribute on each <a>.


    Actually, there's a faster way of doing the damage: <base target="_blank">.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Mar 6, 2007
    #11
  12. Dynamictc

    Joined:
    Mar 24, 2007
    Messages:
    4
    opening a new window


    Well, this script actually passes strict validation to open a new window: onclick="target='newwindow'">

    Bobby Blake
    {Dynamictc}
     
    Dynamictc, Mar 24, 2007
    #12
  13. Dynamictc

    Joined:
    Mar 24, 2007
    Messages:
    4
    You may have to do a lot of copy and paste, but at least it will pass strict validation. I made this script that you can use:

    <a href="...your link..." onclick="target='newwindow'"></a>

    of course you will have to change the quotes to meet your needs, but as long as the "onclick" is there, it should work.

    Dynamictc
     
    Dynamictc, Mar 24, 2007
    #13
  14. Dynamictc

    Joined:
    Mar 24, 2007
    Messages:
    4

    I know everyone has told you there is no way to put an "Open New Window" link in your style sheet for all of your links but there is. It has worked for me so I will help anyone interested. But I won't post it here. Since no one else has it, I am going to hold onto it. If you are still interested after this insert, I will help you out. You can email me at to get the code.

    Bobby Blake
     
    Dynamictc, Mar 28, 2007
    #14
  15. Dynamictc

    Joined:
    Mar 24, 2007
    Messages:
    4
    dynamictc @ cableone . net
     
    Dynamictc, Mar 29, 2007
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Tm92aWNl?=
    Replies:
    2
    Views:
    6,718
    Alan Ferrandiz Langley
    Jun 9, 2004
  2. kiki

    css hyperlinks not working

    kiki, Aug 14, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    410
  3. Jason

    Hyperlinks and window status

    Jason, Feb 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    333
    Jason
    Feb 9, 2005
  4. Jason
    Replies:
    1
    Views:
    406
    Jason
    Feb 10, 2005
  5. W. Paulisse

    CSS hyperlinks and tables

    W. Paulisse, Jan 28, 2004, in forum: HTML
    Replies:
    5
    Views:
    769
    Nik Coughin
    Jan 28, 2004
Loading...

Share This Page