I already checked lots of tutorials but I cant figure out how to center ul list on my website.
<!DOCTYPE HTML>
<html lang="eng">
<head>
<meta charset="utf-8">
<title>test website</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<!-- html5.js for IE less than 9 -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- css3-mediaqueries.js for IE less than 9 -->
<!--[if lt IE 9]>
<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<![endif]-->
<link href="styles/styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="pagewrap">
<header id="header">
<nav>
<ul id="main-nav">
<li><a href="#">test1</a></li>
<li><a href="#">test2</a></li>
<li><a href="#">test3</a></li>
<li><a href="#">test4</a></li>
<li><a href="#">test5</a></li>
</ul>
</nav>
</header>
</div>
</body>
</html>
/* CSS Document */
/*RESET*****************************/
html,body,div,h1,h2,p,img,nav{
margin:0;
padding:0;
}
body{
background-color:#D1D1D1;
}
#pagewrap{
background-color:#FFF;
width:980px;
margin:60px auto auto;
padding: 10px;
-webkit-box-shadow:0 0 3px 2px rgba(0, 0, 0, 0.15);
-moz-box-shadow:0 0 3px 2px rgba(0, 0, 0, 0.15);
box-shadow:0 0 3px 2px rgba(0, 0, 0, 0.15);
}
#header{
position:relative;
width:80%;
height:180px;
}
/*.nav{
position:absolute;
text-align:center;
top:100px;
}*/
#main-nav{
position: absolute;
text-align:center;
margin:0;
padding:0;
list-style-type:none;
border: 2px solid red;
}
#main-nav li {
margin: 0;
padding: 0;
display:block;
float: left;
}
#main-nav a{
text-decoration: none;
text-align:center;
padding:0 1em;
}
this is the code http://jsfiddle.net/YS58q/13/
I tried to center it with .nav to but no success. I would appreciate if somebody can suggest maybe better solution the problem. I used relative/absolute positioning. is it possible to do it just with relative positioning. I am planning to do responsive design with media query thanks a lot :)