Element div is not closed как исправить

Admittedly, I'm new to coding so I'm sure there may be many issues in my code. The errors that are showing up right now are all Element div is not closed. If someone can please help me resolve this...

Admittedly, I’m new to coding so I’m sure there may be many issues in my code. The errors that are showing up right now are all Element div is not closed. If someone can please help me resolve this, it would be greatly appreciated, thank you. My code is listed below:

.instagramlogo {
  position: absolute;
  width: 50px;
  left: 20px;
  top: 20px;
  cursor: pointer;
}

.linkedinlogo {
  position: absolute;
  width: 50px;
  left: 100px;
  top: 20px;
  cursor: pointer;
}
<body>
  <!-- banner, navigation bar, logos which hyperlink to my socials -->
  <div class="banner">
    <div class="navbar">
      <a href="https://www.instagram.com/shegonnacode/"><img src="images/pngfind.com-instagram-png-22629.png" alt="Instagram logo" class="instagramlogo"></a>
      <a href="https://www.linkedin.com/in/paula-m-175737200/"><img src="images/pngfind.com-linkedin-png-533561.png" alt="Linkedin logo" class="linkedinlogo"></a>
      <ul>
        <li><a href="index.html">Home</a></li>
        <li><a href="resume.html">Resume</a></li>
        <li><a href="lists.html">Lists</a></li>
        <li><a href="contacts.html">Contact</a></li>
      </ul>
    </div>
    <!--About section begins-->
    <section class="welcome">
      <div class="content">
        <h1>Welcome to Paula's Portfolio</h1>
        <p>Thank you for visiting my portfolio. This is a visual depiction of my internal creativity<br>and I hope you enjoy your experience. The navigation bar on the upper right corner
          <br>will direct you to your desired location. </p>
      </div>
      <div class="statement">
        <p> Paula Munoz, aspiring software developer and first year student currently enrolled in George Brown <br> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp&nbsp&nbsp &nbsp &nbsp&nbsp&nbsp &nbsp &nbsp&nbsp &nbsp&nbsp &nbsp &nbsp College's Computer Programming
          and Analysis program.</p>
      </div>
      <!--validation script-->
      <script src=https://my.gblearn.com/js/loadscript.js></script>
</body>

As I stated, I am a noob with coding as I have tried to mess around with the arrangement of my divs and added+ and removed but my attempts have failed miserably. Any help would be appreciated, thank you!

Michael M.'s user avatar

Michael M.

7,2406 gold badges14 silver badges34 bronze badges

asked Nov 1, 2022 at 23:54

pmxx's user avatar

3

The W3C Validator (a great site to check for errors in HTML) shows three problems with your code:

  • The <div class="banner"> element is unclosed. This means that you never closed it with a corresponding </div> tag. All HTML tags must have an ending tag. Sometimes you might mess up and forget one by accident, so it is good to use the W3C Validator to detect these errors and show you where you messed up.
  • The <section class="welcome"> element is unclosed. Like the first error, you’re missing a closing </section> tag.
  • You used &nbsp, but you should have used &nbsp;. HTML escape codes are always in the format of &something;, starting with an ampersand and ending with a semicolon.

I’ve fixed these errors in the code below:

.instagramlogo {
  position: absolute;
  width: 50px;
  left: 20px;
  top: 20px;
  cursor: pointer;
}

.linkedinlogo {
  position: absolute;
  width: 50px;
  left: 100px;
  top: 20px;
  cursor: pointer;
}
<body>
  <!-- banner, navigation bar, logos which hyperlink to my socials -->
  <div class="banner">
    <div class="navbar">
      <a href="https://www.instagram.com/shegonnacode/"><img src="images/pngfind.com-instagram-png-22629.png" alt="Instagram logo" class="instagramlogo"></a>
      <a href="https://www.linkedin.com/in/paula-m-175737200/"><img src="images/pngfind.com-linkedin-png-533561.png" alt="Linkedin logo" class="linkedinlogo"></a>
      <ul>
        <li><a href="index.html">Home</a></li>
        <li><a href="resume.html">Resume</a></li>
        <li><a href="lists.html">Lists</a></li>
        <li><a href="contacts.html">Contact</a></li>
      </ul>
    </div>
  </div>
  <!--About section begins-->
  <section class="welcome">
    <div class="content">
      <h1>Welcome to Paula's Portfolio</h1>
      <p>Thank you for visiting my portfolio. This is a visual depiction of my internal creativity<br>and I hope you enjoy your experience. The navigation bar on the upper right corner
        <br>will direct you to your desired location. </p>
    </div>
    <div class="statement">
      <p> Paula Munoz, aspiring software developer and first year student currently enrolled in George Brown <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; College's
        Computer Programming and Analysis program.</p>
    </div>
  </section>
  <!--validation script-->
  <script src=https://my.gblearn.com/js/loadscript.js></script>
