HTML, CSS and anything else that deals with client side capabilities.
Moderator: General Moderators
ebgames56
Forum Contributor
Posts: 103 Joined: Thu Oct 06, 2011 10:43 am
Post
by ebgames56 » Tue Nov 01, 2011 10:11 am
I have a navigation bar but i cant get it centered on my page any help
Code: Select all
<center>
<link href="nav.css" rel="stylesheet" type="text/css">
<p> </p>
<p> </p>
<p> </p>
<div class="animatedtabs" align="center">
<div align="right">
<ul>
<li><a href="http://www.dynamicdrive.com"><span>Scott Szeryk</span></a></li>
<li><a href="http://www.dynamicdrive.com/style/"Examples"><span>Bass</span></a></li>
<li><a href="http://www.dynamicdrive.com/new.htm"><span>Drums</span></a></li>
<li>
<div align="center"><a href="http://tools.dynamicdrive.com"><span>Rhythm Guitar</span></a></div>
</li>
</ul>
</div>
</div>
</center>
CSS
<style type="text/css">
.animatedtabs{
border-bottom: 1px solid gray;
overflow: hidden;
width: 800px;
margin: 0s;
font-size: 14px; /*font of menu text*/
text-align: center;
}
.animatedtabs ul{
list-style-type: none;
margin: 0;
margin-left: 10px; /*offset of first tab relative to page left edge*/
padding: 0;
}
.animatedtabs li{
float: center;
margin: 0;
padding: 0;
display:inline;
}
.animatedtabs a{
float: left;
position: relative;
top: 5px; /* 1) Number of pixels to protrude up for selected tab. Should equal (3) MINUS (2) below */
background: url(tab-blue-left.gif) no-repeat left top;
margin: 0;
margin-right: 3px; /*Spacing between each tab*/
padding: 0 0 0 9px;
text-decoration: none;
display:inline-block;
}
.animatedtabs a span{
float: left;
position: right;
display: block;
background: url(tab-blue-right.gif) no-repeat right top;
padding: 5px 14px 3px 5px; /* 2) Padding within each tab. The 3rd value, or 3px, should equal (1) MINUS (3) */
font-weight: bold;
color: black;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
.animatedtabs a span {float:none;}
/* End IE5-Mac hack */
.animatedtabs .selected a{
background-position: 0 -125px;
top: 0;
}
.animatedtabs .selected a span{
background-position: 100% -125px;
color: black;
padding-bottom: 8px; /* 3) Bottom padding of selected tab. Should equal (1) PLUS (2) above */
top: 0;
}
.animatedtabs a:hover{
background-position: 0% -125px;
top: 0;
}
.animatedtabs a:hover span{
background-position: 100% -125px;
padding-bottom: 8px; /* 3) Bottom padding of selected tab. Should equal (1) PLUS (2) above */
top: 0;
}
</style>
Last edited by
Benjamin on Tue Nov 01, 2011 12:15 pm, edited 1 time in total.
Reason: Added [syntax=php|sql|css|javascript] and/or [text] tags.
twinedev
Forum Regular
Posts: 984 Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio
Post
by twinedev » Tue Nov 01, 2011 12:11 pm
You will probably get faster help if you ask this in the correct section(
viewforum.php?f=68 ) of the forum instead of posting it in the section for PHP coding.
Update... Someone moved this thread...
Last edited by
twinedev on Tue Nov 01, 2011 4:35 pm, edited 1 time in total.
flying_circus
Forum Regular
Posts: 732 Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR
Post
by flying_circus » Tue Nov 01, 2011 1:33 pm
Try something like this
Code: Select all
<div class="wrapper">
<link href="nav.css" rel="stylesheet" type="text/css">
<p> </p>
<p> </p>
<p> </p>
<div class="animatedtabs" align="center">
<div align="right">
<ul>
<li><a href="http://www.dynamicdrive.com"><span>Scott Szeryk</span></a></li>
<li><a href="http://www.dynamicdrive.com/style/"Examples"><span>Bass</span></a></li>
<li><a href="http://www.dynamicdrive.com/new.htm"><span>Drums</span></a></li>
<li>
<div align="center"><a href="http://tools.dynamicdrive.com"><span>Rhythm Guitar</span></a></div>
</li>
</ul>
</div>
</div>
</div>
CSS
<style type="text/css">
.wrapper { margin: 0 auto; width: 800px; }
.animatedtabs{
border-bottom: 1px solid gray;
overflow: hidden;
width: 800px;
margin: 0s;
font-size: 14px; /*font of menu text*/
text-align: center;
}
.animatedtabs ul{
list-style-type: none;
margin: 0;
margin-left: 10px; /*offset of first tab relative to page left edge*/
padding: 0;
}
.animatedtabs li{
float: center;
margin: 0;
padding: 0;
display:inline;
}
.animatedtabs a{
float: left;
position: relative;
top: 5px; /* 1) Number of pixels to protrude up for selected tab. Should equal (3) MINUS (2) below */
background: url(tab-blue-left.gif) no-repeat left top;
margin: 0;
margin-right: 3px; /*Spacing between each tab*/
padding: 0 0 0 9px;
text-decoration: none;
display:inline-block;
}
.animatedtabs a span{
float: left;
position: right;
display: block;
background: url(tab-blue-right.gif) no-repeat right top;
padding: 5px 14px 3px 5px; /* 2) Padding within each tab. The 3rd value, or 3px, should equal (1) MINUS (3) */
font-weight: bold;
color: black;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
.animatedtabs a span {float:none;}
/* End IE5-Mac hack */
.animatedtabs .selected a{
background-position: 0 -125px;
top: 0;
}
.animatedtabs .selected a span{
background-position: 100% -125px;
color: black;
padding-bottom: 8px; /* 3) Bottom padding of selected tab. Should equal (1) PLUS (2) above */
top: 0;
}
.animatedtabs a:hover{
background-position: 0% -125px;
top: 0;
}
.animatedtabs a:hover span{
background-position: 100% -125px;
padding-bottom: 8px; /* 3) Bottom padding of selected tab. Should equal (1) PLUS (2) above */
top: 0;
}
</style>[/quote]