Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
How do I fix this code
Old 08-27-2007, 03:16 AM How do I fix this code
Experienced Talker

Posts: 40
Name: james
Trades: 0
How do I get this code to work?

I want my links to look like the first three links in this.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style>
div.topNavBar{
padding-bottom:4px;
background:#25587E;
border-bottom:medium solid #4070AE;
}
ul.topNavBarul{
padding:0;
margin:0;
margin-left: 40px;
list-style-type:none;
}
li.topNavBarli{
margin:0;
padding: 0;
text-transform:uppercase;
display:inline
}
a.topNavBara{
float:left;
margin-top:2px;
margin-bottom:2px;
margin-right:2px;
text-decoration:none;
display: block;
color:white;
text-decoration: none;
font-weight:bold;
font-size:105%;
background-color:#41627E;
padding:0;
}
a:hover.topNavBara{
background-color:#736F6E
}
</style>
</head>
<body>
<div class="topNavBar">
<ul class="topNavBarul">
<li class="topNavBarli"><a class="topNavBara" href="#">Link one</a></li>
<li class="topNavBarli"><a class="topNavBara" href="#">Link two</a></li>
<li class="topNavBarli"><a class="topNavBara" href="#">Link three</a></li>
<li class="topNavBarli"><a href="#">Link four</a></li>
</ul>
</div>
</body>
</html>
But as soon as a add the class to the fourth link this happens.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style>
div.topNavBar{
padding-bottom:4px;
background:#25587E;
border-bottom:medium solid #4070AE;
}
ul.topNavBarul{
padding:0;
margin:0;
margin-left: 40px;
list-style-type:none;
}
li.topNavBarli{
margin:0;
padding: 0;
text-transform:uppercase;
display:inline
}
a.topNavBara{
float:left;
margin-top:2px;
margin-bottom:2px;
margin-right:2px;
text-decoration:none;
display: block;
color:white;
text-decoration: none;
font-weight:bold;
font-size:105%;
background-color:#41627E;
padding:0;
}
a:hover.topNavBara{
background-color:#736F6E
}
</style>
</head>
<body>
<div class="topNavBar">
<ul class="topNavBarul">
<li class="topNavBarli"><a class="topNavBara" href="#">Link one</a></li>
<li class="topNavBarli"><a class="topNavBara" href="#">Link two</a></li>
<li class="topNavBarli"><a class="topNavBara" href="#">Link three</a></li>
<li class="topNavBarli"><a class="topNavBara" href="#">Link four</a></li>
</ul>
</div>
</body>
</html>
jamest is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-27-2007, 10:21 AM Re: How do I fix this code
mackaltman's Avatar
Super Talker

Posts: 135
Name: Mack Altman III
Location: Goose Creek, SC, USA
Trades: 0
Wow, to tell you the truth this coding is completely backwards. I'll get back to you in about 10 minutes, let me work with it.
__________________
Mack Altman III

Please login or register to view this content. Registration is FREE

My Biggest Pet Peeve: "Web Designers" who have no artistic skill.

mackaltman is offline
Reply With Quote
View Public Profile Visit mackaltman's homepage!
 
Old 08-27-2007, 10:40 AM Re: How do I fix this code
mackaltman's Avatar
Super Talker

Posts: 135
Name: Mack Altman III
Location: Goose Creek, SC, USA
Trades: 0
Alright, here's what I came up with. I also added a 2px padding around the links which you can remove after seeing how it looks by going to ".topnavbar a" and changing "padding:" 2px; to "padding: 0;". I hope this helped.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style>
.topnavbar{
padding-bottom:4px;
background:#25587e;
border-bottom: 5px solid #4070ae;
}
.topnavbar ul{
padding-left: 0;
margin-left: 40px;
list-style-type: none;
}
.topnavbar li{
margin:0;
padding: 0;
text-transform: uppercase;
display:inline;
}
.topnavbar a{
float: left;
margin: 2px 2px 2px 0;
padding: 2px;
text-decoration:none;
display: block;
color: #fff;
text-decoration: none;
font-weight:bold;
font-size: 105%;
background-color: #41627E;
}
.topnavbar a:hover{
background-color:#736F6E
}
</style>
</head>

<body>
<div class="topnavbar">
    <ul>
        <li><a href="#">Link one</a></li>
        <li><a href="#">Link two</a></li>
        <li><a href="#">Link three</a></li>
        <li><a href="#">Link four</a></li>
    </ul>
</div>
</body>
</html>
__________________
Mack Altman III

Please login or register to view this content. Registration is FREE

My Biggest Pet Peeve: "Web Designers" who have no artistic skill.

mackaltman is offline
Reply With Quote
View Public Profile Visit mackaltman's homepage!
 
Old 08-27-2007, 12:00 PM Re: How do I fix this code
Experienced Talker

Posts: 40
Name: james
Trades: 0
When I test your code in internet explorer it has the same problem that the links don't show up inside of the div.

Edit:

I want my links to look like the first three links in this picture:


But when I add the class to my last link this happens


Here is the code I used to get these(to get the first one I took the class off of the last link)
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style>
div.topNavBar{
padding-bottom:4px;
background:#25587E;
border-bottom:medium solid #4070AE;
}
ul.topNavBarul{
padding:0;
margin:0;
margin-left: 40px;
list-style-type:none;
}
li.topNavBarli{
margin:0;
padding: 0;
text-transform:uppercase;
display:inline
}
a.topNavBara{
float:left;
margin:2px 2px 2px 0;
padding:2px;
display: block;
color:white;
text-decoration: none;
font-weight:bold;
font-size:105%;
background-color:#41627E;
padding:0;
}
a:hover.topNavBara{
background-color:#736F6E
}
</style>
</head>
<body>
<div class="topNavBar">
<ul class="topNavBarul">
<li class="topNavBarli"><a class="topNavBara" href="#">Link one</a></li>
<li class="topNavBarli"><a class="topNavBara" href="#">Link two</a></li>
<li class="topNavBarli"><a class="topNavBara" href="#">Link three</a></li>
<li class="topNavBarli"><a class="topNavBara" href="#">Link four</a></li>
</ul>
</div>
</body>
</html>

Last edited by jamest; 08-27-2007 at 12:11 PM..
jamest is offline
Reply With Quote
View Public Profile
 
Old 08-27-2007, 03:59 PM Re: How do I fix this code
Experienced Talker

Posts: 40
Name: james
Trades: 0
I got it to work by adding a width to the ul css but thanks for the help everyone.
jamest is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How do I fix this code
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34686 seconds with 12 queries