Jump to content

Помогите понять что не так для валидатора


Recommended Posts

Ну о сервере я не буду писать и так знаете что это. Но вот вопрос никак не пойму, что он от меня хочет вот мой код:

<div><img title="Правописание уведомления вебмастера" alt="Правописание уведомления вебмастера" src="/wp-content/uploads/2015/08/konkurs.jpg" border="0" width="250" height="400"><div>
 

А вот ответ валидатора

 

 

 

Line 201, Column 226end tag for "img" omitted, but OMITTAG NO was specified…content/uploads/2015/08/konkurs.jpg" border="0" width="250" height="400"></div>

You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

Line 201, Column 31start tag was here            <div class="execphpwidget"><img title="Правописание уведомления вебмастера" …

 

А вот что у меня в 201 строке:

<div class="execphpwidget"><img title="Правописание уведомления вебмастера" alt="Правописание уведомления вебмастера" src="/wp-content/uploads/2015/08/konkurs.jpg" border="0" width="250" height="400"></div>
Link to post
Share on other sites
  • VIP

Может, косая черта в конце?

На w3.org код изображения оформлен так: <img src="http://www.w3.org/Consortium/Offices/w3coffice.png" alt="W3C Office logo" />

 

Валидатор так и пишет: You may have neglected to close an element (закрывающий элемент), or perhaps you meant to "self-close" an element, that is, ending it with "/>" (нужно так) instead of ">" (вместо этого).

Link to post
Share on other sites

Помогите ещё с одним кодом разобраться - не хватает сил и знания.

 

Вот мой код:

<?php wp_list_categories('show_count= 1&title_li='); ?>

А вот что на него пишет валидатор

 

 

 

Line 177, Column 33document type does not allow element "li" here; missing one of "ul", "ol", "menu", "dir" start-tag    <li class="cat-item cat-item-8"><a href="http://мой сайт/sovetyi-vebmasteru/…

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

 

Вот строка 177

<li class="cat-item cat-item-8"><a href="http://мой сайт/sovetyi-vebmasteru/" title="Описание о цветах">о цветах</a> (12

Это код для вывода категорий, так что подобных ошибок много...

 

Как исправить эту не поладочку?

 

Напомню вот сам код вывода в php

<?php wp_list_categories('show_count= 1&title_li='); ?>
Link to post
Share on other sites

  1. <div><img title="Правописание уведомления вебмастера" alt="Правописание уведомления вебмастера" src="/wp-content/uploads/2015/08/konkurs.jpg" border="0" width="250" height="400" style="border: 0; width: 250px; height: 400px" /></div>

 

У Вас 3 ошибки в первой строчке.

 

Валидный код хорошо, но браузеры от border, width и height для аттрибутов, отказываются, сначала от "TD", от IMG уже заявлено, но пока работают теги.

 

Edited by rafonets
Link to post
Share on other sites

Коль уж начали, давайте продолжим... В принципе больше 70% я исправил сам, но некоторые мне не по плечам - так что помощь зала.

 

Вот мой код:

<nav id="<?php echo $html_id; ?>" class="navigation" role="navigation" >
	<?php if ( function_exists( 'wp_pagenavi' ) ) wp_pagenavi(); ?>
</nav> <?php echo $html_id; ?><!--navigation -->

Вот что пишет валидатор:

 

 

Line 566, Column 49element "nav" undefined<nav id="" class="navigation" role="navigation" >

You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by:

  • incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "<frameset>" element),
  • by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).
  • by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case).

 

А вот моя html строчка 566

<nav id="" class="navigation" role="navigation" >

Уже не знаю, как исправить...

Link to post
Share on other sites

" > - пробел.

 

Не помогло.

 

Он по этому коду ещё некоторые ошибки пишет такие как:

 

 

Line 546, Column 36there is no attribute "role"<nav id="" class="navigation" role="navigation" >

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash

 

Он ругается на эту строчку 

 

 

  1. <nav id="" class="navigation" role="navigation" >

 

а это код источник который нужно подправить

<nav id="<?php echo $html_id; ?>" class="navigation" role="navigation" >
	<?php if ( function_exists( 'wp_pagenavi' ) ) wp_pagenavi(); ?>
</nav> <?php echo $html_id; ?><!--navigation -->
Link to post
Share on other sites

У Вас в коде указано XHTML - строгий вариант HTML без ошибок, грубо говоря.

 

Тег NAV из HTML 5 ROLE аттрибут тоже, он ругается на атрибут role, уберите его и не будет ругаться. Но на пробел он тоже ругается ).

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...