W3C HTML validator accuses "Empty Heading"

Asked

Viewed 265 times

10

I’m trying to validate my html and it’s giving me the following message:

Line 328, Column 34: Empty heading.
<h3 class="titulo-chamada">A internet no controle</h3>

He hinted that the title is empty, but see that it has a content.

Link to html in codepen

  • 1

    Are you sure the source of the error is this H3? And it is already filled in HTML itself, or would be filled in later (for example, with ajax)?

  • 1

    So... the validator informed the row by column and that chunk of the code that is on this line. There is no ajax, it is inside the html itself.

  • 2

    Could you post the entire code of the page, or publish it somewhere appropriate? You can remove some parts as long as the validator keeps pointing out the error.

  • In addition to the page code, also tell which validator you are using (would be on the W3C website?) and what is the target version (HTML5, HTML 4.01 Strict, HTML 4.01 transitional...)

  • I am using HTML5

  • Can you check this Codepen? I opened it here and no HTML.

  • 1

    I posted on Pastebin a minimum example that reproduces the problem. Note that if you take the tag <figure> the problem disappears, so she must be involved somehow.

  • I think I get it. Semantically it is not right to put an H3 inside a figure tag. If I change the figure tag and use a div, it solves the problem. Thank you to everyone who has helped me!

  • Look cool, the person who takes care of the W3C validator answered! Maybe it’s the case that you mark his response as accepted. It’s a validator bug.

Show 6 more comments

3 answers

9


The meaning of "Empty" in this case is not that the tag has no content; it is that this tag does not refer to a section. The semantic meaning of a header is that it is "the header of a section", and not simply a formatting option (such as strong or em).

Behold that question on Soen for more details. I’m still searching about what must be done to fix it, when I find put here.

Updating: in your case, the use of the header within a article would be correct, the problem seems to be for this article be inside a figure. There’s various uses for this element, but I don’t know the consequences of using it that way. So one way to solve this problem would be to put this article elsewhere (for example in a div, as you claim to have done successfully in the comments).

  • Would you need to be inside a <section>? I’ve never seen that mistake before!

  • I also thought of it, put it inside a 'Section'...

  • @bfavaretto Probably... <section><h3></h3><p></p></section> for example. Also I had never seen this mistake before, I would have to do some tests.

  • Hello, this H3 is inside an article <article><H3></H3><p>...</p></article>

  • I’ll put it on the codepen, just a minute

  • I put a link with the html code, ignore the other errors, because I took some parts of html

Show 1 more comment

5

I maintain the W3C HTML5 validator. The problem you reported is caused by a bug in the validator code. Not the expected behavior. The <h3> certainly not empty, so the error message is wrong. I will try to fix this bug soon. Thank you for noticing the problem.


I’m the maintainer of the W3C HTML5 Validator. The problem reported here is caused by a bug in the Validator sources. It’s not intended behavior. The <h3> is Definitely not Empty. So in this case the error message is just Wrong. I’ll Try to fix this Validator bug soon. Thanks for Catching it.

  • 1

    Thank you very Much for your feedback. I wasn’t expecting this to be read by anyone who doesn’t Speak English! You are Always Welcome here for this Kind of feedback, Feel free to post in English and we’ll Translate your Answers.

  • no problem, Thanks

  • Hello Again. Just to close the loop on this, I Wanted to Say: I Did fix this problem a few months ago in the W3C Validator. Sorry for not following up on it here before now, and Thanks Again for Catching it. If you notice other problems Please open an Issue at https://github.com/validator/validator/issues or send e-mail to [email protected] or to me directly at [email protected]. Regards

3

I think I get it. Semantically it’s not right to put a h3 within a figure tag. If I change the figure tag and use a div, solves the problem.

<!DOCTYPE html>
    <html class="no-js">
        <head>
            <meta charset="UTF-8">
            <title>Teste</title>
        </head>
        <body>
            <figure class="chamada-banner grid grid-8-12">
                <article class="chamada-box">
                    <span class="categoria">Ponto de vista</span>
                    <span class="description">Entrevista</span>
                    <h3 class="titulo-chamada">A internet no controle</h3>
                    <p>Atualmente, publicam-se on line muito mais informações sobre nós mesmos     do que jamai antes, todos estes dados estão sendo coletados por organizações...</p>
                </article>
            </figure>
        </body>
    </html>

Removing the tag figure and using a div resolves.

<!DOCTYPE html>
<html class="no-js">
    <head>
        <meta charset="UTF-8">
        <title>Teste</title>
    </head>
    <body>
        <div class="chamada-banner grid grid-8-12">
            <article class="chamada-box">
                <span class="categoria">Ponto de vista</span>
                <span class="description">Entrevista</span>
                <h3 class="titulo-chamada">A internet no controle</h3>
                <p>Atualmente, publicam-se on line muito mais informações sobre nós mesmos do que jamai antes, todos estes dados estão sendo coletados por organizações...</p>
            </article>
        </div >
    </body>
</html>

Or you can use one span in place of h3, if I want to use the tag figure.

<!DOCTYPE html>
    <html class="no-js">
        <head>
            <meta charset="UTF-8">
            <title>Teste</title>
        </head>
        <body>
            <figure class="chamada-banner grid grid-8-12">
                <article class="chamada-box">
                    <span class="categoria">Ponto de vista</span>
                    <span class="description">Entrevista</span>
                    <span class="titulo-chamada">A internet no controle</span>
                    <p>Atualmente, publicam-se on line muito mais informações sobre nós mesmos     do que jamai antes, todos estes dados estão sendo coletados por organizações...</p>
                </article>
            </figure>
        </body>
    </html>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.