Error stray start tag html

Guide describing the HTML issue detected by the W3C Validator: Stray start tag “html”.

A <head> start tag has been found in an unexpected place in the document structure. Check that the <head> section appears before the <body> section, and that is not duplicated.

The <head> section of an HTML document is the container of metadata about the document, and must appear before the <body> section. A common cause of this issue is duplicated <head> sections.

Here is an example of a minimal HTML document structure:

<!DOCTYPE html>
<html>
  <head>
    <title>Test</title>
  </head>
  <body>
    <p></p>
  </body>
</html>

A <script> start tag has been found in an unexpected place in the document structure. Check that the <script> section appears within the <head> or <body> sections.

Here’s an example of a script inserted in the head of the document:

<!DOCTYPE html>
<html>
  <head>
    <title>Test</title>
    <script>
      console.log("Hello from the head");
    </script>
  </head>
  <body>
    <p></p>
  </body>
</html>

A <style> start tag has been found in an unexpected place in the document structure. Check that the <style> section appears within the <head> section.

Although in general it’s better to put your styles in external stylesheets and apply them using <link> elements, CSS styles can also be included inside a document using the <style> tag. In this case, it should be placed within the <head> section, like in this example:

<!DOCTYPE html>
<html>
  <head>
    <title>Test</title>
    <style>
      p {
        color: #26b72b;
      }
    </style>
  </head>
  <body>
    <p>This text will be green.</p>
  </body>
</html>

Instead of using the isolang attribute to define the language of the document, you can use lang with an ISO 639-1 two character code.

For example, for Portuguese:

<html lang="pt">

12,500 Accessibility and HTML checks per week. Fully automated.

Let our automated scanner check your large sites using Axe Core and W3C Validator.

And end tag has been found that does not match the current open element. Check the context to fix the start and end tags.

An <a> tag can’t include other <a> tags inside. Most probable cause is an unclosed <a> tag, like in this example:

<a href="one.html">Page 1
<a href="two.html">Page 2</a>

12,500 Accessibility and HTML checks per week. Fully automated.

Let our automated scanner check your large sites using Axe Core and W3C Validator.

HTML documents are expected to start with a first line containing the Document Type Declaration, that defines the HTML version used. Since HTML5, it’s just <!DOCTYPE html>, which must appear before the start <html> tag.

Here’s an example of a minimal HTML5 document:

<!DOCTYPE html>
<html>
  <head>
    <title>Test</title>
  </head>
  <body>
    <p></p>
  </body>
</html>

All HTML documents must start with a <!DOCTYPE> (Document Type Declaration), that informs browsers about the type and version of HTML used to build the document. In HTML5, this is simply <!DOCTYPE html> and must appear at the start of the document.

Here is an example of a minimal HTML document, including the Document Type Declaration at its start:

<!DOCTYPE html>
<html>
  <head>
    <title>Test</title>
  </head>
  <body>
    <p></p>
  </body>
</html>

An end tag for X has been found that does not correspond to a previous open tag. This usually happens when you close the same tag twice, for example:

<ul>
  <li>item</li>
</ul>
</ul>

In HTML5, there’s no need to specify the version attribute — it is now obsolete. Here’s an example minimal HTML document to start with:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Test</title>
  </head>
  <body>
    <p></p>
  </body>
</html>

When was the last time you validated your whole site?

Keep your sites healthy checking for A11Y/HTML issues on an automated schedule.

0 / 0 / 0

Регистрация: 20.05.2013

Сообщений: 44

1

02.08.2017, 09:11. Показов 11614. Ответов 6


Всем привет, все перерыл в интернете, но не нашел как устранить проблему в валидаторе? может кто подскажет что означает эта проблема, и как ее вообще решить?

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



112 / 108 / 42

Регистрация: 22.01.2017

Сообщений: 452

02.08.2017, 09:50

2

пропущен стартовый тег tr



0



0 / 0 / 0

Регистрация: 20.05.2013

Сообщений: 44

02.08.2017, 09:55

 [ТС]

3

в исходном коде ничего не пропущено и все сделано по html стандарту, вот что интересно есть table в него входит tr открывающий и соответственно после <td></td> закрывающий тег </tr>



0



112 / 108 / 42

Регистрация: 22.01.2017

Сообщений: 452

02.08.2017, 10:29

4

dimkaja357, покажите пациента.



0



dimkaja357

0 / 0 / 0

Регистрация: 20.05.2013

Сообщений: 44