</body>

answered Nov 2, 2022 at 0:06

Michael M.'s user avatar

Michael M.Michael M.

7,2406 gold badges14 silver badges34 bronze badges

1

Вот и наступило 30 сентября.
Как и обещал, делюсь с форумчанами статистикой по проверке валидности их сайтов. А так же самыми частыми ошибками и как их исправить.

За время этой акции, с 7 по 30 сентября было проверено 70 сайтов. Некоторые проверялись по 2 и 3 раза, так как имелись случаи возникновения глобальной ошибки и остальные не показывались. Глобальная ошибка возникает, если в <HEAD> производится вывод какой-либо информации, например, вставляется информер или счётчик.

Количественная статистика.
Это подсчёт всех найденных ошибок по их количеству.

№№

Значение ошибки

Количество

1 Ненужные атрибуты микроразметки (itemid, itemprop, itemref, itemscope, itemtype) 113 2 Вторичное обявление (HTML/BODY/HEAD) 6 3 Теги внутри Hn 8 4 Отсутствует атрибут ALT в картинках 277 5 Не валидный NOINDEX 104 6 Использование атрибута NAME или неправильное его заполнение, например, name=»#».
Пустой или с неправильным содержимым другой элемент. 65 7 В строках встречается не экранированный амперсент (&amp;) 175 8 Преждевременное закрытие тегов, например, <a href=»»/></a> 4 9 Объявление стилей в BODY 45 10 Использование атрибутов (border, align) для оформления 512 11 Пустой (или с недопустимым значением) SRC в картинке/href в ссылке/action в форме 49 12 Ошибка в написании тега (SIZE/CIZE), лишние символы («href==», «</a>>») 47 13 Пробелы в пути к картинке или файлу 50 14 Неизвестное содержание тега REL 47 15 Не открытые или не закрытые теги 121 16 Повтор тега H1 10 17 Многократное дублирование ID слоя 58 18 Повторное открытие/закрытие тегов («<p><p>», «<ul><ul>») 35 19 Нарушение схемы XHTML/HTML 169 20 Неправильное (короткое объявление CSS/JS) 12 21 Неправильное комментирование HTML 119 22 Перехлёст тегов (<p><a href=»»></p></a>) 78 23 Оборачивание блоковых тегов строчными (<span><p><p></span>) 79

Качественная статистика.
Это подсчёт всех встречающихся ошибок на сайтах, т.е., если ошибка встречается 10 раз, то считается, как 1.

№№

Значение ошибки

Повторов

1 Ненужные атрибуты микроразметки (itemid, itemprop, itemref, itemscope, itemtype) 22 2 Вторичное обявление (HTML/BODY/HEAD) 6 3 Теги внутри Hn 4 4 Отсутствует атрибут ALT в картинках 35 5 Не валидный NOINDEX 22 6 Использование атрибута NAME или неправильное его заполнение, например, name=»#».
Пустой или с неправильным содержимым другой элемент.  7 7 В строках встречается не экранированный амперсент (&amp;) 29 8 Преждевренменное закрытие тегов, например, <a href=»»/></a> 4 9 Объявление стилей в BODY 16 10 Использование атрибутов (border, align) для оформления 39 11 Пустой (или с недопустимым значением) SRC в картинке/href в ссылке/action в форме 13 12 Ошибка в написании тега (SIZE/CIZE), лишние символы («href==», «</a>>») 6 13 Пробелы в пути к картинке или файлу 5 14 Неизвестное содержание тега REL 8 15 Не открытые или не закрытые теги 27 16 Повтор тега H1 1 17 Многократное дублирование ID слоя 16 18 Повторное открытие/закрытие тегов («<p><p>», «<ul><ul>») 6 19 Нарушение схемы XHTML/HTML 20 20 Неправильное (короткое объявление CSS/JS) 6 21 Неправильное комментирование HTML 6 22 Перехлёст тегов (<p><a href=»»></p></a>) 8 23 Оборачивание блоковых тегов строчными (<span><p><p></span>) 11

