Grow your CSS skills. Land your dream job.

Table Background

  • # May 16, 2009 at 5:16 pm

    Hi.
    I was working on a skin for my site and I ran into a table problem.
    All tables take the background appearance of the body background.
    Ex.
    [img]http://img32.imageshack.us/img32/2018/capturen.th.png[/img]
    The table is in a DIV called "news_text" which background is #e9e9e9; (from #container)

    I don’t understand why its doing this. Help!

    Note: Here is some of the CSS for that content area

    Code:
    body,td,th {
    font-family:Arial, Verdana;
    background-image:url(‘images/theme/bg.png’);
    color: #191919;
    }
    body {
    background-color: #F8F8F8;
    }
    #container {
    margin-left: auto;
    margin-right: auto;
    width: 750px;
    min-height:900px;
    min-width:750px;
    text-align: center;
    border: thin solid #999999;
    background-color: #e9e9e9;
    }
    /* Main */
    #main{
    margin-top: 8px;
    text-align: left;
    z-index:2;
    }
    #news_bar{
    width: 450px;
    background-image:url(‘images/theme/bar.png’);
    font-size: 14px;
    background-color: #9b9b9b;
    padding: 1px;
    }
    #news_text{
    width: 450px;
    padding: 2px;
    margin-left: 1px;
    padding-bottom: 3px;
    font-size: 13px;
    }
    # May 16, 2009 at 9:00 pm

    Hi,

    That’s pretty simple:

    Code:
    body,td,th {
    font-family:Arial, Verdana;
    background-image:url(‘images/theme/bg.png’);
    color: #191919;
    }

    In your Selector "body,td,th" commas separate out different HTML elements you will applying the CSS too. So you are applying that background image to all <body> tags, all <td> tags and all <th>s.

    A <td> is the table cell. So every table cell has that same background image….

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".