Can I add a link to heading in HTML? Something like this
<h2 href="/ingredients">illness</h2>
Somehow it seems to work on simple text only.
No. A heading appears before the body of the section. A menu of items linking to sections is not a collection of headings.
a > h1 { ... } As has been mentioned previously, you cannot have a block level element inside an inline one (in this case a header inside a link). However, you can have an inline level element inside a block level element (a link inside a header).
HTTP headers are the name or value pairs that are displayed in the request and response messages of message headers for Hypertext Transfer Protocol (HTTP). Usually, the header name and the value are separated by a single colon. HTTP headers are an integral part of HTTP requests and responses.
To add an anchor to a heading in HTML, add a <section> element with an id attribute. Don't use <a name> . Use lowercase for id values, and put hyphens between words.
(Almost) All elements may contain other elements. So the following is possible:
<h2><a href="/ingredients">Illness</a></h2>
you need to tag the a
anchor tag inside your h2
tag. something like this:
<h2><a href="/ingredients">illness</a></h2>
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