How to position my tag div with top, bottom, left and right attributes?

So I have my background image and then I want only the sides to display so I put my div tag in the Center and does it extend to the edges of the top and bottom of the page, then theres a little bit of the background image on the sides of the white div. Than perfect, but when I focus I had to remove the position attribute. Now, I can not use the up, down, left and right attributes.

OLD CODE WITHOUT A CENTER:

{#whitediv}

position: absolute;

Top: 0px;

Width: 930px;

height: 100%;

z-index: 1;

background-color: #FFF;

}

NEW CODE WITH CENTER POSITION BUT CANT IT:

{#whitediv}

position:;

Top: 0px;

margin: 0px auto;

Width: 930px;

height: 100%;

z-index: 1;

background-color: #FFF;

}

To Center elements with CSS, you need 4 basic things.

  1. A document type is valid,
  2. width in pixels, % or ems, container
  3. a margin left and right of the automobile,
  4. default positioning (static or not specified).

For example, the following page has a centered division.

http://ALT-Web.com/test/resizable-BG.shtml

The background image is applied to the CSS body selector.

/ * DIV CENTERED * /.

{#page online purchase

Width: 70%;
margin: 5th auto;
Padding: 3em;
background: rgba (0,0,0, 0.70);
color: #FFF;
}

Nancy O.

Tags: Dreamweaver

Similar Questions

Maybe you are looking for