CSS inlusion does not work

Discussion in 'HTML' started by John Smith, Feb 17, 2004.

  1. John Smith

    John Smith Guest

    I had a similar problem,
    I solved this by changing the order of the attributes.

    Try this:
    <link rel="stylesheet" type="text/css" href="main.css">

    Why or how don't ask me the only way I figured this out was that some of my
    pages worked and others didn't and this was the difference!


    "Matthias Pospiech" <> schreef in bericht
    news:c0sj1s$j36$04$-online.com...
    > IF I try to set style settings inside a file they are not recognised, only
    > if they are directly inside to main html file.
    > Here an example: The body settings for Font are only used if inside the

    main
    > file, not if inside the css file:
    >
    > <html>
    > <!------------------------------ HEAD ---------------->
    > <head>
    > <title>Matthias Pospiech</title>
    > <link href="main.css" rel="stylesheet" type="text/css">
    > <style type="text/css">
    > </style>
    > </head>
    >
    > <!------------------------------ BODY ---------------->
    > <body>
    > Text
    > </body>
    > </html>
    >
    >
    > // CSS - Style: Main Settings
    >
    > body {
    > font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
    > font-size : 100%;
    > background-color : #FFFFFF;
    > color : #000000;
    > margin: 0px 0px 0px 0px;
    > padding:0px;
    > }
    >
    > This means that I cannot use style sheet files ! I tried in Opera and
    > Mozilla.
    >
    > Matthias Pospiech
    >
    John Smith, Feb 17, 2004
    #1
    1. Advertising

  2. Matthias Pospiech wrote:
    > IF I try to set style settings inside a file they are not recognised, only
    > if they are directly inside to main html file.
    >
    > <link href="main.css" rel="stylesheet" type="text/css">


    What's the URL so we can see what you're really doing?
    Are you sure the HREF attribute points to the correct folder and file?
    Does the server send the correct MIME type for the stylesheet?


    Matthias
    Matthias Gutfeldt, Feb 17, 2004
    #2
    1. Advertising

  3. IF I try to set style settings inside a file they are not recognised, only
    if they are directly inside to main html file.
    Here an example: The body settings for Font are only used if inside the main
    file, not if inside the css file:

    <html>
    <!------------------------------ HEAD ---------------->
    <head>
    <title>Matthias Pospiech</title>
    <link href="main.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    </style>
    </head>

    <!------------------------------ BODY ---------------->
    <body>
    Text
    </body>
    </html>


    // CSS - Style: Main Settings

    body {
    font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
    font-size : 100%;
    background-color : #FFFFFF;
    color : #000000;
    margin: 0px 0px 0px 0px;
    padding:0px;
    }

    This means that I cannot use style sheet files ! I tried in Opera and
    Mozilla.

    Matthias Pospiech
    Matthias Pospiech, Feb 17, 2004
    #3
  4. John Smith

    rf Guest

    "Matthias Pospiech" <> wrote in message
    news:c0sj1s$j36$04$-online.com...
    > IF I try to set style settings inside a file they are not recognised, only
    > if they are directly inside to main html file.
    > Here an example: The body settings for Font are only used if inside the

    main
    > file, not if inside the css file:


    <snip code>

    As usual a URL is essential. Copy/pasted stuff *always* looses something
    vital.

    I'll just be you have this as the first line of your CSS file:

    <style type="text/css">

    Cheers
    Richard.
    rf, Feb 17, 2004
    #4
  5. Barry Pearson, Feb 17, 2004
    #5
  6. Matthias Gutfeldt wrote:

    > Matthias Pospiech wrote:
    >> IF I try to set style settings inside a file they are not recognised,
    >> only if they are directly inside to main html file.
    > >
    >> <link href="main.css" rel="stylesheet" type="text/css">

    >
    > What's the URL so we can see what you're really doing?

    Its locally on my computer.
    > Are you sure the HREF attribute points to the correct folder and file?

    Yes, if I include the .container (see below) and set the text inside a <div
    class="container"> it works
    > Does the server send the correct MIME type for the stylesheet?

    How can I check that ?

    Matthias


    -------------------------------------
    ..container {
    width: 700px;
    border: 0px solid gray;
    margin: 0px;
    margin-left: auto;
    margin-right: auto;
    padding: 0px;
    background-color : #F0F0F0;
    }
    Matthias Pospiech, Feb 17, 2004
    #6
  7. John Smith wrote:

    > I had a similar problem,
    > I solved this by changing the order of the attributes.
    >
    > Try this:
    > <link rel="stylesheet" type="text/css" href="main.css">
    >
    > Why or how don't ask me the only way I figured this out was that some of
    > my pages worked and others didn't and this was the difference!


    It does not make a difference.

    Matthias
    Matthias Pospiech, Feb 17, 2004
    #7
  8. John Smith

    SteW Guest

    Matthias Pospiech wrote:
    > IF I try to set style settings inside a file they are not recognised, only
    > if they are directly inside to main html file.
    > Here an example: The body settings for Font are only used if inside the main
    > file, not if inside the css file:
    >
    > <html>
    > <!------------------------------ HEAD ---------------->
    > <head>
    > <title>Matthias Pospiech</title>
    > <link href="main.css" rel="stylesheet" type="text/css">
    > <style type="text/css">
    > </style>
    > </head>
    >
    > <!------------------------------ BODY ---------------->
    > <body>
    > Text
    > </body>
    > </html>


    > Matthias Pospiech
    >


    It is the hyphens in your comments that are the problem.
    Remove the hyphens from inside all comments and your stylesheet will work.
    For example
    <!-- ************* HEAD ************* -->

    Actually it is consecutive hyphens -- that are causing the problem, so
    <!-- - - - - - BODY - - - - - -->
    would be ok too.

    Ste W
    SteW, Feb 17, 2004
    #8
  9. Quoth the raven named Matthias Pospiech:

    > body {
    > font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
    > font-size : 100%;


    While we're examining your style sheet, consider this. Verdana is a
    poor choice of font. I'd recommend using only Arial, Helvetica,
    sans-serif;

    http://www.xs4all.nl/~sbpoley/webmatters/verdana.html

    Your choice of size at 100% is perfect, though.

    --
    -bts
    -This space intentionally left blank.
    Beauregard T. Shagnasty, Feb 17, 2004
    #9
  10. John Smith

    Chet Guest

    "Matthias Pospiech" <> wrote in message
    news:c0sj1s$j36$04$-online.com...
    | IF I try to set style settings inside a file they are not
    recognised, only
    | if they are directly inside to main html file.
    | Here an example: The body settings for Font are only used if
    inside the main
    | file, not if inside the css file:
    |
    | <html>
    | <!------------------------------ HEAD ---------------->
    | <head>
    | <title>Matthias Pospiech</title>
    | <link href="main.css" rel="stylesheet" type="text/css">
    | <style type="text/css">
    | </style>
    | </head>
    |
    | <!------------------------------ BODY ---------------->
    | <body>
    | Text
    | </body>
    | </html>
    |
    |
    | // CSS - Style: Main Settings
    |
    | body {
    | font-family: Verdana, Geneva, Lucida, Arial, Helvetica,
    sans-serif;
    | font-size : 100%;
    | background-color : #FFFFFF;
    | color : #000000;
    | margin: 0px 0px 0px 0px;
    | padding:0px;
    | }
    |
    | This means that I cannot use style sheet files ! I tried in
    Opera and
    | Mozilla.
    |
    | Matthias Pospiech
    |

    In the head remove

    <style type="text/css">
    </style>

    This may be overriding the external css since it is empty. Just a
    thought...

    hth
    --
    Chet
    (remove NO.....SPAM)
    Chet, Feb 17, 2004
    #10
  11. Quoth the raven named Chet:

    > In the head remove
    >
    > <style type="text/css">
    > </style>
    >
    > This may be overriding the external css since it is empty. Just a
    > thought...


    No, that won't have any effect, so long as it is typed correctly.

    --
    -bts
    -This space intentionally left blank.
    Beauregard T. Shagnasty, Feb 17, 2004
    #11
  12. Matthias Pospiech wrote:

    >Matthias Gutfeldt wrote:
    >
    >
    >
    >>Does the server send the correct MIME type for the stylesheet?
    >>
    >>

    >How can I check that ?
    >
    >


    In mozilla, if it's being served up as a text/plain it will put an error
    in the JavaScript console. Also if you look at the page using mozilla
    and go to page info, it will also tell you if it's text/plain or text/css
    Neil Marshall, Feb 18, 2004
    #12
  13. Beauregard T. Shagnasty wrote:

    > Quoth the raven named Matthias Pospiech:
    >
    >> body {
    >> font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
    >> font-size : 100%;

    >
    > While we're examining your style sheet, consider this. Verdana is a
    > poor choice of font. I'd recommend using only Arial, Helvetica,
    > sans-serif;
    >
    > http://www.xs4all.nl/~sbpoley/webmatters/verdana.html
    >

    I had read other article with contrary positions. Their reason why one
    should use Verdana is that it is quite big even on computers with lower
    font sizes, like Mac or Linux.
    On the other hand I can follow the argument of this article. I will have to
    think about it, but thats not what worries me now the most...

    Matthias Pospiech
    Matthias Pospiech, Feb 18, 2004
    #13
  14. "Matthias Pospiech" <> wrote in message
    news:c0sqgr$vej$07$-online.com...
    > Matthias Gutfeldt wrote:
    >
    > > Does the server send the correct MIME type for the stylesheet?

    > How can I check that ?


    One quick way is to open the css file directly in Opera and hover over the
    page tab, it appears in a tool-tip. In Firefox open the css file directly
    and use the 'View Page Info" option in the 'right click' context menu, it's
    displayed as "type" on the general tab.
    --
    Andrew Urquhart
    Reply: www.andrewu.co.uk/about/contact/?subject=newsgroup_althtml
    Andrew Urquhart, Feb 24, 2004
    #14
    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. Ukiharappa
    Replies:
    3
    Views:
    557
    Safalra
    Oct 8, 2003
  2. ricky
    Replies:
    2
    Views:
    3,894
    ricky
    Dec 28, 2005
  3. Phi!
    Replies:
    1
    Views:
    171
  4. Kor
    Replies:
    6
    Views:
    103
  5. RC
    Replies:
    0
    Views:
    449
Loading...

Share This Page