Why won't this validate

Hi Everyone…please help me with this. I will always be a newbie to the programming world. I am not sure why my page won’t validate here. The validator gives me an error " line 82 column 6 - Error: end tag for “DIV” omitted, but its declaration does not permit this" - this shows </body> tag and it says “line 16 - Info: start tag was here” which is "<div class="wrapper">". Any help is appreciated… thank you.

Here is my HTML…

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<head>
  <base href="/viewgallery.php" >
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
  <title>Galleries-Colorado Journeys- Photography</title>
  <link rel="stylesheet" type="text/css" href="/stylees.css" >
  <meta name="author" content="by  Photography." >
  <meta name="dcterms.rights" content="All rights reserved by  Photography.">
  <meta name="keywords" content=" Colorado Journeys-Gallery by  Photography, Landscapes, Colorado, images, India, U.S.A" >
  <meta name="description" content="These are images from my small trips to different parts of Colorado. This is an amazing state and images here bring together so many wonderful memories." >
  <link rel="image_src" href= "http://www.newlight.com/photos/" >
  <link rel="icon" type="image/ico" href="http://www.newlight.com/favicon.ico" >
</head>
<body>
<div class="wrapper">

  
    <h1 id="header1"><a href="/viewgallery.php"><span><!-- --></span></a></h1>

    <div class="main">
      <ul class="nav">
        <li><a href="/index.php">HOME&nbsp;&nbsp;|</a></li>

        <li><a href="/viewgallery.php">MY GALLERIES&nbsp;&nbsp;|</a></li>

        <li><a href="/searchmyway.php">SEARCH&nbsp;&nbsp;|</a></li>

        <li><a href="/aboutme.php">ABOUT ME</a></li>
      </ul><div class='thumbsPage'><div class='link'><a href="/viewgallery.php">Albums</a>
<span class='arrow'>&gt;&gt;</span><a href="/viewgallery.php?cname&#61;Colorado-Journeys">Colorado Journeys</a><br><br></div>
<div class='des'>These are images from my small trips to different parts of Colorado. This is an amazing state and images here bring together so many wonderful memories.<br><br></div><div class='thumbs'><table><tr>
    <td><a href="/viewgallery.php?cname&#61;Colorado-Journeys&amp;pcaption&#61;5RETRETERTYRWE"><img src='/./photos/tb_995170_564860166884134_1154534997_n.jpg' alt='5RETRETERTYRWE' ></a></td>
    <td><a href="/viewgallery.php?cname&#61;Colorado-Journeys&amp;pcaption&#61;RYEWYETUYTUWERY"><img src='/./photos/tb_4278823658368000030.jpg' alt='RYEWYETUYTUWERY' ></a></td>

</tr>
<tr>
    <td><a href="/viewgallery.php?cname&#61;Colorado-Journeys&amp;pcaption&#61;REYTUYIEYRIY-RWY-RWEYREY"><img src='/./photos/tb_Selene_by_Karezoid.jpg' alt='REYTUYIEYRIY-RWY-RWEYREY' ></a></td>
    <td><a href="/viewgallery.php?cname&#61;Colorado-Journeys&amp;pcaption&#61;TRETERW-RY-REWYREWY"><img src='/./photos/tb_JF-0002_700px.jpg' alt='TRETERW-RY-REWYREWY' ></a></td>
</tr></table></div></div>

    </div>


  <div class="footer">
    <div class="facebook">
      <ul>
        <li>
          <!-- AddToAny BEGIN -->

          <div class="a2a_kit a2a_kit_size_22 a2a_default_style">
            <a class="a2a_button_facebook"></a> <a class="a2a_button_twitter"></a>
            <a class="a2a_button_google_plus"></a> <a class="a2a_button_stumbleupon"></a>
            <a class="a2a_button_pinterest"></a> <a class="a2a_dd" href=
            "http://www.addtoany.com/share_save"></a>
          </div>

          <div class="footinner">
            <div id="seeker">
              <form action="/searchmyway.php" method="get">
                <p><input type="text" name="q" id="search" ></p><p><input type="submit" id="find"
                value="Search" ></p><p><input type="hidden" name="form_id:search" value="1" ></p>
              </form>
            </div>
          </div>

          <p class="footnote"></p>
        </li>
      </ul>
    </div>  
    </div>
