Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DIV ID Hover 3

Status
Not open for further replies.

Enkrypted

Technical User
Sep 18, 2002
663
US
I'm new to CSS and was wondering how I would go about assigning a hover to a DIV section. This is the code I currently have, but it appears not to work:

Code:
#list {
	padding-left: 30px;
	a:hover { color: red; }
}

I'm trying to have the links appear red when hovered over

Enkrypted
A+
 
You could do something like:

CSS:
Code:
.list{
     padding-left: 30px;
}

.list a:hover{
     color: red;
}

HTML:
Code:
<div class="list">
<a href="whatever">Blah</a>
</div>
 
If I'm correctly asuming that you have links within a div named 'list', then try this:
Code:
#list {
    padding-left: 30px;
} 

#list a:hover { color: red; }

You cannot nest css declarations...

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Hi Enkypted,

Try this :

Code:
#list a:hover {
    padding-left: 30px;
    color: red;
}

Steve
 
Hi Enkryted

Traingamer beat me to it and his answer is correct. Please ignore mine I was rushing to reply

Steve
 
Thanks. That fixed the problem. Stars for all

Enkrypted
A+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top