html - 在此上下文中,元素 h3 不允许作为元素标签的子元素。[html]
问题描述
我目前有这个代码:
<ul class="char">
<li>
<label class="textOverImage" style="background-image:url(img/text.png)">
<input type="checkbox">
<h3>Joyce Byers</h3>
<div>
text
</div>
</label>
</li>
w3.validator.org 给了我这个错误:在这种情况下不允许元素 h3 作为元素标签的子元素。
在此上下文中,不允许元素 div 作为元素标签的子元素。
我真的不知道另一种方法可以做到这一点。有没有办法在没有错误的情况下得到我想要的东西?
我正在尝试这样做:https ://codepen.io/zFunx/pen/QvzeBN
谢谢你的好处
解决方案
您可以使用以下场景之一:
<label for="username-input">Username</label>
<input type="text" name="username" id="username-input">
<!-- Or, if you want the input inside of the label -->
<label>
<span>Username</span>
<input type="text" name="username">
</label>
你可以在这个线程中找到更多信息
推荐阅读
- php - PHP 问题。我收到电子邮件,但没有来自网站的用户输入
- python - 分组功能优化
- java - java.io.EOFException:由于在检索数据时输入结束,没有要映射到对象的内容
- r - 视图中的错误:“名称”属性 [1] 必须与向量 [0] 的长度相同
- html - HTML5/CSS3:图像作为弹性项目
- ckan - 从外部 API 创建 CKAN 数据集并同步数据集
- ios - 我在哪里可以下载 WWDC2019 源代码?
- python - 有没有办法在 itertools.combinations() 中找到 nᵗʰ 条目而不将整个事物转换为列表?
- amazon-web-services - AWS 中国应用程序负载均衡器 ARN 无效
- javascript - HTML如何在单击另一个元素(例如按钮)后保持输入的焦点状态