02.08.2017, 10:32

 [ТС]

5

PHP/HTML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<tbody>
                                                        <?php $curNameTable = ''; ?>
                                                        <?php $curWireСross = 0.0; ?>
                                                        <?php foreach($subTableNames as $subTableName) { ?>
                                                        
                                                            <?php foreach($products as $product) { ?>
                                                                <?php if($product['subTableName'] == $subTableName['subTableName']) { ?>
 
                                                                    <?php if($curNameTable != $subTableName['subTableName']) { ?> 
                                                                        <tr>
                                                                            <td colspan="100%">
 
                                                                            </td>  
                                                                        </tr>
                                                                        <tr>
                                                                            <td colspan="100%" style="text-align:left;">
                                                                                <strong><?php echo $subTableName['subTableName']; ?></strong>
                                                                            </td>  
                                                                        </tr>
                                                                    <?php } else {?> 
                                                                    <?php if($curWireСross != $product['WireСross']) { ?> 
                                                                        <tr>
                                                                            <td colspan="100%">
 
                                                                            </td>  
                                                                        </tr>
                                                                        <?php } ?>
                                                                    <?php } ?>
 
                                                                    <?php $curWireСross = $product['WireСross']; ?>
                                                                    <?php  $curNameTable =  $subTableName['subTableName'];  ?> 
 
                                                                <tr>
                                                                    <td><a target="_blank" data-uk-tooltip="{pos:'top-left'}" title="<?php echo $product['name']; ?>" href="<?php echo $product['href']; ?>"><?php echo $product['model'] ?></a></td>
                                                                    <td><?php echo $product['Dimension'] ?></td>
                                                                    <td><?php echo $product['OuterO'] ?></td>
                                                                    <td><?php echo $product['CuIndex'] ?></td>
                                                                    <td><?php echo $product['weight'] ?></td>
                                                                </tr>
                                                                <?php } ?>
                                                            <?php } ?>
                                                            
                                                        <?php } ?>
                                                        
                                                    </tbody>

P.S после и перед tbody — теги table



0



Модератор

Эксперт JSЭксперт HTML/CSS

3824 / 2674 / 1521

Регистрация: 12.07.2015

Сообщений: 6,674

Записей в блоге: 4

02.08.2017, 10:55

6

Вы валидатору тоже php-код скармливаете? Выкладывайте HTML.



0



dimkaja357

0 / 0 / 0

Регистрация: 20.05.2013

Сообщений: 44

02.08.2017, 14:19

 [ТС]

7

HTML5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<div class="table_index_box">
                                                <table class="table_box table uk-table table-bordered uk-width-1-1">
                                                    <colgroup>
                                                        <col span="100%">    
                                                    </colgroup>
                                                    <thead>
                                                        <tr>
                                                            
                                                                <th>
                                                                    Номер артикула
                                                                </th>
                                                                <th>
                                                                    Размеры
                                                                </th>
                                                                <th>
                                                                    Наружный диаметр
                                                                </th>
                                                                <th>
                                                                    Вес меди
                                                                </th>
                                                                <th>
                                                                    Вес кабеля
                                                                </th>
                                                            
                                                        </tr> 
                                                    </thead>
                                                    <tbody>
                                                        
                                                                                                                                                                                                                                
                                                                                                                            
                                                                     
                                                                     
                                                                        <tr>
                                                                            <td colspan="100%">
 
                                                                            </td>  
                                                                        </tr>
                                                                                                                                            
                                                                                                                                         
 
                                                                <tr>
                                                                    <td><a target="_blank" data-uk-tooltip="{pos:'top-left'}" title="Кабель OPVC-JZ/OZ-YCY 2 X 0,5 мм2" href="http://tkdkabel.ru/index.php?route=product/product&amp;path=60_64_78_152&amp;product_id=292">1001093</a></td>
                                                                    <td>2 X 0,5</td>
                                                                    <td>7,0</td>
                                                                    <td>41,0</td>
                                                                    <td>70,0</td>
                                                                </tr>
                                                                                                                                                                                            
                                                                     
                                                                                                                                        
                                                                                                                                         
 
                                                
 
                                                                <tr>
                                                                    <td><a target="_blank" data-uk-tooltip="{pos:'top-left'}" title="Кабель OPVC-JZ/OZ-YCY 2 X 0,75 мм2" href="http://tkdkabel.ru/index.php?route=product/product&amp;path=60_64_78_152&amp;product_id=300">1001092</a></td>
                                                                    <td>2 X 0,75</td>
                                                                    <td>7,5</td>
                                                                    <td>46,0</td>
                                                                    <td>83,0</td>
                                                                </tr>
                                                                                                                                                                                            
                                                                     
                                                                                                                                        
                                                                                                                                        
                                                                                                                                                                                            
                                                                     
                                                                     
                                                                        <tr>
                                                                            <td colspan="100%">
 
                                                                            </td>  
                                                                        </tr>
                                                                                                                                            
                                                                                              
 
                                                                <tr>
                                                                    <td><a target="_blank" data-uk-tooltip="{pos:'top-left'}" title="Кабель OPVC-JZ/OZ-YCY 4 G 6 мм2" href="http://tkdkabel.ru/index.php?route=product/product&amp;path=60_64_78_152&amp;product_id=335">1000705</a></td>
                                                                    <td>4 G 6</td>
                                                                    <td>15,8</td>
                                                                    <td>318,0</td>
                                                                    <td>485,0</td>
                                                                </tr>
                                                                                                                                                                                            
                                                                     
                                                                                                                                        
                                                                                                                                         
 
                                                                <tr>
                                                                    <td><a target="_blank" data-uk-tooltip="{pos:'top-left'}" title="Кабель OPVC-JZ/OZ-YCY 5 G 6 мм2" href="http://tkdkabel.ru/index.php?route=product/product&amp;path=60_64_78_152&amp;product_id=336">1000719</a></td>
                                                                    <td>5 G 6</td>
                                                                    <td>17,0</td>
                                                                    <td>441,0</td>
                                                                    <td>609,0</td>
                                                                </tr>
                                                                                                                                                                                            
                                                                     
                                                                     
                                                                        <tr>
                                                                            <td colspan="100%">
 
                                                                            </td>  
                                                                        </tr>
                                                                                                                                            
                                                                                                                                                                                                                                                         
                                                                     
                                                                                                                                        
                                                                                                                                         
 
                                                                <tr>
                                                                    <td><a target="_blank" data-uk-tooltip="{pos:'top-left'}" title="Кабель OPVC-JZ/OZ-YCY 5 G 10 мм2" href="http://tkdkabel.ru/index.php?route=product/product&amp;path=60_64_78_152&amp;product_id=338">1000715</a></td>
                                                                    <td>5 G 10</td>
                                                                    <td>21,8</td>
                                                                    <td>714,0</td>
                                                                    <td>1.105,0</td>
                                                                </tr>
                                                                                                                                                      
                                                                     
                                                                     
                                                                        <tr>
                                                                            <td colspan="100%">
 
                                                                            </td>  
                                                                        </tr>
                                                                <tr>
                                                                    <td><a target="_blank" data-uk-tooltip="{pos:'top-left'}" title="Кабель OPVC-JZ/OZ-YCY 4 G 25 мм2" href="http://tkdkabel.ru/index.php?route=product/product&amp;path=60_64_78_152&amp;product_id=340">1000700</a></td>
                                                                    <td>4 G 25</td>
                                                                    <td>28,9</td>
                                                                    <td>1.310,0</td>
                                                                    <td>1.720,0</td>
                                                                </tr>
                                                                        <tr>
                                                                            <td colspan="100%">
 
                                                                            </td>  
                                                                        </tr>
 
                                                                                                                                                                                        
                                                                                                                
                                                    </tbody>
                                                </table>

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

Добавлено через 3 часа 5 минут
Вопрос уже решил. Проблему нашел. Может быть кому то пригодится мой вариант решения проблемы, суть:

Stray (start или end) tag — означает что отмеченный валидатором тег без каких либо оснований был вставлен не к месту и не по правилам стандарта html. В моем случае ошибка была в том, что я не заметил в исходном коде отсутствие тегов table. На странице очень много таблиц, которые выводятся программно и я просто не туда куда нужно смотрел. Картина у меня была такая

HTML5
1
2
3
4
5
6
7
<div>Контент</div>
<tr>
<td>
Контент
</td>
</tr>
<div>Контент</div>



0



54 votes

1 answers

Get the solution ↓↓↓

Running validation and getting a few errors.

    f<!DOCTYPE html>↩
    <!--[if IE 8 ]><html class="ie ie8 no-js" lang="en-US" prefix="og: http://ogp.me/ns#"> <![endif]-->↩
    <!--[if (gte IE 9)|!(IE)]><!--><html class="no-js" lang="en-US" prefix="og: http://ogp.me/ns#"> <!--<![endif]-->↩
    <head>↩