№№

Указание ошибки

Значение ошибки

Как исправить ошибку

1 Attribute «» not allowed on element «meta» at this point. Ненужные атрибуты микроразметки (itemid, itemprop, itemref, itemscope, itemtype) Удалить лишние атрибуты 2 Cannot recover after last error. Any further errors will be ignored. Вторичное обявление (HTML/BODY/HEAD) Удалить ненужное 3 Element «…» not allowed as child of element “Hn” in this context. (Suppressing further errors from this subtree.) Теги внутри Hn Исправить вёрстку с использованием CSS 4 An “img” element must have an “alt” attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images. Отсутствует атрибут ALT в картинках Добавить атрибут. Если изображения используются как оформление поставьте пустые атрибуты (alt=»») 5 Element “noindex” not allowed as child of element “…” in this context. (Suppressing further errors from this subtree.) Не валидный NOINDEX Заменить <noindex></noindex> на <!— noindex —> <!—/ noindex —> 6 Bad value «» for attribute «» on element «»: Must be non-empty. Или Attribute «» not allowed on element «» at this point. Использование атрибута NAME или неправильное его заполнение, например, name=»#». Пустой или с неправильным содержимым другой элемент. Заменить NAME на ID, а при многократном использовании на CLASS. Удалить атрибут или исправить его содержимое/значение. 7 “&” did not start a character reference. (“&” probably should have been escaped as “&amp;”.) В строках встречается не экранированный амперсент (&amp;) Заменить амперсент на HTML-сущность (&amp;) 8 Self-closing syntax (“/>”) used on a non-void HTML element. Ignoring the slash and treating as a start tag. Преждевренменное закрытие тегов, например, <a href=»»/></a> Удалить лишний слеш 9 Element «link» is missing required attribute «property» или Element «style» not allowed as child of element «div» in this context. Объявление стилей в BODY Перенести стили в HEAD 10 element is obsolete. Use CSS instead. Использование атрибутов (border, align) для оформления Перенести оформление в CSS или атрибут style=»» 11 Bad value «» for attribute “src” on element “img”: Must be non-empty. Пустой (или с недопустимым значением) SRC в картинке/href в ссылке/action в форме Прописать путь до картинки 12 Attribute «» not allowed on element «» at this point. Ошибка в написании тега (SIZE/CIZE), лишние символы («href==», «</a>>») Исправить написание 13 Bad value “…” for attribute “src” on element “img”: Illegal character in path segment: not a URL code point. Пробелы в пути к картинке или файлу Исправить имя папки, удалить пробелы 14 Bad value ‘…’ for attribute «rel» on element ‘…’: The string … is not a registered keyword. Неизвестное содержание тега REL Изменить содержание на валидное или удалить атрибут 15 element not empty or not closed Не открытые или не закрытые теги Удалить лишние открывающие/закрывающие или дописать нужные открывающие/закрывающие теги 16 Consider using the H1 element as a top-level heading only (all Тh1У elements are treated as top-level headings by many screen readers and other tools). Повтор тега H1 Исправить вёрстку, заменив H1 на DIV или использовать другие заголовки 17 Duplicate ID Многократное дублирование ID слоя Заменить ID на CLASS 18 The element «…» must not appear as a descendant of the «…» element. Повторное открытие/закрытие тегов («<p><p>», «<ul><ul>») Удалить лишние 19 Self-closing syntax (“/>”) used on a non-void HTML element. Ignoring the slash and treating as a start tag. Нарушение схемы XHTML/HTML Привести теги к заявленной схеме 20 Неправильное (короткое объявление CSS/JS) Объявить полностью (<script type=»text/javascript»>) 21 adjacent hyphens within comment Неправильное комментирование HTML Комментарий должен начинаться (<!—) и заканчиваться (—>). Лишние тире подряд считаются ошибкой. 22 Cannot recover after last error. Any further errors will be ignored./End tag “li” seen, but there were open elements. Перехлёст тегов (<p><a href=»»></p></a>) 23 Element «…» not allowed as child of element «…» in this context. (Suppressing further errors from this subtree.) Оборачивание блоковых тегов строчными (<span><p><p></span>) Изменить порядок тегов

№№

Указание ошибки

Значение ошибки

