Skip to main content
Participant
April 22, 2017
Answered

Tag must be paired error, Beginner's question

  • April 22, 2017
  • 4 replies
  • 37154 views

this is my first attempt at a web page so maybe I am missing something. ive checked over and over again..

I'm getting the error message,

"tag must be paired, missing [</div> </div> </div> </div>] start tag match failed [<div>] on line 38

line 38 is <div><div id="content">

am I missing something????

<!doctype html>

<html>

  <head>
  <link href="css/styles.css">
  </head>

<body><div>
 
  <div id="banner"> <img src="images/LDR banner.jpg">
  </div>
 
   

<div>
<div id="header">
  <h1>Highly Addictive Content</h1>
  </div>
 

  <div>
   <div id= "navigate">
   <ul>
    <il><a href="index.html">Home</a></il>
   
    <il><a href="lease.html">Lease</a></il>
    
    <il><a href="exclusive.html">Exclusive</a></il>
   
    <il><a href="mailinglist.html">Mailing List</a></il>
   
    <il><a href="contactus.html">Contact Us</a></il>
   
   </ul>
  </div>
 
  <div><div id= "content">     
  <p>Shop for high quality beats for lease. </p>
  <p>Various Styles and sounds to add mixed flavor to any project from original hip hop to trap music. </p>
  <p>Get exclusive beats made upon request and worked on to your satisfaction. </p>
  <p>Join our mailing list for promos and updates.</p>
  <img src="images/ldr logo 2 web.png"></div>
  </body>

  </html>

Correct answer BenPleysier

To code for an HTML page you must have a working knowledge of HTML.

One of the first things one learns when being taught to code, is that most (and not all) elements in HTML require an opening tag and a corresponding closing tag. In other words, when you have a <div> tag you must also have a </div> tag to complete the element.

Look through your document, count the <div> tags and the </div> tags and you will see a discrepancy of at least three.

4 replies

rayek.elfin
Legend
January 22, 2025

Wow, I did not notice the necro thread. Forget what I wrote. 🙂

Nancy OShea
Community Expert
Community Expert
April 22, 2017

Learn to use HTML5 semantic tags.

These tags will  cut down on the Divs  and give more meaning to your content which is good for search engines and web accessibility.

CSS tips:

Avoid using unique #IDs unless you need to specifically target them for an action.

Most of the time a semantic tag will get the job done -- header, nav,  li, etc...

And the rest of the time a re-usable .class_name is all that's needed.

Nancy

Nancy O'Shea— Product User & Community Expert
Rob Hecker2
Legend
April 22, 2017

Ben answered your question. I just have a point of advice:

Do not use spaces in file names, even if it works:

<div id="banner"> <img src="images/LDR banner.jpg">

  <img src="images/ldr logo 2 web.png"></div>

Have a set of rules for naming files, form fields, and variables. My rules are:

  • Never use uppercase unless you have a strong reason to
  • Never use spaces (with variables you would get an error message anyway)
  • Use underscore to separate words in variables and fields ($my_form_field) but dashes in file names (my-form-field.html)
  • Use verbose names that describe the element (last_name, not ln)
  • Be extremely consistent. (not last_name in one place and WorkType in another)
BenPleysier
Community Expert
BenPleysierCommunity ExpertCorrect answer
Community Expert
April 22, 2017

To code for an HTML page you must have a working knowledge of HTML.

One of the first things one learns when being taught to code, is that most (and not all) elements in HTML require an opening tag and a corresponding closing tag. In other words, when you have a <div> tag you must also have a </div> tag to complete the element.

Look through your document, count the <div> tags and the </div> tags and you will see a discrepancy of at least three.

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
creativeadvantech
Inspiring
January 9, 2025

how would one count the tags when the html page is long?  Sorry for the noob question.

BenPleysier
Community Expert
Community Expert
January 10, 2025

You don't count tags. The page needs to be structured so that it is obvious if a tag is missing.

 

This is part of @Nancy OShea's answer

 

 

This uses semantic sectioning elements to give the page a structure.

 

For more, see one of my videos:

https://youtu.be/Zy4yJz1icrw?si=mpumfkLqKFZm3lPb

 

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!