I’ve tried saving the header.php as (UTF-8, no BOM), but I can’t seem to shake the non-space character (the ‘f’) at the start.

Here is the PHP Code:

<!DOCTYPE html>
<?php
/**
 * Theme Header
 *
 * Outputs <head> and header content (logo, tagline, navigation)
 */
?>
<!--[if IE 8 ]><html class="ie ie8 no-js" <?php language_attributes(); ?>> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html class="no-js" <?php language_attributes(); ?>> <!--<![endif]-->
<head>

Then, I have no clue where to start on the «stray html» error tag. Check for yourself http://wsumc.com/worship

2022-08-25

Write your answer


914

votes

Answer

Solution:

Looking at https://validator.w3.org/nu/?doc=http://wsumc.com/worship/ …

The “Stray start taghtml” message is just another side effect of thatf at the beginning.

The way that HTML works is, thatf is naked text—which ahead element can’t contain—so it implies that the body of the document has started and that everything that follows is part of the body. So when an HTML parser sees thatf, the parser generates a<body> start tag.

But the next thing the parser sees is<!DOCTYPE html>—which is now in thebody—so the parser says, “Stray doctype” and moves on. But then the next thing the parser finds is an<html> start tag, which is now also in thebody—so the parser says, “Stray start taghtml”.

The defines how all this works (though admittedly not in a super-approachable way for most readers…)


Share solution ↓

Additional Information:

Date the issue was resolved:

2022-08-25

Link To Source

Link To Answer
People are also looking for solutions of the problem: using $this when not in object context laravel

Didn’t find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.


Similar questions

Find the answer in similar questions on our website.

Я новый программист, работающий на моем первом сайте RoR (с внедренной загрузкой) и имеющий некоторые (казалось бы, простые) проблемы с HTML, заметил проблемы с совместным использованием изображений через отладчик facebook. Ошибка говорит: «У вашей страницы есть метатеги в теле, а не на голове. Это может быть связано с тем, что ваш HTML был искажен, и они упали ниже в дереве разбора. Пожалуйста, исправьте это, чтобы теги были пригодны для использования «.

Я тестировал на http://validator.w3.org/ с HTML5. Это две ошибки, которые мне особенно интересны:

Line 33, Column 20: Stray start tag html.
<html class="no-js">

Line 36, Column 6: Stray start tag head.
<head>

Я исследовал это некоторое время и нашел много похожих вопросов: Stray start tag html, Stray start tag HTML в валидаторе? , Stray start tag Error, Получение «Stray end tag html» из W3C Validator, хотя никто не решил мою ситуацию. Я считаю, что у меня правильный формат HTML5:

<html>
  <head>
    <meta>
    <link>
    <script></script>
    <title></title>
  </head>
  <body>
  </body>
</html>

Мне любопытно, если «no-js» или div id имеют эффект и не нашли большой помощи в этом отношении.

Мой код:

<html class="no-js">

<div id="header">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">

    <meta property="og:title" content="one breath">
    <meta property="og:description" content="This moment is your life. Breathe. Notice it.">
    <meta property="og:image" content="http://i61.tinypic.com/2yjzpsz.png">
    <meta property="og:url" content="http://www.onebreath.io">

    <link rel="stylesheet" href="bootstrap.css">
    <link rel="stylesheet" href="bootstrap-theme.css">
    <link rel="stylesheet" href="main.css">
    <link rel="image" type="image/png" href="breathenoticeit.png">

    <script src="js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>

    <!-- favicon -->
    <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">

    <title>one breath</title>
</head>
</div>

<body>
.... content ....
</body>     
</html>

Мой вопрос: что такое неправильный HTML? В частности, как я могу устранить ошибки заголовка стартового тега html и блуждающих начальных тегов, заданные модулем проверки HTML (чтобы в конечном итоге исправить ошибку отладчика facebook и отобразить правильное изображение)?

Любая помощь очень ценится! (Полный сайт www.onebreath.io)

РЕДАКТИРОВАТЬ

Уточнен вопрос.

Понравилась статья? Поделить с друзьями:
  • Error status file not found 0xc001000d
  • Error status ext ram exception 0xc0050005 ошибка flashtool как исправить ошибку
  • Error status exceed available range 0xc004000b перевод
  • Error status err 0xc0010001 sp flash tool
  • Error stray end tag head