Reputation: 133
How can I make it so the browser doesn't scroll down to the element which matches the :target (the #comment in the URL)?
Example
#toTarget {
Color: red;
}
#toTarget:target {
Color: green;
}
I don't want it to scroll on div#toTarget.
It can be any language... javascript, css, html, etc...
Upvotes: 1
Views: 918
Reputation: 201758
By not using a fragment identifier such as #toTarget
at the end of a URL. It is not a comment but defined to specify a particular location in a document, so browsers do a natural thing when they position the document accordingly in the window. Reference: STD 66, clause 3.5 Fragment.
Upvotes: 1