stylesheet not working.

Results 1 to 9 of 9
  1. #1
    Grenafukindear Grenadier is offline
    MemberRank
    Feb 2010 Join Date
    127.0.0.1Location
    1,299Posts

    stylesheet not working.

    Hey can someone please tell me were i am going wrong?

    It has been years since i have coded a website from scratch in as notepad. I normally use dreamweaver.

    My style sheet is not linking with my index.html

    My HTML Code -

    Code:
    <!DOCTYPE html><html>
    <head>
    <link rel="stylesheet" type="text/css" href="style.css">
    
    
    <meta charset=utf-8 />
    <title>Template</title>
    </head>
    <body>
      <div id="head">
      </div>
    </body>
    </html>
    My Style Sheet :-

    Code:
    {
      body
        
        background-image: (images/bg.png);
    }
    
    
    
    
    {
      #head
        
        background-color: #77465;
        position: top;
        text: header;
      
    }
    please forgive me for being such a noob. Im trying to become more advanced in coding as its an area i struggle on...


  2. #2
    Custom Title Enabled George SS is offline
    LegendRank
    Oct 2005 Join Date
    3,281Posts

    Re: stylesheet not working.

    First of , CSS items correct format is
    PHP Code:
    item {
         
    define stuff here

    you did
    PHP Code:
    {
    item

    define stuff here

    also
    PHP Code:
    <link rel="stylesheet" type="text/css" href="style.css"
    should be closed , like so
    PHP Code:
    <link rel="stylesheet" type="text/css" href="style.css" /> 

  3. #3
    Grenafukindear Grenadier is offline
    MemberRank
    Feb 2010 Join Date
    127.0.0.1Location
    1,299Posts

    Re: stylesheet not working.

    Quote Originally Posted by mucski View Post
    First of , CSS items correct format is
    PHP Code:
    item {
         
    define stuff here

    you did
    PHP Code:
    {
    item

    define stuff here

    also
    PHP Code:
    <link rel="stylesheet" type="text/css" href="style.css"
    should be closed , like so
    PHP Code:
    <link rel="stylesheet" type="text/css" href="style.css" /> 
    Thanks for helping me man :) I know.. My coding is terrible :) Believe it or not, a 10 year old taught me style sheets when i was 14 in the habbo section. Hahahahahaha :D And also, do i keep the # tag?

  4. #4
    Custom Title Enabled George SS is offline
    LegendRank
    Oct 2005 Join Date
    3,281Posts

    Re: stylesheet not working.

    Yes you do keep the # tag , that represents and ID , and a . (dot) represents a class and an item with nothing , represents a HTML element , such as body , paragraph , or a link , etc.

  5. #5
    Grenafukindear Grenadier is offline
    MemberRank
    Feb 2010 Join Date
    127.0.0.1Location
    1,299Posts

    Re: stylesheet not working.

    Quote Originally Posted by mucski View Post
    Yes you do keep the # tag , that represents and ID , and a . (dot) represents a class and an item with nothing , represents a HTML element , such as body , paragraph , or a link , etc.
    What about when im trying to use an image as a background? Its still not working

    body {
    background-image: (.images/bg.png);
    }

    Is that right?

  6. #6
    Custom Title Enabled George SS is offline
    LegendRank
    Oct 2005 Join Date
    3,281Posts

    Re: stylesheet not working.

    PHP Code:
    body {
    background-image:url(images/bg.png);


  7. #7
    Grenafukindear Grenadier is offline
    MemberRank
    Feb 2010 Join Date
    127.0.0.1Location
    1,299Posts

    Re: stylesheet not working.

    Quote Originally Posted by mucski View Post
    PHP Code:
    body {
    background-image:url(images/bg.png);

    Thanks :)

  8. #8
    :-) s-p-n is offline
    DeveloperRank
    Jun 2007 Join Date
    Next DoorLocation
    2,098Posts

    Re: stylesheet not working.

    In HTML documents you do not use short-tags- those that end with '/>'. You had your LINK tag correct the first time. If it were xHTML you would use short-tags.

    12 The HTML syntax — HTML Standard

  9. #9
    Grenafukindear Grenadier is offline
    MemberRank
    Feb 2010 Join Date
    127.0.0.1Location
    1,299Posts

    Re: stylesheet not working.

    Quote Originally Posted by s-p-n View Post
    In HTML documents you do not use short-tags- those that end with '/>'. You had your LINK tag correct the first time. If it were xHTML you would use short-tags.

    12 The HTML syntax — HTML Standard
    I know, i have been watchoing a few good tutorials on youtube and i have to say i still have a lot to learn.

    I am doing stuff like this ATM.

    HTML

    <html>


    <head>

    <link rel="stylesheet" href="style.css">

    <div class="content">
    </div>
    </html>
    </head>


    STYLE

    .content {

    some-shithere: 100px;
    background-color: CCCCCC;
    }

    But i still need to learn a lot indeed :)



Advertisement