div标签已被另一个标签关闭。

huangapple go评论56阅读模式
英文:

NG5002 div tag already closed by another tag

问题

在角度组件HTML中

<div>
    <label >对比度:</label>    
    <input type="range">
</div>
<!-----------这段代码可以正常工作---->
<div>
    <label >对比度:</label>
    <input type="range">
    <span>100%<span>             
</div>
<!-----这段代码会出错----->

[![ng serve后的终端](https://i.stack.imgur.com/vFq4N.png)](https://i.stack.imgur.com/vFq4N.png)

尝试创建一个简单的滑块,但出现错误,因此删除了许多数据以检查错误的原因,即使删除了div闭合标签,也不会出现错误,我花了一些时间搜索错误,也许我太笨了,没有理解,找不到任何解决方案的链接将会很有帮助。
英文:

In angular component html

    <div>
        <label >Contrast:</label>    
        <input type="range">
    </div>
    <!-----------this code is working---->
    <div>
        <label >Contrast:</label>
        <input type="range">
        <span>100%<span>             
    </div>
    <!-----this code is giving error----->

div标签已被另一个标签关闭。

Trying to make a simple slider but error came so removed a lot of the data to check what was causing error
no error is coming even if div closing tag is removed
i did spend some time on searching the error, may be i'm dumb to not understand, i couldnt find any. even a link to a solution would be helpfull

答案1

得分: 0

你需要关闭你的 span

<div>
    <label >对比度:</label>    
    <input type="range">
</div>
<!-----------这段代码正常工作-->
<!------------------------------------------------------------------>
<div>
    <label >对比度:</label>
    <input type="range">
    <span>100%</span>             
</div>
英文:

You need to close your span

<div>
    <label >Contrast:</label>    
    <input type="range">
</div>
<!-----------this code is working-->
<!------------------------------------------------------------------>
<div>
    <label >Contrast:</label>
    <input type="range">
    <span>100%</span>             
</div>

huangapple
  • 本文由 发表于 2023年4月10日 20:58:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/75977346.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定