</body>
</html>

That code validates OK via the w3c validator. What validator are you using?

1 Like

Good to see you here again Ralphm( you have helped me in the past ) … I am not sure why that validated ( thought that’s what I want :slight_smile: ) But I edited the post with the code that gives me the error. I am using http://validator.w3.org/check

There is a missing closing </div>

Try amending your script with the following closing tag added to the bottom of your page:

    </div><!-- facebook -->  
  </div><!-- footer -->
</div><!-- content -->
</body>
</html>
1 Like

Hi Everyone again… hanks for helping me with this. I tried…adding closing tags <!-- xyz --> And removed some elements like Facebook, Google Analytic etc to make sense of HTML div tags. But I think I created a monster in the process. Here is the cleaner code, but the problem still persists… the errors now are

Result: 2 errors / 0 warnings
line 46 column 5 - Error: end tag for element "DIV" which is not open
line 62 column 7 - Error: end tag for element "DIV" which is not open

But they clearly are open…which are the “mai” and “wrapper” DIVS :frowning:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<head>
	<base href="/viewgallery.php">
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type">

	<title>Galleries-Colorado Journeys-RYEWYETUYTUWERY- Photography</title>
	<link href="/stylees.css" rel="stylesheet" type="text/css">
	<meta content="by  Photography." name="author">
	<meta content="All rights reserved by  Photography." name="dcterms.rights">
	<meta content=" Colorado Journeys- EY ERY REY ERYRE YREYRE" name="keywords">
	<meta content="RYEWYETUYTUWERY:REYERY YER YRE Y EWYR EERY ERY" name="description">
	<link href="http://www.newlight.com/photos/" rel="image_src">
	<link href="http://www.newlight.com/favicon.ico" rel="icon" type="image/ico">
</head>

<body>
	<div class="wrapper">
		<h1 id="header1"><a href="/viewgallery.php"><span><!-- --></span></a></h1>

		<div class="main">
			<ul class="nav">
				<li>
					<a href="/index.php">HOME&nbsp;&nbsp;|</a>
				</li>

				<li>
					<a href="/viewgallery.php">MY GALLERIES&nbsp;&nbsp;|</a>
				</li>

				<li>
					<a href="/searchmyway.php">SEARCH&nbsp;&nbsp;|</a>
				</li>

				<li>
					<a href="/aboutme.php">ABOUT ME</a>
				</li>
			</ul>
			
<div class='limagePage'>
<div class='llink'><a href="/viewgallery.php">ALBUMS</a><span class='arrow'>&gt;&gt;</span><a href='viewgallery.php?cname=Colorado-Journeys'>Colorado Journeys</a></div>
<div id='prevnext'><span class="prev"><a href="viewgallery.php?cname=Colorado-Journeys&amp;pcaption=5RETRETERTYRWE"><img src="/photos/assets/left.png" alt="left navigation"></a></span><span class="next"><a href="viewgallery.php?cname=Colorado-Journeys&amp;pcaption=REYTUYIEYRIY-RWY-RWEYREY"><img src="/photos/assets/right.png" alt="right navigation"></a></span></div><div class="limage"><table><tr><td><table class="image"><tr><td><a href="viewgallery.php?cname=Colorado-Journeys&amp;pcaption=REYTUYIEYRIY-RWY-RWEYREY">
<img src="/photos/4278823658368000030.jpg"  alt="  EY ERY REY ERYRE YREYRE"></a>
<div class="caption">RYEWYETUYTUWERY</div><div class="excerpt">REYERY YER YRE Y EWYR EERY ERY</div></td></tr></table></td></tr></table><div class="underline"></div></div></div><!-- .limagePage --></div> 
		</div><!-- nav -->
</div><!-- main -->
		<div class="footer">
			<div class="footinner">
				<div id="seeker">
					<form action="/searchmyway.php" method="get">
						<p><input id="search" name="q" type="text"></p>

						<p><input id="find" type="submit" value="Search"></p>

						<p><input name="form_id:search" type="hidden" value="1"></p>
					</form>
					
				</div><!-- seeker -->
				<p class="footnote"></p>
				</div><!-- footinner -->
			</div><!-- footer -->
		</div><!-- wrapper -->
