Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-04-2009, 12:48 PM   PM User | #1
GBizzle99
New Coder

 
Join Date: Apr 2009
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
GBizzle99 is an unknown quantity at this point
LeftNaviation won't left align

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;
colorrange;
}
-----------------------------------------------------------------------------

Any help would be much apreciated, thanks.
GBizzle99 is offline   Reply With Quote
Old 05-04-2009, 02:45 PM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello GBizzle99,
Add this bit highlighted in red to zero out default margin/padding -
Code:
* {
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;
}
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Old 05-04-2009, 03:19 PM   PM User | #3
GBizzle99
New Coder

 
Join Date: Apr 2009
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
GBizzle99 is an unknown quantity at this point
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?
GBizzle99 is offline   Reply With Quote
Old 05-04-2009, 03:27 PM   PM User | #4
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
In the code I quoted, I highlighted in red the bit that you should add to your CSS.
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Old 05-04-2009, 04:15 PM   PM User | #5
GBizzle99
New Coder

 
Join Date: Apr 2009
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
GBizzle99 is an unknown quantity at this point
I have added that in, but doesnt work?
GBizzle99 is offline   Reply With Quote
Old 05-04-2009, 04:23 PM   PM User | #6
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Post your complete code (html+CSS), including DOCTYPE. Or a link to your page would be much better.

PS: Please use [CODE][/CODE] tags to wrap your code while posting here.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 05-04-2009, 04:44 PM   PM User | #7
GBizzle99
New Coder

 
Join Date: Apr 2009
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
GBizzle99 is an unknown quantity at this point
Code:
<!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">

Code:
<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>
GBizzle99 is offline   Reply With Quote
Old 05-04-2009, 04:51 PM   PM User | #8
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
You haven't added
Code:
*{
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>
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 05-04-2009, 05:13 PM   PM User | #9
GBizzle99
New Coder

 
Join Date: Apr 2009
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
GBizzle99 is an unknown quantity at this point
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?
GBizzle99 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:20 AM.


Advertisement
Log in to turn off these ads.