Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: CSS HTML HTML5/CSS
I made a simple website, and no matter what I do, there is always a weird left margin of about ten pixels, I tried setting the
margin-left:0px;
but I didn't work, please respond, any help would be welcomed and apreciated
 
-Jordan
 
HTML:
<!DOCTYPE html>
<html>
	<head>
		<meta name="author" content="Jordan 'Croug' LaPrise, Henry 'arctichenry' Schildbach, various CalcuProcessing members">
		<meta name="description" content="Minecraft network deticated to independant hosting and free minecraft for everyone!">
		<meta name="organization" content="CalcuProcessing">
		<meta charset="UTF-8">
		<title>ThisIsNotAServerMCNetwork</title>
		<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
		<link rel=StyleSheet type="text/css" href="style.css">
	</head>
	<body>
		<div id="wrap">
			<div id="bg">
					<div id="header">
					</div><!-- header -->
					<div id="navbox">
						Test Text
						<!-- <a href="index.php" class="nav">Home</a> -->
					</div><!-- navbox -->
				<div id="scroll">
				</div><!-- scroll -->
			</div><!-- bg -->
		</div><!-- wrap -->
	</body>
</html>
 
 
CSS:
#wrap{
	margin-left:0px;
	margin-right:0px;
}
#header{
	position:fixed;
	height:18px;
	width:100%;
	background-image:url("images/header.png");
	color:black;
	padding:2px;
}
#navbox{
	position:fixed;
}
a.nav{
	text-decoration:none;
}
Posted 4-Feb-13 7:43am
Sicppy1.5K
Comments
richcb at 4-Feb-13 12:47pm
   
If margin-left is set to 0, then it is 0. Is it padding that is messing you up by chance? Try setting the padding on both sides to 0 as well and see what that does for you.
Sicppy at 4-Feb-13 12:54pm
   
Thanks for your suggestion but that doesn't seem to solve my problem
Zoltán Zörgő at 4-Feb-13 13:05pm
   
Be aware, that BODY and HTML also might have margin and padding settings, you should adjust them too.
Sicppy at 4-Feb-13 13:07pm
   
That did it, if you post that comment as an answer I will accept it
Zoltán Zörgő at 4-Feb-13 13:12pm
   
Done.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Be aware, that BODY and HTML also might have margin and padding settings, you should adjust them too.
  Permalink  
Comments
ProgramFOX at 4-Feb-13 13:17pm
   
+5!
richcb at 4-Feb-13 13:41pm
   
Nice catch, +5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 605
1 Maciej Los 319
2 BillWoodruff 184
3 Richard MacCutchan 180
4 Suraj Sahoo | Coding Passion 180
0 OriginalGriff 8,654
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,229
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 4 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100