PDA

View Full Version : Link, Hover & Visited conflict


kaydee
03-13-2011, 05:05 PM
Hi there,
I am working on my first website. I am teaching myself with the help of all the great videos out there. That being said, I have hit a wall and cannot seem to find the answer anywhere else. I wanted to try to have my links change color with hover and then change again after being visited. The color they appear when live is the "visited" color. I know there is a conflict somewhere but am not well versed enough to find it. I am hoping a kind person will have pity and take a look! Thanks in advance!


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>www.yachtfinatics.com</title>
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #666666;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: left; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
background-color: #FFFFFF;
background-image: url(images/157.gif);
}
.twoColFixLtHdr #container {
width: 780px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
background: #FFFFFF;
margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
}
.twoColFixLtHdr #header {
background: #FFFFFF;
padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
background-color: #FFFFFF;
}
.twoColFixLtHdr #header h1 {
margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.twoColFixLtHdr #sidebar1 {
float: left; /* since this element is floated, a width must be given */
width: 200px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */
background: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */
padding: 15px 10px 15px 20px;
background-image: url(images/water.gif);
}
.twoColFixLtHdr #mainContent {
margin: 0 0 0 250px; /* the left margin on this div element creates the column down the left side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
}
.twoColFixLtHdr #footer {
padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
background:#DDDDDD;
}
.twoColFixLtHdr #footer p {
margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
body,td,th {
color: #003399;
}
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #FFFFFF;
font-size: 135%;
}
.style3 {font-size: 135%}
a:link {
color: #0000CC;
text-decoration: none;
}
a:hover {
color: #66CCFF;
text-decoration: none;
}
a {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: large;
}
a:visited {
text-decoration: none;
color: #0000CC;
}
a:active {
text-decoration: none;
}
a:link {
color: #0000CC;
}
a:visited {
}
a:hover {
color: #66CCFF;
}
-->
</style>
<!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]--></head>

<body class="twoColFixLtHdr">

<div id="container">
<div id="header">
<h1><img src="images/logoyachtbanner.gif" width="762" height="205"></h1>
<!-- end #header --></div>
<div id="sidebar1">
<h2 class="style1"><strong><a href="index.html" target="_blank">HOME</a></strong></h2>
<h2 class="style1"><strong><a href="About Us.html"> About Us</a></strong></h2>
<h2 class="style1"><strong><a href="Schedule.html">Schedule of Services</a> </strong></h2>
<h2 class="style1"><strong><a href="Workrequest.html">Work Request </a></strong></h2>
<h2 class="style1"><strong><a href="Customersurvey.html">Customer Satisfaction Survey</a></strong></h2>
<h2 class="style1"> <a href="captainpledge.html">Captain's Pledge</a></h2>
<h2 class="style1"><strong><a href="photogallery.html">Photo Gallery</a></strong></h2>
<h2 class="style1"><strong> <a href="customercomments.html">Customer Comments</a></strong></h2>
<h2 class="style1"><strong><a href="contactus.html">Contact Us </a></strong></h2>
<h2 class="style1"><strong><a href="links.html">Links</a></strong></h2>
<p class="style3">&nbsp;</p>
<p class="style3">&nbsp;</p>
<p class="style3">&nbsp;</p>
<p class="style3">&nbsp;</p>
<p class="style3">&nbsp;</p>
<p class="style3">&nbsp;</p>
<p class="style3">&nbsp;</p>
<p class="style3">&nbsp;</p>
<p class="style3">&nbsp;</p>
<p class="style3">&nbsp;</p>
<p class="style3">&nbsp;</p>
<p>
<!-- end #sidebar1 -->
</p>
</div>
<div id="mainContent">
<h1>Captain's Pledge</h1>
<p align="left">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio. Donec et ipsum et sapien vehicula nonummy. Suspendisse potenti. Fusce varius urna id quam. </p>
<p>&nbsp;</p>
<!-- end #mainContent --></div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
<div id="footer">
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#CCCCCC">
<tr>
<td valign="top"><div align="center">Copyright &copy; Yachtfinatics by Greg Nucci &amp; Steve Love</div></td>
</tr>
</table>
<!-- end #footer -->
</div>
<!-- end #container --></div>
</body>
</html>

DWcourse
03-13-2011, 06:06 PM
You have multiple a:link, a:visited, and a:hover style rules and your a:link and a:visited links use the same color.

You need to get control of your CSS and clean it up.

Corrosive
03-14-2011, 08:36 AM
Your link styles are also in the wrong order. It should be link, visited, hover, active. Here, try this; http://corrosiveonline.co.uk/tutorials_different_links_css.php As you are at the learning stage at the moment I'll point out that you need to use an unordered list here;

<h2 class="style1"><strong><a href="index.html" target="_blank">HOME</a></strong></h2>
<h2 class="style1"><strong><a href="About Us.html"> About Us</a></strong></h2>
<h2 class="style1"><strong><a href="Schedule.html">Schedule of Services</a> </strong></h2>
<h2 class="style1"><strong><a href="Workrequest.html">Work Request </a></strong></h2>
<h2 class="style1"><strong><a href="Customersurvey.html">Customer Satisfaction Survey</a></strong></h2>
<h2 class="style1"> <a href="captainpledge.html">Captain's Pledge</a></h2>
<h2 class="style1"><strong><a href="photogallery.html">Photo Gallery</a></strong></h2>
<h2 class="style1"><strong> <a href="customercomments.html">Customer Comments</a></strong></h2>
<h2 class="style1"><strong><a href="contactus.html">Contact Us </a></strong></h2>
<h2 class="style1"><strong><a href="links.html">Links</a></strong></h2>

'h2' means 'header 2' and is the wrong tag to use for navigation.

Also steer clear of tables from the outset and you'll save yourself grief in the long run.

Finally your CSS should be in a separate stylesheet so you can link and control all your pages from it, rather than just one.

Keep asking questions, happy to help :)