Results 1 to 6 of 6

Thread: background color in css with xhtml

  1. #1
    Join Date
    Dec 2005
    Posts
    133
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Default background color in css with xhtml

    I am trying to give a background color to my page.
    I have to work with XHTML and firefox

    I have tried in the body class(in the css file), i tried to add it in the body tag in the document. Nothing works.

    My page needs to have a height 100% and this also doesnt work

    my doctype is
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    I cannot change this

    any sugegstions?

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Please show us your CSS and the rest of your markup (HTML) that is involved.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there emanuelle,
    my doctype is...

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


    I cannot change this
    Well, you will have to change it, as you seem to have a foot in each camp.

    The transitional dtd is...
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    ...and the strict dtd is...
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    coothead

  4. #4
    Join Date
    Dec 2005
    Posts
    133
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Default

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title></title>
    <style>
    BODY{
    margin-right : 0px;
    margin-left : 0px;
    margin-top : 0px;
    margin-bottom : 0px;
    background-color:#F6F9F0;

    }
    </style>
    </head>

    <body>
    <table width="100%" cellspacing="0" cellpadding="0" height="100%">
    <tr><td>i want the table to have 100% height andthe bg color to be #F6F9F0</td></tr>
    </table>


    </body>
    </html>

  5. #5
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there emanuelle,

    try it like this...
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <style type="text/css">
    html,body {
        height:100%;
        margin:0;
        padding:0;
        background-color:#f6f9f0;
    }
    table {
        width:100%;
        height:100%;
     }
    </style>
    
    </head>
    <body>
    
    <table><tr>
    <td>I want the table to have 100% height and the bg color to be #F6F9F0</td>
    </tr></table>
    
    </body>
    </html>
    
    I also recommend that you read a few of these links...
    coothead

  6. The Following 2 Users Say Thank You to coothead For This Useful Post:

    emanuelle (07-02-2008),HeadWench (07-03-2008)

  7. #6
    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

    In xml/XHTML just about everything needs to be in lowercase unless it is specifically required to be uppercase, so try:

    Code:
    <style type="text/css">
    body {
    margin : 0;
    background-color : #f6f9f0;
    }
    </style>
    - John
    ________________________

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

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
  •