Results 1 to 9 of 9

Thread: css insert problem

  1. #1
    Join Date
    Jul 2005
    Location
    Kuwait-I'm American
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question css insert problem

    <html>
    <head>
    <link href="styles.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    [...]
    </body>
    </head>

    that is the code I used to insert my .css stylesheet. what is wrong with it? I enter and everything is default. The background is white, and the text is black.

    please help me someone. This is a stupid problem... I'm already embaresses.

    THX ALOT!!!
    //\\ //\\// || //\\//\\ //\\ ||_
    SOFTWARE

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Generally we write it:
    Code:
    <link rel="stylesheet" href="pages.css" type="text/css">
    but I don't think the order matters, it might. The real questions are:

    1) Is the stylesheet file in the same directory as the page?
    2) Is it a valid stylesheet?
    3) Is the name of the stylesheet file spelled correctly (capitalization counts)?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2005
    Location
    Kuwait-I'm American
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    <style type="text/css">
    <span style="cursor:default">
    body {background-color: black}
    h1 {color: 339900}
    h2 {color: 339900}
    p {color: 339900; font-family: courier; font-size: 100%}
    a:link {color: 006699}
    a:visited {color: 006699white}
    a:hover {color: 339900; background-color: 339900; font-weight: 900}
    a:active {color: 006699}
    p.dotted {border-style: dotted} //<p class="name of style">...</p>
    p.dashed {border-style: dashed}
    p.solid {border-style: solid}
    p.double {border-style: double}
    p.groove {border-style: groove}
    p.ridge {border-style: ridge}
    p.inset {border-style: inset}
    p.outset {border-style: outset}
    </span><br />
    </style>

    is it ok?
    //\\ //\\// || //\\//\\ //\\ ||_
    SOFTWARE

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    No, those < 's and >'s don't belong. For many browsers the # sign must precede a hex color value. Comments begin /* and end */. Try this:


    Code:
    body {background-color: black}
    h1 {color: #339900}
    h2 {color: #339900}
    p {color: #339900; font-family: courier; font-size: 100%}
    a:link {color: #006699}
    a:visited {color: #006699}
    /*this is a valid css comment*/
    /*you need to choose a background color that is different
    than the color for the hover pseudoclass or it will disappear
    onmouseover*/
    a:hover {color: #339900; background-color: #339900; font-weight: 900}
    a:active {color: #006699}
    /*not sure if all the rest of these will do anything or not*/
    p.dotted {border-style: dotted} 
    p.dashed {border-style: dashed}
    p.solid {border-style: solid}
    p.double {border-style: double}
    p.groove {border-style: groove}
    p.ridge {border-style: ridge}
    p.inset {border-style: inset}
    p.outset {border-style: outset}
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jul 2005
    Location
    Kuwait-I'm American
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1
    /*not sure if all the rest of these will do anything or not*/
    p.dotted {border-style: dotted}
    p.dashed {border-style: dashed}
    p.solid {border-style: solid}
    p.double {border-style: double}
    p.groove {border-style: groove}
    p.ridge {border-style: ridge}
    p.inset {border-style: inset}
    p.outset {border-style: outset}
    It doesn't, it's just so if i choose to make a certain kind of border, i don't have to add a whole lot of extra code.
    //\\ //\\// || //\\//\\ //\\ ||_
    SOFTWARE

  6. #6
    Join Date
    Jul 2005
    Location
    Kuwait-I'm American
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Code:
    <style type="text/css">
    <span style="cursor:default">
    body {background-color: black}
    h1 {color: 339900}
    h2 {color: 339900}
    p {color: 339900; font-family: courier; font-size: 100%}
    a:link     {color: 006699}
    a:visited  {color: 006699}
    a:hover    {color: 339900; background-color: 006699; font-weight: 900}  
    a:active   {color: 006699}
    p.dotted {border-style: dotted} /*<p class="name of style">...</p>*/
    p.dashed {border-style: dashed}
    p.solid {border-style: solid}
    p.double {border-style: double}
    p.groove {border-style: groove}
    p.ridge {border-style: ridge}
    p.inset {border-style: inset}
    p.outset {border-style: outset}
    </span><br />
    </style>
    better?
    //\\ //\\// || //\\//\\ //\\ ||_
    SOFTWARE

  7. #7
    Join Date
    Jul 2005
    Location
    Kuwait-I'm American
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It says the file is a: Cascading Style Sheet Document is that ok? or is there something wrong?

    I made it using notepad...

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You shouldn't have any html in there. Did you try my version? Anyways, if it works in all the browsers you want it to work in, that will tell you if it is, if not valid, at least serviceable.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You guys are missing something obvious.
    Code:
    <html>
    <head>
    <link href="styles.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    [...]
    </body>
    </head>
    And you don't have to do that p.dotted bit. You can use the "style" attribute to apply styles inline.
    HTML Code:
    <p style="border-style:dotted;">Text</p>
    And if you're using a doctype that supports self-closing tags, you should close that link tag:
    Code:
    <link href="styles.css" rel="stylesheet" type="text/css" />
    Last edited by Twey; 07-05-2005 at 01:18 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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