Basic question about background color around web page

by jlmkt
6 replies
  • WEB DESIGN
  • |
I have a very basic knowledge of HTML and have been trying to learn CSS. But, I think I've created a mental block for myself when it comes to background color surrounding your web page. Need your help to get a clear understanding for how to do this (I'm sure) simple task -- think I'm trying to make it harder than what it is.

OK, suppose I want a blue background covering viewing area surrounding my 900px width white (background) web page. What coding do I need to achieve this on a simple HTML page. What would I need to do if I was using CSS? Do I have to specify the color within my 900px web page as white in addition to specifying the outside of page color?.

I have read and read and keep stumbling on this point. All help is greatly appreciated.

Thanks,

Lee
#background #basic #color #page #question #web
  • Profile picture of the author patey88
    In your css, for your body, put something like

    body {background: blue; margin: 0px auto 0px;}

    ...and then for your "page", put it within a container div like

    container {background: white; margin: 10px auto 10px; position: relative; width: 900px}
    {{ DiscussionBoard.errors[2463890].message }}
  • Profile picture of the author paparaxee
    Go with the steps provided by patey and it shall be well with you..if you want to add more style to it you as well add background-image: url(image path);

    Good luck with that
    {{ DiscussionBoard.errors[2467494].message }}
    • Profile picture of the author cpace32
      Originally Posted by paparaxee View Post

      Go with the steps provided by patey and it shall be well with you..if you want to add more style to it you as well add background-image: url(image path);

      Good luck with that

      This is the best way in my opinion, and it opens up your options for things like a fade effect, etc- all within one image. Just make sure that you choose a small image (length wise), and that you repeat it.
      {{ DiscussionBoard.errors[2468881].message }}
  • Profile picture of the author Talkreal
    Originally Posted by jlmkt View Post


    OK, suppose I want a blue background covering viewing area surrounding my 900px width white (background) web page. What coding do I need to achieve this on a simple HTML page. What would I need to do if I was using CSS? Do I have to specify the color within my 900px web page as white in addition to specifying the outside of page color?.
    Patey gave you the code you need. But for extra style, you can also put a CSS border around your content area to make it stand out more. For example, to the container statement, add:

    border: 1px solid silver; (a discreet thin grey line)
    or
    border: 3px dashed #000000; (a thick, black dashed line)

    CSS3 even supports drop shadow. So many possibilities with CSS! Have fun!
    {{ DiscussionBoard.errors[2468666].message }}
  • Profile picture of the author jlmkt
    Thanks to all!

    I expect I'll have more questions along the way.
    Appreciate being able to ask and get help.

    Lee
    {{ DiscussionBoard.errors[2468932].message }}

Trending Topics