0

I have found validating under HTML5, the validator is throwing up errors for using free text with an unordered list.

EG.

<ul>some free text
    <li>1st list item</li>
    <li>2nd list item</li>
</ul> 

So I have replaced this free text within the 'ul' tag with a HTML5 'figure' tag.

EG.

<figure>
    <figcaption>some free text</figcaption>
    <ul>
        <li>1st list item</li>
        <li>2nd list item</li>
    </ul>
</figure> 

Would you agree that this is semantically correct, or should I be using something else?

Your input is appreciated.

1DMF

1DMF
  • 2,045
  • 4
  • 15
  • 17

1 Answers1

0

According to me Yes using figure within your code to full fill the purpose is correct...

According to w3c:- The element(figure) can thus be used to annotate illustrations, diagrams, photos, code listings, etc, that are referred to from the main content......

Go to HTML5 validation service provider and enter the below code to confirm its validity....

<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<figure>
    <figcaption>some free text</figcaption>
    <ul>
        <li>1st list item</li>
        <li>2nd list item</li>
    </ul>
</figure> 
</body>
</html>
Bhavik
  • 4,836
  • 3
  • 30
  • 45
  • Hey Bhavik, Thanks for your input, I had already validated the real page in question where I replaced all the ul free text, so I know it validates, I just wanted to be sure it was the semantic thing to do, as valid mark-up != semantic mark-up. Good to know I was on the right track :-) – 1DMF Jun 11 '14 at 11:49