Right and wrong way to nest a link

So in #10, in cat photo, is suggests you put your (/a) element at the end of the link. In #64, in Cafe menu, it suggests you put your (/a) at the end with the (/p)element. Which way is the right way?
Cheers.

They are both “correct”. There are a few reasons why you might want to nest the a element.

  • Nesting it inside a block-level element like a p element will make it take up the full width of the line it is on without having to change the default display style of the link element.

  • Nesting the a element inside any other element will allow it to inherit some styles from its parent.


TL;DR it just depends on the use case.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.