Which of the following, if either, is correct by standards?
<!-- Do the links surround the target link object --> <a href=''><p>Link Description</p></a> <!-- or does the object type encapsulate the link--> <p><a href=''>Link Description</a></p>
I know they function the same, But it's a best practice/standards question. This could apply to ul/ol too.
The only reason I think to favor the <a>
tag inside is with a situation like:
<p>This is a longer sentence with a <a href=''>short link here</a></p>
Thanks!
Within a web page, some HTML tags are required for the page to be displayed correctly. These tags are <html> , <head> , <title> and <body> . The <html> tags must begin and end the document and the <head> tags must appear before the <body> tags. Also, the <title> tags must be within the <head> tags.
Definition and Usage. The <p> tag defines a paragraph. Browsers automatically add a single blank line before and after each <p> element. Tip: Use CSS to style paragraphs.
<p1> <p2> etc. tags don't really exist. There is only <p> tags. When you add numbers, you are creating your own custom tags and styling those need to be done differently if you want them to behave like a standard <p> tag.
The <p> HTML element represents a paragraph. Paragraphs are usually represented in visual media as blocks of text separated from adjacent blocks by blank lines and/or first-line indentation, but HTML paragraphs can be any structural grouping of related content, such as images or form fields.
The first example is only allowed in HTML5.
The second example is allowed in all versions of HTML/XHMTL.
You can't wrap a block element with an inline element. You have to do this in that way:
<p><a href=''>Link Description</a></p>
This is W3C standard. Check this!
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