CSS Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Donners
    Confirmed User
    • Jun 2004
    • 689

    #1

    CSS Help

    This stylesheet works when I have it directly on the webpage, however if I save it as a .css and link it some tags doesn't work, like the font-family body tag.
    Any ideas why not?

    <style type="text/css">
    body,td,th {font-size: 12px; color: #000000;}
    body {margin-top: 0px; background-color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; }
    .topads {font-size: 16px; color: #FFFFFF; font-weight: bold; font-family: Arial, Helvetica, sans-serif;}
    .whitebold {color: #FFFFFF; font-weight: bold; }
    .blackbold {color: #000000; font-weight: bold; }
    .smallheading {font-size: 16px; color: #000000; font-weight: bold; font-family: Arial, Helvetica, sans-serif; }
    .normal {font-family: Verdana, Arial, Helvetica, sans-serif; }

    a:link {
    text-decoration: underline;
    color: #0000FF;
    }
    a:visited {
    text-decoration: underline;
    color: #0000FF;
    }
    a:hover {
    text-decoration: none;
    }
    a:active {
    text-decoration: underline;
    }
    </style>
  • Validus
    Confirmed User
    • Jul 2001
    • 4012

    #2
    Not sure, but try using the 'font' tag to specify the font...

    font:bold 10pt verdana; for example...

    Make sure you don't have style tags overwriting your classes

    Comment

    • Jakke PNG
      ex-TeenGodFather
      • Nov 2001
      • 20306

      #3
      You need to remove the <style type="text/css"> line and
      </style>
      Then you need to link to that stylesheet from the page you want to use it on, like so:
      <link rel="STYLESHEET" href="style/default.css" type="text/css">
      ..and I'm off.

      Comment

      • Donners
        Confirmed User
        • Jun 2004
        • 689

        #4
        Originally posted by TeenGodFather
        You need to remove the <style type="text/css"> line and
        </style>
        Then you need to link to that stylesheet from the page you want to use it on, like so:
        <link rel="STYLESHEET" href="style/default.css" type="text/css">
        Thats what I did, but somehow the tags wont work with me.

        Comment

        • fallenmuffin
          Confirmed User
          • Nov 2005
          • 8170

          #5
          Originally posted by Donners
          Thats what I did, but somehow the tags wont work with me.
          Try a different approach...

          Code:
          <style type="text/css" media="screen">
          	@import url("style.css");
          </style>
          style.css being your file name of course if its outside that directory you will need the full path.

          Also, to make your code cleaner you check out the short hand of FONT:
          http://www.w3schools.com/css/css_font.asp

          Comment

          • Donners
            Confirmed User
            • Jun 2004
            • 689

            #6
            Hmm, just checked my page in IE and now it works, looks like a firefox issue.

            Comment

            • fallenmuffin
              Confirmed User
              • Nov 2005
              • 8170

              #7
              Tested in Firefox &amp; IE

              style.css
              Code:
                body {
                  margin-top:0;
                  padding-top:0; /* Opera */
                  background-color:#000;
                }
              
                body, td, th {
                  font:normal 12px/14px Verdana, Arial, Helvetica, sans-serif;
                }
              
                a {
                  text-decoration:underline;
                  color: #0000ff;
                }
              
                a:hover {
                  text-decoration: none;
                }
              
                /* Classes */
                .topads {
                  font:normal normal bold 16px/18px Verdana, Arial, Helvetica, sans-serif;
                  color:#fff;
                }
              
                .whitebold {
                  color:#fff;
                  font-weight:bold;
                }
              
                .blackbold {
                  color:#000;
                  font-weight:bold;
                }
              
                .smallheading {
                  font:normal normal bold 16px/18px Verdana, Arial, Helvetica, sans-serif;
                  color:#000;
                }
              
                .normal {
                  font:normal 12px/14px Verdana, Arial, Helvetica, sans-serif;
                }
              page.html
              Code:
              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
              <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
              <head>
              <title></title>
              <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
              <style type="text/css" media="screen">
              	@import url("style.css");
              </style>
              </head>
              
              <body>
              
                Code here
              
              </body>
              </html>
              I cleaned up your CSS using short-hand and added zero padding so the top would look right in opera.

              Comment

              • Donners
                Confirmed User
                • Jun 2004
                • 689

                #8
                Still now getting it to work on my page

                Care to hit me up on ICQ?
                21-956-857

                Comment

                • Donners
                  Confirmed User
                  • Jun 2004
                  • 689

                  #9
                  fallenmuffin's code worked great!! The guy saved my day

                  Comment

                  • fallenmuffin
                    Confirmed User
                    • Nov 2005
                    • 8170

                    #10
                    Originally posted by Donners
                    fallenmuffin's code worked great!! The guy saved my day
                    w00t 5 6 7 8

                    Comment

                    • ssp
                      Confirmed User
                      • Jan 2005
                      • 7990

                      #11
                      Next time read a manual before blaming your problem on browsers.

                      Comment

                      Working...