Hi I am trying to center a ul within a div but am not managing.
You can view the page here, I am talking about the top part of the footer, the links which are currently aligned to the left, I want them in the center, any help please?
Hi I am trying to center a ul within a div but am not managing.
You can view the page here, I am talking about the top part of the footer, the links which are currently aligned to the left, I want them in the center, any help please?
i would like to center it without a fixed width, as those items might change.
also in the top menu i am trying to change the background image on rollover, which works however i want the link text to align itself to the bottom of the div, not at the middle as it is currently, how do i do that? thanks
thanks, any suggestions for the top menu rollover as well?
One option is to give the ul a width and then set the left and right margins to auto
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
#linksContainer {
width: 800px;
border: 1px solid red}
#linksList {
border: 1px solid blue;
width: 360px;
list-style-type: none;
margin: 20px auto 20px auto;
padding: 10px 10px 10px 10px}
#linksList li {
display: inline;
margin: 0px 20px 0px 20px;
padding: 0px 0px 0px 0px}
</style>
</head>
<body>
<div id="linksContainer">
<ul id="linksList">
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
<li>Link 4</li>
</ul>
</div>
</body>
</html>
without a fixed width
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
#linksContainer {
width: 500px;
overflow: hidden;
border: 1px solid red}
#linksList {
list-style-type: none;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
float: left;
position: relative;
left: 50%}
#linksList li {
float: left;
margin: 0px 20px 0px 20px;
position: relative;
right: 50%}
</style>
</head>
<body>
<div id="linksContainer">
<ul id="linksList">
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
<li>Link 4</li>
</ul>
</div>
</body>
</html>