简体   繁体   English

已看到开始标记“a”,但已打开相同类型的元素

[英]Start tag "a" seen but an element of the same type was already open

I'm new to html, I try to put a link("a"), a text "b", and a link "c" together in the same line.我是 html 的新手,我尝试将链接(“a”)、文本“b”和链接“c”放在同一行中。 Here is my code.这是我的代码。

<a class = "fixed" href="/a/">linka <span> b </span> <span> <a href="/c/">linkc </a> </span> </a>

But I got some errors, like:但是我遇到了一些错误,例如:

Start tag "a" seen but an element of the same type was already open.已看到开始标记“a”,但已打开相同类型的元素。 error: End tag "a" violates nesting rules.错误:结束标记“a”违反了嵌套规则。 error: Stray end tag "span".错误:杂散结束标记“span”。 error: Stray end tag "a".错误:偏离结束标记“a”。

I try to get rid of nested, but the linkC would not show up.我试图摆脱嵌套,但 linkC 不会出现。 How to fix this error?如何修复此错误?

This error ish happening because you have a <a> tag nested within the first <a> tag, which is not allowed in HTML .发生此错误是因为您在第一个<a>标记中嵌套了一个<a>标记,这在HTML中是不允许的。 To achieve the layout you're looking for, you can use a different approach that doesn't involve nesting <a> tags.要实现您正在寻找的布局,您可以使用不涉及嵌套<a>标记的不同方法。

One way you could fix this is to use a container element, such as a <div> , to wrap all the elements together.解决此问题的一种方法是使用容器元素(例如<div> )将所有元素包装在一起。

Example:例子:

 <div class="fixed"> <a href="/a/">linka</a> <span> b </span> <a href="/c/">linkc </a> </div>

暂无
暂无

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

相关问题 “看到开始标记头但是同一类型的元素已经打开” - “Start tag head seen but an element of the same type was already open” 看到开始标记头但是已经打开了相同类型的元素 - Start tag head seen but an element of the same type was already open 看到一个开始标记,但是相同类型的元素已经打开 - An a start tag seen but an element of the same type was already open HTML:错误:开始标记已看到但相同类型的元素已打开 - HTML: Error: Start tag a seen but an element of the same type was already open 已看到开始标记主体,但已打开相同类型的元素 - Start tag body seen but an element of the same type was already open 错误协助:看到开始标签体,但相同类型的元素已经打开,错误:杂散结束标签头 - Assistance with Error: Start tag body seen but an element of the same type was already open and Error: Stray end tag head W3C验证程序:“看到一个开始标记,但是相同类型的元素已经打开。” - W3C validator: “Start tag a seen but an element of the same type was already open.” “看到了开始标签主体,但相同类型的元素已经打开”并且无法弄清楚如何水平居中? - "Start tag body seen but an element of the same type was already open" & can't figure out how to center horizontally? HTML5 验证错误:看到正文开始标记,但已打开相同类型的元素 - HTML5 Validation Error: body start tag seen but an element of the same type was already open HTML验证列19:看到一个正文开始标签,但是相同类型的元素已经打开 - Html Validation Column 19: An body start tag seen but an element of the same type was already open
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM