css正在自动选中我的html复选框

css is auto checking my html checkbox

本文关键字:我的 html 复选框 css      更新时间:2023-09-26

当我将复选框包含在css类中时,它会自动被选中。我该怎么阻止?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>website</title>
<style type="text/css">
.checkbox0 {
position:fixed;
margin-left:137px;
margin-top:119px;
font-family:Segoe UI;
font-size:9px;
font-weight:normal;
}
</style>
</head>
<body>
<div class="checkbox0"><input type="checkbox" />s</input></div>
</body>
</html>

如果我们删除<div class="checkbox0"></div>,我们会看到它工作正常,但当它使用css时,它会自动检查。

这不可能。尝试使用此代码,但无法自动检查。问题出在别的地方。如果包含在这里,可能是由于其他js文件,或者其他内容存在冲突。

我有一种偷偷的感觉,这不是你的代码,而是你的浏览器缓存。;)尝试删除浏览器缓存,看看它是否修复了它。

首先,您的代码不是有效的HTML:

<input type="checkbox" />s</input>

您已经用/>关闭了input标记,然后您就有了</input>。如果您仍然看到问题,请查看删除</input>是否可以解决问题。