How to get to the root?

Discussion in 'HTML' started by Samuël van Laere, Oct 12, 2004.

  1. Hi friendly people (yeah even you Brucie beast),

    I've just got a stupid question and it probally got an easy answer
    i'm sure I once knew how to do it, but I forgot, so here goes:

    root/style.css
    root/mydirectory/page1.html

    How can I include the style.css file into page1.html without using a
    absolute url?

    I'll try to remember it this time. :p

    With regards,
    Samuël van Laere
    the Netherlands
    Samuël van Laere, Oct 12, 2004
    #1
    1. Advertising

  2. Samuël van Laere

    Neal Guest

    On Tue, 12 Oct 2004 02:35:25 GMT, Samuël van Laere <>
    wrote:

    > Hi friendly people (yeah even you Brucie beast),
    >
    > I've just got a stupid question and it probally got an easy answer
    > i'm sure I once knew how to do it, but I forgot, so here goes:
    >
    > root/style.css
    > root/mydirectory/page1.html
    >
    > How can I include the style.css file into page1.html without using a
    > absolute url?
    >
    > I'll try to remember it this time. :p


    To refer to the root, start with / then indicate the path.

    In your case, you could use /style.css (static) or ../style.css (relative).
    Neal, Oct 12, 2004
    #2
    1. Advertising

  3. Samuël van Laere

    Sam Hughes Guest

    "Samuël van Laere" <> wrote in news:NpHad.6874$G33.5351
    @amsnews02.chello.com:

    > Hi friendly people (yeah even you Brucie beast),
    >
    > I've just got a stupid question and it probally got an easy answer
    > i'm sure I once knew how to do it, but I forgot, so here goes:
    >
    > root/style.css
    > root/mydirectory/page1.html
    >
    > How can I include the style.css file into page1.html without using a
    > absolute url?
    >
    > I'll try to remember it this time. :p


    .../style.css
    Sam Hughes, Oct 12, 2004
    #3
  4. Samuël van Laere

    brucie Guest

    In alt.html Samuël van Laere said:

    > Hi friendly people (yeah even you Brucie beast),


    i really am a nice guy, people just use a nasty font in their
    newsreaders that makes me sound evil. try a nice VladimirScrD and you'll
    be pleasantly surprised.


    --


    v o i c e s
    brucie, Oct 12, 2004
    #4
  5. While the city slept, brucie () feverishly typed...

    > In alt.html Samuël van Laere said:
    >
    >> Hi friendly people (yeah even you Brucie beast),

    >
    > i really am a nice guy [...]


    That's me, isn't it??

    At least he got your name right! ;-) (apart from the surname, of course...)

    Cheers,
    Nige

    --
    Nigel Moss
    http://www.nigenet.org.uk
    Mail address not valid. , take the DOG. out!
    In the land of the blind, the one-eyed man is very, very busy!
    nice.guy.nige, Oct 12, 2004
    #5
  6. Samuël van Laere

    Guest

    On Tue, 12 Oct 2004 02:35:25 GMT, "Samuël van Laere" <> wrote:

    >How can I include the style.css file into page1.html without using a
    >absolute url?


    <link rel="stylesheet" href="../style.css" type="text/css">
    , Oct 13, 2004
    #6
  7. Samuël van Laere

    Karl Core Guest

    <> wrote in message
    news:...
    >
    > On Tue, 12 Oct 2004 02:35:25 GMT, "Samuël van Laere" <>
    > wrote:
    >
    >>How can I include the style.css file into page1.html without using a
    >>absolute url?

    >
    > <link rel="stylesheet" href="../style.css" type="text/css">


    Um, no. Try again.

    -Karl
    Karl Core, Oct 13, 2004
    #7
  8. Samuël van Laere

    Neal Guest

    On Wed, 13 Oct 2004 11:08:04 -0400, Karl Core <>
    wrote:

    >
    > <> wrote in message
    > news:...
    >>
    >> On Tue, 12 Oct 2004 02:35:25 GMT, "Samuël van Laere" <>
    >> wrote:
    >>
    >>> How can I include the style.css file into page1.html without using a
    >>> absolute url?

    >>
    >> <link rel="stylesheet" href="../style.css" type="text/css">

    >
    > Um, no.


    What's wrong with the above? I don't see it. Please point it out, and tell
    me what would be correct.

    It exactly parallels the line

    <LINK rel="stylesheet" href="bach.css" type="text/css">

    found at http://www.w3.org/TR/CSS21/intro.html . Except the ../ is used to
    point the browser up a directory relative to the current one, which is
    what OP wanted.
    Neal, Oct 13, 2004
    #8
  9. Samuël van Laere

    Karl Core Guest

    "Neal" <> wrote in message
    news:eek:...
    > On Wed, 13 Oct 2004 11:08:04 -0400, Karl Core <>
    > wrote:
    >
    >>
    >> <> wrote in message
    >> news:...
    >>>
    >>> On Tue, 12 Oct 2004 02:35:25 GMT, "Samuël van Laere" <>
    >>> wrote:
    >>>
    >>>> How can I include the style.css file into page1.html without using a
    >>>> absolute url?
    >>>
    >>> <link rel="stylesheet" href="../style.css" type="text/css">

    >>
    >> Um, no.

    >
    > What's wrong with the above? I don't see it. Please point it out, and tell
    > me what would be correct.
    >
    > It exactly parallels the line
    >
    > <LINK rel="stylesheet" href="bach.css" type="text/css">
    >
    > found at http://www.w3.org/TR/CSS21/intro.html . Except the ../ is used to
    > point the browser up a directory relative to the current one, which is
    > what OP wanted.


    That does not necessarily lead to root. If the page in question is three
    directories deep and the style sheet is in the doc root, then it doesn't go
    deep enough.
    The answer would be <link rel="stylesheet" href="/style.css"
    type="text/css">


    -Karl
    Karl Core, Oct 13, 2004
    #9
  10. Samuël van Laere

    Neal Guest

    Karl Core wrote:
    > "Neal" wrote
    >> Karl Core wrote:
    >>> <> wrote
    >>>> <link rel="stylesheet" href="../style.css" type="text/css">
    >>> Um, no.

    >> What's wrong with the above?

    > That does not necessarily lead to root. If the page in question is three
    > directories deep and the style sheet is in the doc root, then it doesn't
    > go deep enough.


    Yes, I agree. But the poster gave an example of the directory structure
    where the page was in the very next level (snipped in Marcus' reply).

    root/style.css
    root/mydirectory/page1.html

    For the OP's situation, it should work fine. Though it is also true that
    if the page were moved to a different directory level, unless the css file
    was moved similarly the relationship would break.
    Neal, Oct 13, 2004
    #10
  11. Samuël van Laere

    Karl Core Guest

    "Neal" <> wrote in message
    news:eek:...
    > Karl Core wrote:
    >> "Neal" wrote
    >>> Karl Core wrote:
    >>>> <> wrote
    >>>>> <link rel="stylesheet" href="../style.css" type="text/css">
    >>>> Um, no.
    >>> What's wrong with the above?

    >> That does not necessarily lead to root. If the page in question is three
    >> directories deep and the style sheet is in the doc root, then it doesn't
    >> go deep enough.

    >
    > Yes, I agree. But the poster gave an example of the directory structure
    > where the page was in the very next level (snipped in Marcus' reply).
    >
    > root/style.css
    > root/mydirectory/page1.html
    >
    > For the OP's situation, it should work fine. Though it is also true that
    > if the page were moved to a different directory level, unless the css file
    > was moved similarly the relationship would break.
    >


    My apologies, Neal. I didn't see the OP, just Marcus' reply.

    -Karl
    Karl Core, Oct 13, 2004
    #11
  12. Samuël van Laere

    Toby Inkster Guest

    Karl Core wrote:

    > <link rel="stylesheet" href="/style.css" type="text/css">


    But the OP said:

    | How can I include the style.css file into page1.html without using a
    | absolute url?

    "/style.css" is absolute (though I believe it is what the OP wants deep
    down).

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Toby Inkster, Oct 13, 2004
    #12
    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. Replies:
    0
    Views:
    1,201
  2. Peter Row
    Replies:
    0
    Views:
    464
    Peter Row
    Jan 28, 2004
  3. Rick Osborn
    Replies:
    10
    Views:
    3,939
    Jon A. Cruz
    Feb 8, 2004
  4. hector
    Replies:
    5
    Views:
    398
    CBFalconer
    Dec 5, 2006
  5. Linuxguy123
    Replies:
    2
    Views:
    908
Loading...

Share This Page