View Full Version : alignment to top of browser

09-17-2011, 06:54 PM
I'd like to align my div all the way to the top of the browser. It always has a small space. I found how to fix this once, but..... I lost it. LOL I thought it was to add a negative margin or padding, something like that.

09-17-2011, 08:18 PM
Check this
position: absolute; top: 0px; are the main ingredients.

color: #f0c;
font-size: 9px;
font-family: Verdana, Geneva, Arial, sans-serif;
background-color: #c00;
text-align: center;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 18px

09-17-2011, 09:00 PM
Can you post your code? You can also in the mean time try a global reset

* {margin: 0; padding:0; border: 0;}

at the top of your stylesheet.

09-17-2011, 09:29 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv= "Content-Type" content= "text/html; charset= utf-8">
<title>Producciones Markiz</title>
<link type= "text/css" rel= "stylesheet" href= "markiz_styles.css">
<div id= "content">
<img src="images/markiz.png">
<div id="navbar">
<pre><a href="aboutus.html" title="ABOUT US">ABOUT US</a> <a href="sonidos.html" title="SONIDOS">SONIDOS</a> <a href="event.html" title="EVENT CALLENDAR">EVENT CALLENDAR</a> <a href="contact.html" title="CONTACT US">CONTACT US</a></pre>

body {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;

#content {
background-image: url(images/content_bg.png);
height: 1000px;
margin:0px auto 0px auto;

a:link {text-decoration: none; color:black}
A:visited {text-decoration: none; color:black}
A:active {text-decoration: none; color:black}
A:hover {text-decoration: underline overline; color: #7fd1e5;}

The content_bg.png is what I want flush with the top of the browser. It's 950px wide. I want to auto center right/left margins.

Thanks for the quick replies!!