</body>
</html>

You just have extra </div>'s .
Why do you have a closing div tag for “nav” even though the nav element is a UL? Remove pairs of DIVs until you are left with the extra(s)

1 Like

This is actually the closing div for the wrapper. This one is actually closing a non existent div tag; The other extra </div> tag therefore come before this.

1 Like

Thank you guys… your help eliminated one error :slight_smile: The error that shows is line 46 column 5 - Error: end tag for element "DIV" which is not open which is about the ‘main’ DIV.

Am I doing this write? Now my HTML is

 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">>
<html>
<head>
  <base href="/viewgallery.php">
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">

  <title>Galleries-Colorado Journeys-RYEWYETUYTUWERY- Photography</title>
  <link href="/stylees.css" rel="stylesheet" type="text/css">
  <meta content="by Photography." name="author">
  <meta content="All rights reserved by Photography." name="dcterms.rights">
  <meta content=" Colorado Journeys- EY ERY REY ERYRE YREYRE" name="keywords">
  <meta content="RYEWYETUYTUWERY:REYERY YER YRE Y EWYR EERY ERY" name="description">
  <link href="http://www.newlight.com/photos/" rel="image_src">
  <link href="http://www.newlight.com/favicon.ico" rel="icon" type="image/ico">
</head>

<body>
  <div class="wrapper">
    <h1 id="header1"><a href="/viewgallery.php"><span><!-- --></span></a></h1>

    <div class="main">
      <ul class="nav">
        <li>
          <a href="/index.php">HOME |</a>
        </li>

        <li>
          <a href="/viewgallery.php">MY GALLERIES |</a>
        </li>

        <li>
          <a href="/searchmyway.php">SEARCH |</a>
        </li>

        <li>
          <a href="/aboutme.php">ABOUT ME</a>
        </li>
      </ul>

      <div class='limagePage'>
        <div class='llink'>
          <a href="/viewgallery.php">ALBUMS</a><span class='arrow'>&gt;&gt;</span><a href='viewgallery.php?cname=Colorado-Journeys'>Colorado Journeys</a>
        </div>

        <div id='prevnext'>
          <span class="prev"><a href="viewgallery.php?cname=Colorado-Journeys&pcaption=5RETRETERTYRWE"><img alt="left navigation" src="/photos/assets/left.png"></a></span><span class="next"><a href="viewgallery.php?cname=Colorado-Journeys&pcaption=REYTUYIEYRIY-RWY-RWEYREY"><img alt="right navigation" src="/photos/assets/right.png"></a></span>
        </div>

        <div class="limage">
          <table>
            <tr>
              <td>
                <table class="image">
                  <tr>
                    <td>
                      <a href="viewgallery.php?cname=Colorado-Journeys&pcaption=REYTUYIEYRIY-RWY-RWEYREY"><img alt=" EY ERY REY ERYRE YREYRE" src="/photos/4278823658368000030.jpg"></a>

                      <div class="caption">
                        RYEWYETUYTUWERY
                      </div>

                      <div class="excerpt">
                        REYERY YER YRE Y EWYR EERY ERY
                      </div>
                    </td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>

          <div class="underline"></div>
        </div>
      </div><!-- .limagePage -->
    </div>
  </div><!-- wrapper -->
  <!-- main -->

  <div class="footer">
    <div class="footinner">
      <div id="seeker">
        <form action="/searchmyway.php" method="get">
          <p><input id="search" name="q" type="text"></p>

          <p><input id="find" type="submit" value="Search"></p>

          <p><input name="form_id:search" type="hidden" value="1"></p>
        </form>
      </div><!-- seeker -->

      <p class="footnote"></p>
    </div><!-- footinner -->
  </div><!-- footer -->
</body>
</html>

Thanks guys… this problem was partially because my PHP code was outputting HTML tags ( old code …now I know this is bad practice…), this is now fixed. Thank you for helping me, you guys are awesome!.

1 Like