HTML and CSS Background

I am new to CSS and I wanted to know how this can be achieved:

I am writing a page on which the form will be displayed in the middle (represented by a black box). I want it to have a white background that will overlap the background of the body (represented in red).

Check out this site for an example image. (Sorry, I could not post it on line)

http://www.freeimagehosting.net/uploads/bf2d71f238.png

Many thanks!

+5
source share
2 answers

You can give your elements several styles, the background can be color, images, etc.

CSS

body { /* Red Lines Here */
  background: #990000;
}
#outer { /* White box Here */
  background: #ffffff; /* White */
  width: 900px; /* Total width will be 1000px once you include padding */
  padding: 50px; /* White border around black box, this is padding on all sides */
  margin: 0 auto; /* Centering it */
}
#inner { /*Black Box Here */
  background: #000000; /* Black */     
  color: #ffffff; /* White Text so you can see it */ 
}

Html:

<html>
  <head>
    <title>My Page! Step off!</title>
  </head>
  <body>
    <div id="outer">
      <div id="inner">
        Content!
      </div>
    </div>
  </body>
</html>
+3
source

, " CSS". , , , , .

0

All Articles