...

View Full Version : LeftNaviation won't left align



GBizzle99
05-04-2009, 12:48 PM
Hi there, Can't seem to get my Links on the left navigation to left align, or get them closer to the side of the page, I've tried padding but it doesnt let me go left only right.

Heres the code.

<div id="LeftNavigation">
<ul>
<li><a href="UnitCalculator.html" class="active" >Unit Calculator</a></li>
<li><a href="Comic.html" class="active" >Comic</a></li>
<li><a href="MotionGraphics.html" class="active" >Motion Graphics</a></li>
<li><a href="Game.html" class="active" >Driving Game</a></li>
</ul>
</div><!-- end of LeftNavigation-->


---------------------------------------------------------------------------
#LeftNavigation a {
line-height: 14px;
font-weight:bold;
margin: 0px 0px 20px 0px;
padding: 0px 40px 0px 0px;
text-decoration: none;
color: #ffffff;
border-bottom: 1px solid orange;

}

#LeftNavigation a.active{

padding-bottom: 2px;
color: grey;
}

#LeftNavigation a:hover {

border-bottom: 2px solid orange;
padding-bottom: 2px;
color:orange;
}
-----------------------------------------------------------------------------

Any help would be much apreciated, thanks.

Excavator
05-04-2009, 02:45 PM
Hello GBizzle99,
Add this bit highlighted in red to zero out default margin/padding -

* {
margin: 0;
padding: 0;
}
#LeftNavigation a {
line-height: 14px;
font-weight:bold;
margin: 0px 0px 20px 0px;
padding: 0px 40px 0px 0px;
text-decoration: none;
color: #ffffff;
border-bottom: 1px solid orange;
}
#LeftNavigation a.active {
padding-bottom: 2px;
color: grey;
}
#LeftNavigation a:hover {
border-bottom: 2px solid orange;
padding-bottom: 2px;
}

GBizzle99
05-04-2009, 03:19 PM
Add this bit highlighted in red to zero out default margin/padding, sorry Excavator I didnt understand what you were saying in that last post?

Excavator
05-04-2009, 03:27 PM
In the code I quoted, I highlighted in red the bit that you should add to your CSS.

GBizzle99
05-04-2009, 04:15 PM
I have added that in, but doesnt work?

abduraooft
05-04-2009, 04:23 PM
Post your complete code (html+CSS), including DOCTYPE. Or a link to your page would be much better.

PS: Please use
][/COLOR] tags to wrap your code while posting here.

GBizzle99
05-04-2009, 04:44 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Anti-Drink Driving</title>
<LINK REL=StyleSheet HREF="limitsStyle2.css" TYPE="text/css" MEDIA=screen>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="HAPedit 3.1">

</head>
<body>

<div id="container">



<style type="text/css">
html,body{
margin:0;
padding:0;
background-color:#000;
}

body{
color:#FFF;
font: 76% arial,sans-serif;
text-align:center;
background: #565656 url(Background2.jpg) center fixed;
background-repeat: no-repeat;
}
p{
margin:0 10px 10px
}
a{
display:block;
color: #981793;
padding:10px
}

div#header h1{
height:80px;
line-height:80px;
margin:0;
padding-left:10px;
background: #EEE;
color: #79B30B
}

div#header {

background-repeat:no-repeat;
width:900px;
height:auto;
}

div#container{
width:900px;
margin:0 auto;
text-align:left

}

div#content p{
line-height:1.4
}

div#footer p{
margin:0;
padding:5px 10px
}



div#left{
background: #666666;
float:left;
width:150px;
height:600px;
filter:alpha(opacity=60);
opacity:0.6;

}

div#right{
background:#FF8539;
float:right;
width:750px

}

div#footer{
background: #333;
color: #FFF;
clear:both;
width:100%
}

#NavigationLinks {
margin: 0;
padding: 0;


}

#NavigationLinks li {
display: inline;
list-style: none;
}

#NavigationLinks a {
float: left;
line-height: 14px;
font-weight:bold;
margin: 0 50px 4px 10px;
text-decoration: none;
color: #ffffff;
border-bottom: 1px solid orange;

}