1 Attribute “alt” not allowed on element “input” at this point. Атрибут ALT в “input” допускается, если type=»image». 2 Cannot recover after last error. Any further errors will be ignored. После </body> все теги игнорируются 3 Attribute “a-index” not allowed on element “li” at this point. Не известные атрибуты 4 Bad value “Last” for attribute “type” on element “a”: Subtype missing. Не верные значения атрибута “type” 5 No space between attributes. Отсутствует пробел перед именем атрибута 6 A “meta” element with an “http-equiv” attribute whose value is “X-UA-Compatible” must have a “content” attribute with the value “IE=edge”. Обернуть строку <meta http-equiv=»X-UA-Compatible» content=»IE=edge,chrome=1″>  в  <!—[if IE]   <![endif]—> 7 Bad value “40px” for attribute “height” on element “img”: Expected a digit but saw “p” instead. Неправильное указание ширины или высоты элемента в атрибуте width/height. Указывать размер нужно без единиц измерения. 8 Empty heading Пустые заголовки 9 Bad value “текст текст” for attribute “href” on element “a”: Illegal character in path segment: not a URL code point. Содержимое атрибута HREF не может содержать пробелов. Ссылки лучше делать латиницей. 10 Element “script” must not have attribute “async” unless attribute “src” is also specified. Атрибут “async” нельзя использовать на встроенных скриптах. Т.е., если отсутствует “src”. 11 Attribute “;” not allowed on element “div” at this point. Лишнее ( ; ) в строке: <div style=»text-align: center; padding-bottom: 5px;»;>. Удалить ( ; ). 12 Almost standards mode doctype. Expected e.g. “”. Объявление одного DOCTYPE, но использование DOCTYPE HTML5. Исправить DOCTYPE. 13 Duplicate attribute «…» Дважды объявлен атрибут «…». Удалить один из повторяющихся атрибутов.

Вот такая статистика получилась в итоге.  :)

По общему признанию, я новичок в программировании, поэтому я уверен, что в моем коде может быть много проблем. Ошибки, которые появляются прямо сейчас, все Element div is not closed.. Если кто-то может помочь мне решить эту проблему, я был бы очень признателен, спасибо. Мой код указан ниже:

.instagramlogo {
  position: absolute;
  width: 50px;
  left: 20px;
  top: 20px;
  cursor: pointer;
}

.linkedinlogo {
  position: absolute;
  width: 50px;
  left: 100px;
  top: 20px;
  cursor: pointer;
}
<body>
  <!-- banner, navigation bar, logos which hyperlink to my socials -->
  <div class="banner">
    <div class="navbar">
      <a href="https://www.instagram.com/shegonnacode/"><img src="images/pngfind.com-instagram-png-22629.png" alt="Instagram logo" class="instagramlogo"></a>
      <a href="https://www.linkedin.com/in/paula-m-175737200/"><img src="images/pngfind.com-linkedin-png-533561.png" alt="Linkedin logo" class="linkedinlogo"></a>
      <ul>
        <li><a href="index.html">Home</a></li>
        <li><a href="resume.html">Resume</a></li>
        <li><a href="lists.html">Lists</a></li>
        <li><a href="contacts.html">Contact</a></li>
      </ul>
    </div>
    <!--About section begins-->
    <section class="welcome">
      <div class="content">
        <h1>Welcome to Paula's Portfolio</h1>
        <p>Thank you for visiting my portfolio. This is a visual depiction of my internal creativity<br>and I hope you enjoy your experience. The navigation bar on the upper right corner
          <br>will direct you to your desired location. </p>
      </div>
      <div class="statement">
        <p> Paula Munoz, aspiring software developer and first year student currently enrolled in George Brown <br> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp&nbsp&nbsp &nbsp &nbsp&nbsp&nbsp &nbsp &nbsp&nbsp &nbsp&nbsp &nbsp &nbsp College's Computer Programming
          and Analysis program.</p>
      </div>
      <!--validation script-->
      <script src=https://my.gblearn.com/js/loadscript.js></script>
</body>

Как я уже сказал, я новичок в кодировании, поскольку я пытался возиться с расположением моих div, добавлял + и удалял, но мои попытки с треском провалились. Любая помощь будет оценена, спасибо!

W3C Validator (отличный сайт для проверки ошибок в HTML) показывает три проблемы с вашим кодом:

  • Элемент <div class="banner"> не закрыт. Это означает, что вы никогда не закрывали его соответствующим тегом </div>. Все теги HTML должны иметь закрывающий тег. Иногда вы можете случайно что-то напутать и забыть, поэтому хорошо использовать W3C Validator, чтобы обнаружить эти ошибки и показать вам, где вы ошиблись.
  • Элемент <section class="welcome"> не закрыт. Как и в случае с первой ошибкой, вам не хватает закрывающего тега </section>.
  • Вы использовали &nbsp, но вам следовало использовать &nbsp;. Экранирующие коды HTML всегда имеют формат &something;, начиная с амперсанда и заканчивая точкой с запятой.

Я исправил эти ошибки в коде ниже:

.instagramlogo {
  position: absolute;
  width: 50px;
  left: 20px;
  top: 20px;
  cursor: pointer;
}

.linkedinlogo {
  position: absolute;
  width: 50px;
  left: 100px;
  top: 20px;
  cursor: pointer;
}
<body>
  <!-- banner, navigation bar, logos which hyperlink to my socials -->
  <div class="banner">
    <div class="navbar">
      <a href="https://www.instagram.com/shegonnacode/"><img src="images/pngfind.com-instagram-png-22629.png" alt="Instagram logo" class="instagramlogo"></a>
      <a href="https://www.linkedin.com/in/paula-m-175737200/"><img src="images/pngfind.com-linkedin-png-533561.png" alt="Linkedin logo" class="linkedinlogo"></a>
      <ul>
        <li><a href="index.html">Home</a></li>
        <li><a href="resume.html">Resume</a></li>
        <li><a href="lists.html">Lists</a></li>
        <li><a href="contacts.html">Contact</a></li>
      </ul>
    </div>
  </div>
  <!--About section begins-->
  <section class="welcome">
    <div class="content">
      <h1>Welcome to Paula's Portfolio</h1>
      <p>Thank you for visiting my portfolio. This is a visual depiction of my internal creativity<br>and I hope you enjoy your experience. The navigation bar on the upper right corner
        <br>will direct you to your desired location. </p>
    </div>
    <div class="statement">
      <p> Paula Munoz, aspiring software developer and first year student currently enrolled in George Brown <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; College's
        Computer Programming and Analysis program.</p>
    </div>
  </section>
  <!--validation script-->
  <script src=https://my.gblearn.com/js/loadscript.js></script>
</body>


0

Michael M.
2 Ноя 2022 в 03:06

Adobe
Adobe Support Community

search

  • Global community

    • Language:
      • Deutsch

      • English

      • Español

      • Français

      • Português

  • 日本語コミュニティ

  • 한국 커뮤니티

    • Home

    • Dreamweaver

    • Discussions

  • Unclosed Element Div

correct answers
1 Correct answer

osgood_

LEGEND

,

Feb 07, 2017
Feb 07, 2017

osgood_



LEGEND

,

Feb 07, 2017
Feb 07, 2017

The end of your page should look like below:

</div>

</div>
<!— end media-object-default —>
</div>
<!— end col-lg-6 col-md-6 —>
</div>
<!— end container —>

</body>
</html>

But you have this:

</div>

<!— end col-lg-6 col-md-6 —>

<!— end media-object-default —>
<!— end container —>

</body>
</html>

replies
7
Replies
7

Что означают следующие сообщения об ошибках?

Я проверяю свой веб-сайт, но получаю странные сообщения о тегах. У меня есть вакансия div вверху страницы, но я все равно получаю эти ошибки. Это ложные предупреждения?

#  Error  Line 195, Column 7: end tag for element "div" which is not open

    </div><!-- wrapper -->

Валидатор обнаружил конечный тег для указанного выше элемента, но этот элемент в настоящее время не открыт. Это часто вызвано оставшимся конечным тегом элемента, который был удален во время редактирования, или неявно закрытым элементом (если у вас есть ошибка, связанная с недопустимым использованием элемента, это почти наверняка так). В последнем случае эта ошибка исчезнет, ​​как только вы исправите исходную проблему.

Если эта ошибка произошла в разделе вашего документа, посвященном сценариям, вам, вероятно, следует прочитать этот раздел часто задаваемых вопросов.

#  Error  Line 195, Column 7: XML Parsing Error: Opening and ending tag mismatch: body line 16 and div

    </div><!-- wrapper -->

# Error Line 208, Column 8: XML Parsing Error: Opening and ending tag mismatch: html line 2 and body

 </body>

Понравилась статья? Поделить с друзьями:
  • Element 3d error invalid filter
  • Element 3d error 124
  • Elektr hisoblagich error 10
  • Electronics workbench could not open file как исправить
  • Electronic workbench ошибка при запуске приложения 0xc0000142