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 4 of 4

Thread: css id problem

  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    css id problem

    Hi everyone,
    I'm new to web design and getting crazy with this:

    css
    ----------------------
    #content{
    color: red;
    }
    #test{
    color: blue;
    }
    ---------------------

    html
    ---------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
    <head>
    <title>the trashcan</title>
    <link rel="stylesheet" type="text/css" href="main2colonne.css"/>
    </head>
    <body>
    <div id="container">
    <div id="header"></div><p>the trashcan logo</p>
    <div id="content"></div><p>love<br/>you<br/>long<br/>time</p></div>
    <div id="navigation"><p id="test">link</p>
    <div id="footer"></div><p>copyright</p>
    </div>
    </body>
    </html>
    --------------------------------------------------------------

    the word "link" does get formatted in blue, but the words "love you long time" don't get red.
    I've checked everything I've tried everything but I can't find out where's the problem...

    Many thanks in advance,
    nivlat

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,590
    Thanks
    0
    Thanked 644 Times in 634 Posts
    <div id="content"></div>

    This div has no content - you have the </div> in the wrong place.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Code:
    <div id="content"></div><p>love<br/>you<br/>long<br/>time</p></div>
    You've opened and immediately closed the div "content" so the words "love you.." are not within this div, and therefore not coloured red.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • #4
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    thank you boys, I would have nerver find out.....


  •  

    Posting Permissions

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