Forum Moderators: open

Message Too Old, No Replies

HTML5 nested Divs

Advice please

         

shug

10:42 pm on Feb 15, 2015 (gmt 0)

10+ Year Member



How would you advise nesting divs in HTML5?

I have some pages with two or three photo images nested so they lie side by side horizontally across the page.
When converting my site from XHTML mark-up to HTML5, I think I have misunderstood the meaning of the Figure tag and Figcaption tag and simply replaced the div tags for Figure and consequently have some failures in validation.
Would I be correct just to leave them as nested divs in HTML5? The Figure/Figcaption works fine for individual non-nested images.
Thank you for your time.

lucy24

7:32 pm on Feb 16, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Oh, go ahead and stick with your nested divs. And then you don't have to worry about middle-aged browsers not knowing what a figcaption is.

You can convert a page from xhtml to html with little more than a few global replaces. But do try not to let your divs get nested nine deep, or the page code ends up looking like The CMS From Hell.

If you're getting validation errors, look for simple booboos like changing an opening tag from "figcaption" to "div" while leaving the closing tag unchanged. A lot of times, fixing a single thing near the beginning of your document can make hundreds of validation errors disappear all at once. (This is not an exaggeration.)

shug

9:08 pm on Feb 16, 2015 (gmt 0)

10+ Year Member



Thanks, yes, am in the process of undoing that mark-up and replacing the figure tag back to div, removing the figcaptions and all is well again. The validation errors were due to nesting inside the "figure" tags.