HTML:
- <div id="container_centered"></div>
CSS:
- <style type="text/css">
- body{ background-color: cadetblue; }
- #container_centered{
- background-color: floralwhite;
- width: 500px;
- height: 300px;
- position: absolute;
- left: 50%;
- top: 50%;
- margin-left: -250px;
- margin-top: -150px;
- }
- </style>
here "margin-left" should be half of the width with (-) symbol and "margin-top" should be half of the height with (-) symbol.
Please give your valuable comments.