Can we place a h1 title in a <a> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can we place a h1 title in a <a>

My question is simple: can I place a <h1> in a <a>? Thanks for your answers!

27th Apr 2018, 6:43 PM
Romain Puech
Romain Puech - avatar
5 Answers
+ 4
Yes. This code validates in the W3C HTML Validator (https://validator.w3.org/nu/#textarea) <!DOCTYPE html> <html lang="en"> <head> <title>Test</title> </head> <body> <a><h1>Fred</h1></a> </body> </html>
27th Apr 2018, 6:49 PM
Emma
+ 9
Yes, <a href="www.sololearn.com"><h1>SoloLearn</h1></a> is completely valid.
27th Apr 2018, 6:50 PM
Rusty.Metal
+ 9
Happy to help Romain Puech .
27th Apr 2018, 6:55 PM
Rusty.Metal
+ 4
You're welcome ☺ Happy coding.
27th Apr 2018, 6:54 PM
Emma
+ 3
Thank you so much for your answers !
27th Apr 2018, 6:53 PM
Romain Puech
Romain Puech - avatar