#NavigationLinks a.active{

padding-bottom: 2px;
color: grey;
}

#NavigationLinks a:hover {

border-bottom: 2px solid orange;
padding-bottom: 2px;
color:orange;
}

#NavigationBar {
background: url(NavBar.jpg);
background-repeat:no-repeat;
width: 900;
height:35px;
}

#LeftNavigation {
list-style: none;
margin: 0;
padding: 0;
}

#LeftNavigation li {

list-style: none;
}



#LeftNavigation a {
line-height: 14px;
font-weight:bold;
margin: 0px 0px 20px 0px;
padding: 0px 40px 0px 0px;
text-decoration: none;
color: #ffffff;
border-bottom: 1px solid orange;

}

#LeftNavigation a.active{

padding-bottom: 2px;
color: grey;
}

#LeftNavigation a:hover {

border-bottom: 2px solid orange;
padding-bottom: 2px;
color:orange;
}

#FooterLinks {
margin: 0;
padding: 0 0 20px 150px;


}

#FooterLinks li {
margin: 0;
padding: 0;
display: inline;
list-style: none;
}

#FooterLinks a {
float: left;
line-height: 14px;
font-weight:bold;
margin: 0 50px 4px 10px;
text-decoration: none;
color: white;
border-bottom: 2px dotted white;
}

#FooterLinks a.active{

padding-bottom: 2px;
color: white;
}

#FooterLinks a:hover {

border-bottom: 2px solid white;
padding-bottom: 2px;
color:white;
}

#FooterBar {
background-color:#333333;
height:34px;
}


</style>


<div id="header">
<img id="Logo" border="0" src="logo.gif" width="345" height="75" />
<!--<img id="NavBar" border="0" src="NavBar.jpg" width="100%" height="35px" />-->
<div id="NavigationBar">
<ul id="NavigationLinks">
<li><a href="test1.HTML" class="active" >HOME</a></li>
<li><a href="Facts.HTML" class="active" >KNOW YOUR FACTS</a></li>
<li><a href="Activities.html" class="active" >ACTIVITIES</a></li>
<li><a href="Contact.HTML" class="active" >FORUM</a></li>
<li><a href="UsefulLinks.html" class="active" >USEFUL LINKS</a></li>
</ul>
</div><!-- end of NavigationLinks-->
</div><!--end of header-->

<div id="content">
</div><!--end of content-->

<div id="left">

<div id="LeftNavigation">
<ul>
<li><a href="UnitCalculator.html" class="active" >Unit Calculator</a></li>
<li><a href="Comic.html" class="active" >Comic</a></li>
<li><a href="MotionGraphics.html" class="active" >Motion Graphics</a></li>
<li><a href="Game.html" class="active" >Driving Game</a></li>
</ul>
</div><!-- end of LeftNavigation-->

</div><!--end of left-->

<div id="right">
<p> On this page you can choose different activities and learn about drink drink driving. Just select a link from the side of the page.</p>
</br>
</div><!--end of right-->

<div id="footer">
<div id="FooterLinks">
<ul>
<li><a href="test1.HTML" class="active" >HOME</a></li>
<li><a href="Activity.html" class="active" >ABOUT SLURP</a></li>
<li><a href="Contact.HTML" class="active" >FORUM</a></li>
<li><a href="UsefulLinks.html" class="active" >PYXIS MEDIA</a></li>
</ul>
</div><!-- end of FooterLinks -->
</div> <!--end of footer-->

</div> <!--end of container-->

</body>
</html>

abduraooft
05-04-2009, 04:51 PM
You haven't added
*{
margin:0;
padding:0;
} into your CSS, as suggested by Excavator. It's to nullify all browser specific default margin and padding values from all elements.

PS: put your <style> tags inside <head>

GBizzle99
05-04-2009, 05:13 PM
Thanks alot for the swift replies, one more question. How do I make an element centre align, for example if I have a flash game or video i want to put in the right column, how do I make it display in the centre of the column?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum