Solved

Can't transition :target, what's wrong with my code?

Posted on 2014-11-10
3
90 Views
Last Modified: 2014-11-13
I'm just trying to create a sample of transitioning :target. The targeting works, but the transition isn't. Can somebody please tell me why? Thanks.

<!DOCTYPE html>
<html>
<head>
<style>
#news1 {
	background-color: white;
	-webkit-transition: background-color, 2s, ease, .1s;
	-moz-transition: background-color, 2s, ease, .1s;
	-o-transition: background-color, 2s, ease, .1s;
	-ms-transition: background-color, 2s, ease, .1s;
	transition: background-color, 2s, ease, .1s;
}
#news2 {
	background-color: white;
	-webkit-transition: background-color, 2s, ease, .1s;
	-moz-transition: background-color, 2s, ease, .1s;
	-o-transition: background-color, 2s, ease, .1s;
	-ms-transition: background-color, 2s, ease, .1s;
	transition: background-color, 2s, ease, .1s;
}
#news1:target {
	border: 2px solid #FF0000;
	background-color: #e5eecc;
}
#news2:target {
	border: 2px solid #FF0000;
	background-color: #e5eecc;
}
</style>
</head>
<body>

<h1>This is a heading</h1>

<p><a href="#news1">Jump to New content 1</a></p>
<p><a href="#news2">Jump to New content 2</a></p>

<p>Click on the links above and the :target selector highlight the current active HTML anchor.</p>

<p id="news1"><b>New content 1...</b></p>
<p id="news2"><b>New content 2...</b></p>

</body>
</html>

Open in new window

0
Comment
Question by:elepil
  • 2
3 Comments
 

Author Comment

by:elepil
ID: 40440207
Just in case anyone's wondering why I think this isn't working, when clicking one of the links, the target is supposed to transition in background color, i.e., the background color should change gradually, not abruptly, and I don't know why the transition is not working. Thanks.
0
 
LVL 50

Accepted Solution

by:
Steve Bink earned 500 total points
ID: 40440345
Remove the commas from your transition declarations.
#news1 {
	background-color: white;
	-webkit-transition: background-color 2s ease .1s;
	-moz-transition: background-color 2s ease .1s;
	-o-transition: background-color 2s ease .1s;
	-ms-transition: background-color 2s ease .1s;
	transition: background-color 2s ease .1s;
}
#news2 {
	background-color: white;
	-webkit-transition: background-color 2s ease .1s;
	-moz-transition: background-color 2s ease .1s;
	-o-transition: background-color 2s ease .1s;
	-ms-transition: background-color 2s ease .1s;
	transition: background-color 2s ease .1s;
}

Open in new window

0
 

Author Closing Comment

by:elepil
ID: 40440357
Oh good grief, I must've been really tired when I did this. Thanks!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
css issues with IE 11 8 42
ebay style="image-orientation: 90deg;" 2 53
div to fit another div 8 28
CSS: How do I override in-line styling 11 26
Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question