Leaving out the href attribute for links in HTML5
You probably know them, these <a>
links that
should not open another web-page. What we did until today is just adding a rhombus # in the href
-attribute.
The href
attribute was required before HTML5. Usually these links were used for JavaScript actions, or just as placeholders.
In HTML5 there is a simpler solution for these links:
Links without a href
-attribute are interpreted as placeholder-links.
This makes our work a little easier.
Note that links without href
don't look like clickable links anymore. However, you can simulate this with CSS. If you want a link without a href
attribute to look like a normal link, you can use this short code in CSS: