The below CSS makes a div have a background color. What I am trying to achieve is this: when a user clicks on an anchor link then the link they've clicked highlights (on the same page). So in the example below if there was an achor link like this - index.php#content-5
then the background becomes yellow (just like here on stackoverflow)
So it works - but is there a clever way to make all these div's batch together? I'm thinking something like #content-1,#content-2,#content-3
etc - or is that the wrong approach?
Thanks!
#content-5 {
/*width: 75%;*/
margin: 0 auto;
background-color: #fff;
-webkit-transition: all 1s linear;
}
#content-5:target {
background-color: #ffa;
-webkit-transition: all 1s linear;
}
Aucun commentaire:
Enregistrer un commentaire