5 Replies - 1087 Views - Last Post: 16 January 2010 - 09:23 AM

#1 OnePig2RuleThemAll  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 49
  • Joined: 31-December 09

CSS .class:active Question

Posted 15 January 2010 - 11:09 AM

Hello, I have a straight forward question about CSS and using .class:active {} with a link wrapped around the div. The code below makes a box with some text in it and initially has a green background, and when you click anywhere in the box the background turns red. It works fine in many major browsers, but not in IE6. Is the reason it is not working in IE6 because I wrote the code poorly? Is there is a better way to accomplish the EXACT same results that this code gives which more browsers would read correctly? (I want to keep the link so after the effect happens the user goes to a URL)

Thanks a bunch for any help or guidance I may receive.

<style type="text/css">
.test {
	position: relative;
	height: 65px;
	width: 300px;
	font-size: 24px;
	text-align: center;
	padding-top: 35px;
	background-color: #00FF00;
}
.test:active {
	background-color: #FF0000;
}
</style>
<body>
<a href="java script:;">
<div class="test">
Text
</div>
</a>
</body> 

This post has been edited by OnePig2RuleThemAll: 15 January 2010 - 11:13 AM


Is This A Good Question/Topic? 0
  • +

Replies To: CSS .class:active Question

#2 przemass  Icon User is offline

  • D.I.C Head

Reputation: 30
  • View blog
  • Posts: 166
  • Joined: 18-July 09

Re: CSS .class:active Question

Posted 15 January 2010 - 12:02 PM

IE6 support :active only on tag <a>.
Was This Post Helpful? 0
  • +
  • -

#3 OnePig2RuleThemAll  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 49
  • Joined: 31-December 09

Re: CSS .class:active Question

Posted 15 January 2010 - 12:31 PM

Hmm, could you put that into a couple of lines of code for me? I am not sure I fully comprehend.

I think what you are saying is that IE6 will only use 'active' on links?
Was This Post Helpful? 0
  • +
  • -

#4 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon



Reputation: 1335
  • View blog
  • Posts: 3,400
  • Joined: 28-November 09

Re: CSS .class:active Question

Posted 15 January 2010 - 12:44 PM

Unless you're required to never design for IE6, it's a waste of time and the only reason you should ever bother with it is if the person paying wants their project to support IE6
Was This Post Helpful? 1
  • +
  • -

#5 przemass  Icon User is offline

  • D.I.C Head

Reputation: 30
  • View blog
  • Posts: 166
  • Joined: 18-July 09

Re: CSS .class:active Question

Posted 15 January 2010 - 01:14 PM

Quote

I think what you are saying is that IE6 will only use 'active' on links?

Yes
Was This Post Helpful? 1
  • +
  • -

#6 OnePig2RuleThemAll  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 49
  • Joined: 31-December 09

Re: CSS .class:active Question

Posted 16 January 2010 - 09:23 AM

thanks a bunch guys, big help
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1