Results 1 to 6 of 6

Thread: Why isn't my background black?

  1. #1
    Join Date
    Jul 2005
    Posts
    223
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Question Why isn't my background black?

    I was trying to make a black background, with a white wrapper.

    http://japantown.awardspace.com/divdesign.shtml
    My Web Site
    Japan Town

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I think it is black, but you just can't see it because the other colors are covering it up. You can specify a height (for example 100%) to make it fill the whole screen. Or as you add content it will automatically expand.

    You can also change the body margins to remove the white edges if you'd like.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. The Following User Says Thank You to djr33 For This Useful Post:

    Johnnymushio (03-24-2011)

  4. #3
    Join Date
    Jul 2005
    Posts
    223
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default

    i thought by specifying in the body for a black background color, it would make everything that is white on my page now, black.

    how would i do that then?
    My Web Site
    Japan Town

  5. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    that's actually kinda odd.

    I think Daniel's right about the <body> "shrinking" -or more accurately, "not expanding"- around the content (0 margin or 100% height/width won't make it cover the page because the root (html) element doesn't have a set width).

    In all cases, html{ background: black; } should solve things. In Firefox, simply setting the html{} selector (with no rules) will trigger the black background.

    As I said, odd. I think this has something to do with how the Initial Containing Block and/or the Canvas inherit properties (they inherit certain properties "backwards," more or less). It's an interesting subject, but I haven't got my head quite around it yet.

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

    djr33 (03-24-2011),Johnnymushio (03-24-2011)

  7. #5
    Join Date
    Jul 2005
    Posts
    223
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default

    ok that worked, but is there any reason why the corners are not rounded off?

    EDIT

    hm, nevermind. when i set the html background to black, it worked. but i also had to set the body background to black or else everything turned white.

    the corners were rounded, but i had to get rid of the background colors for each of the three divs.
    My Web Site
    Japan Town

  8. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Thanks for adding that, traq. Using the html element's CSS is definitely the right answer, since body can't be easily set to 100% in case it might be more than 100% if it's a tall page.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •