Page is a not externally linkable
- Code, Content, and Presentation
-- CSS
---- How to Centralize Div Box


rocknbil - 4:15 pm on Jun 25, 2012 (gmt 0)


Welcome aboard franciscrick, please read the TOS and the rules regarding site links. instead of

margin:0px;
margin-top:0px;

apply margin: auto to the left/right.

margin:0 auto; /* shorthand for 0 auto 0 auto */

I don't see why you need a div inside a div, this just contributes to div-itis. Second a div is a generic container for dividing up page layout, if you're going to use an HTML5 doctype and it's a caption use <caption> instead.

<div id="imagearea_1" class="imagearea">
<caption>This is a caption</caption> (.... etc.)

.scrollgallery .imageareaContent caption {
position:absolute;
display:inline;
padding:5px 10px; /* again, shorthand */
background:#fff;
margin:0 auto; /* shorthand for 0 auto 0 auto */
z-index:auto; /* should really put a value here but it works because of the source order */
top:0;
left:0;
line-height:13px;
}


Thread source:: http://www.webmasterworld.com/css/4469119.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com