Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jonathan Söder
5,771 PointsUsing the legend element outside of a form?
Hello.
In my current project I'm using a default legend element outside of a form for text headings and I really like the style, it matches the overall theme of the site. It's faster than styling an h1 tag. Just out of curiosity, will I go to dev hell for doing it? What is the downside? SE crawlers not recognizing it as a header if it were to be ranked and get one of those little text snippets on google results? Or is it just one of those things no one will really care about? :=)
1 Answer
Cena Mayo
55,236 PointsHi Jonathan,
Interesting question!
Using the legend element outside of a fieldset is invalid HTML. From what I can tell from some brief research, although it may not be immediately apparent on your site, using legend this way is probably creating unintended side effects on your DOM - check the dev tools in a variety of browsers to see what's actually being created. :)
Best, Cena