简体   繁体   English

需要帮助解决杂散结束标记 (HTML) 错误

[英]Need help resolving stray end tag (HTML) error

The following code is for one of the classes.以下代码适用于其中一个类。 We were instructed to make a website for one of our projects.我们被指示为我们的一个项目制作一个网站。 Our professors want to always run it through a validator before we turn it in. I got this error, Error: Stray end tag HTML.我们的教授希望在我们提交之前始终通过验证器运行它。我收到了这个错误,错误:Stray end tag HTML。 I can not figure out where the issue is.我无法弄清楚问题出在哪里。 The website works fine but the validator tells me there is a problem.该网站运行良好,但验证器告诉我存在问题。 Any help resolving this would be greatly appreciated.任何帮助解决这个问题将不胜感激。

   <!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8"/>
  <title>Alex's T's and V's</title>
  <link rel="shortcut icon" href="images/logo3.png"/>
  <link rel="stylesheet" href="Styles/normalize.css"/>
  <link rel="stylesheet" href="Styles/final.css"/>
</head>
  


<body>
    <header>
        <img src="images/logo.png" alt="Logo"/>
        <h1>Welcome to the Ultimate T Shirt and V Neck Store</h1>
        <h3>Enjoy your time and please stay as long as you would like</h3>
        
    </header>
    <main>
        <h2>Welcome to my small T shirt store please feel free to browse</h2>
        <br/>
        <p> This is a small store meant to sell a few graphic T shirt and V neck designs. It has always been my goal to own my own store and this feels like the first step.
            Being a successful entrepreneur has always been a dream of mine and I will work hard to make sure my goal is accomplished.
        </p>
        <br/>
        <p> Below you will find a small selection of Anime inspired graphic T shirts and V neck that are listed at competitive prices. <br/> <strong>Note: Sizes available are Small, Medium, Large and Extra Large.</strong> </p>
        <br/>
            <div class="row">
                <div class="column">
                   <img src="images/Tshirt1.jpg" alt="tshirt1" style="width: 48%;"/> 
                   <p><br/>"The Crew" 19.99</p>

                </div>
                <div class="column">
                    <img src="images/tshirt2.jpg" alt="tshirt2" style="width: 45%;"/>
                    <p><br/>"Squad" 18.99</p>

                </div>
                <div class ="column"> 
                   <img src="images/tshirt3.jpg" alt="tshirt3" style="width: 50%;"/>
                   <p><br/>"Ninetails T" 21.99</p>

                </div>
            </div>   
            
        <h3>More Products Coming</h3>
        <br/>
        <p> As we grow as a company our selction will grow too! We plan to add more product and improve our designs based on consumer feedback.<br/> We thank you for your time and support. We look forward to seeing you again! Have a nice day and don't forget, shop Alex's T's and V's for the best T shirts around.</p>
        
    </main>
        
    <footer>
    <p>&copy; 2021 Alex's T's and V's</p>
    </footer>
</body>
</html>

If a tag doesn't have an opening and closing tag like a paragraph for example:如果一个标签没有像段落那样的开始和结束标签,例如:

<p>. .</p> 

Then it should self close:然后它应该自我关闭:

<Img src .... />

Therefore I recommend adding forward slash before closing angle bracket on your meta, style, img and br elements.因此,我建议在关闭 meta、style、img 和 br 元素的尖括号之前添加正斜杠。

Please try doing that and see if it still fails to validate请尝试这样做,看看它是否仍然无法验证

XHTML is more strict than HTML, and requires that all open tags must be closed, even if they're not container tags. XHTML 比 HTML 更严格,并且要求所有打开的标签都必须关闭,即使它们不是容器标签。 Therefore, non-container tags end in />.因此,非容器标签以 /> 结尾。 For example, the tag for a line break is <br /> .例如,换行符的标签是<br />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM