Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    External CSS Problems Nothing Ever Works

    I have always had issues with using an external stylesheet and made a test webpage trying to get it to work and of course it doesn't. Please take a look at the code below it is very short and please tell me what is wrong with it. Thanks.

    The files structure is as follows.

    css
    fonts
    images/backgrounds
    testHome.html

    Here is the css stylesheet code.

    Code:
    body {background-image:url('images/backgrounds/blackDiamond.jpg');font-family:orbitron;size:medium;font-color:0xFFD800;text-align:left;}
    h1 {font-size:large;font-family:orbitron;font-color:0x0000FF;text-align:center;}
    p {font-size:medium;font-family:orbitron;font-color:0xFF0000;text-align:left;}
    Here is the testHome.html code.

    Code:
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="utf-8">
        <meta name="description" content="">
        <meta name="keywords" content="">
    	<link rel="stylesheet" type="text/css" href="testStyle.css" />
        <title>testHome</title>
        
        <!--[if IE]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
      </head>
      <body>
    <h1>The Heading</h1>
    <p>The above heading should be using Orbitron font family, large size font, blue in color, and centered. This is a paragraph which should be in medium sized Orbitron font family, red font color, and aligned to the left.There should also be a background image on this test page.</p>
      </body>
    </html>

  • #2
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Location
    Denmark
    Posts
    908
    Thanks
    0
    Thanked 119 Times in 118 Posts
    You can't use a fonts that are non-standard, without loading them first:
    CSS:
    Code:
    @font-face { font-family: orbitron; src: url('URL to the font-file'); }
    and you are using some wrong properties and values too.
    The property for text color is color:, - nor font-color:
    And though 0x indicated Hex, toy need to use # instead:
    Code:
    color: #FF0000;
    and you have a typo in body {}
    size: should be font-size:

  • #3
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank You!


  •  

    Posting Permissions

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