If I make an anchor element and don't want text within it, because I'm gonna to css-i-fy it with a nice image and a hover-effect...
I wonder if it is legal to write <a id="hoverimage" href="google.com" />
validome.org & validator.w3.org say YES ?
BTW: anyone knows an equivalent to alt element for this case?
XHTML tags must be closed with a closing tag or a trailing slash. Examples: <p>Some text</p>, <br />. In HTML, closing tags and trailing slashes are not required (but they are acceptable). XHTML does not permit overlapping nested tag structures.
Some few self-closing tags are <input/>, <hr/>, <br/>, <img/>, etc. Self-closing tags in html are sometimes also known as empty tags, void tags, singletons tags, etc. This means that these tags have no content and cannot have any children.
An anchor is a piece of text which marks the beginning and/or the end of a hypertext link. The text between the opening tag and the closing tag is either the start or destination (or both) of a link. Attributes of the anchor tag are as follows. OPTIONAL.
A self-closing tag is an element of HTML code that has evolved in the language. Typically, the self-closing tag makes use of a “/” character in order to effectively close out a beginning tag enclosed in sideways carets.
It is valid in XHTML. It is not HTML-Compatible so likely to break in a document served as text/html. Having a link with no content is bad practise (background images are not content (which is why there is no equivalent to the alt attribute)).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With