Kuba Krzyżyński
Kuba Krzyżyński

Reputation: 211

HTML not validating

My HTML document is not validating. Every validator I've tried says there is one more <p> tag . I've checked it and there is the same amount of p's and /p's. Is it possible that online validators are wrong?

Whole code: JSFiddle

HTML:

<!DOCTYPE HTML>
<html lang="pl">

<head>

    <meta charset="utf-8" />
    <title>Moje hobby</title>
    <meta name="description" content="Strona stworzona na potrzeby projektu." />
    <meta name="keywords" content="filmy, kino, seriale, projekt" />
    <meta name="author" content="Jakub Krzyżyński" />
    <link rel="Stylesheet" href="Style.css" />
    <link href="https://fonts.googleapis.com/css?family=Oswald:400,700&amp;subset=latin-ext" rel="stylesheet">

</head>

Upvotes: 1

Views: 110

Answers (1)

Luka Kerr
Luka Kerr

Reputation: 4239

It is because the ul (unordered list) elements are not actually allowed inside p elements.

As you can see, the below snippet is from your code (from the fiddle). It looks fine (as in all tags are closed) although there is an ul inside the p tag, which technically isn't allowed. This is why you are getting the errors when validating

p elements can only contain phrasing content, and because ul elements are flow content, they cannot be placed inside a p element.

<p>
  Film to bardzo obszerna dziedzina i można ją podzielić na wiele sposobów. Podstawowy i najbardziej popularny z nich to podział na rodzaje:
  <ul>
    <li>film fabularny – aktorski film fikcji,</li>
    <li>film animowany – tworzony za pomocą klasycznych technik poklatkowych – rysunkowych lub przestrzennych lub najnowszych technik komputerowych – animacji 3D,</li>
    <li>film dokumentalny – film o treści niefikcyjnej, dokumentujący rzeczywistość,</li>
    <li>film oświatowy – dla celów dydaktyczno-instruktażowych,</li>
    <li>film propagandowy – dla celów jakich w danym momencie wymaga propaganda</li>
  </ul>
</p>

From the W3 specifications:

A p element's end tag may be omitted if the p element is immediately followed by an address, article, aside, blockquote, div, dl, fieldset, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, main, nav, ol, p, pre, section, table, or ul, element, or if there is no more content in the parent element and the parent element is not an a element.

Upvotes: 4

Related Questions