html - 复选框不显示在 IE 中(仅)

标签 html css internet-explorer checkbox compatibility

我无法在 Internet Explorer 中显示我的复选框。
它适用于所有其他网络浏览器,但只有 IE 无法正确显示它。
此外,它在我的本地机器文件夹中正常工作,但是当它从我在网络 (NAS) 中的文件夹打开时无法显示 <- 用 IE 打开

由于工作关系,需要放在网络上。 我已经用 Firefox 26.0 和 IE 10.0.9 测试过

这是我的代码:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11 DTD/xhtml11.dtd"><html xsi:schemalocation="http://www.w3.org 1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" version="-//W3C//DTD XHTML 1.1//EN">

<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=windows-1252"/>
<style>
input[type=checkbox] {  
display: none;  
}   
.checkbox label:before {  
border-radius: 1px;  
border: 1px solid black
}  
input[type=checkbox]:checked + label:before {  
content: "X";  
text-shadow: 1px 1px 1px rgba(0, 0, 0, .2);  
font-size: 22px;  
color: #000000;  
text-align: center;  
line-height:19px;
border: 1px solid black
}  
label {  
display: inline-block;  
cursor: pointer;  
position: relative;  
padding-left: 25px;  
margin-right: 15px;  
font-size: 16px;  
font-weight: bold;
}  
label:before {  
content: "";  
display: inline-block;  


width: 15px;  
height: 15px;  

margin-right: 10px;  
position: absolute;  
left: 0;  
bottombottom: 1px;  
background-color: #eee;  
box-shadow: inset 0px 2px 3px 0px rgba(0, 0, 0, .3), 0px 1px 0px 0px rgba(255, 255, 255, .8);  
}      
</style>
</head>
<body>
<div class="checkbox"> <input type="checkbox" id="Field1" name="testINPUT" fieldname="Vote" mandatory="false" value="VoteYes" /> <label for="Field1">Yes</label></div>
<div class="checkbox"> <input type="checkbox" id="Field2" name="testINPUT" fieldname="Vote" mandatory="false" value="VoteNo" /> <label for="Field2">No</label> </div>

</body>
</html>

最佳答案

找到了 Checkbox 不显示的问题
根本原因是当文件被放置在网络上并用 IE 打开时,它以某种方式自动将文档模式:更改为“Internet Explorer 7 标准”,这不是'当您在本地文件夹中获取文件时不会发生这种情况。

因此,在代码中添加这一行将强制在Document Mode: Standards

下运行
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

有关兼容性的更多详细信息,您可以在以下 URL 中找到:

https://hsivonen.fi/doctype/#ie8

关于html - 复选框不显示在 IE 中(仅),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21151236/

相关文章:

css - 更改高度后如何换行和对齐?

css - 在 IE 9 及以下版本的样式文本输入中没有插入点

jquery - 像选择器一样的跨浏览器 iOS

html - 如何使用 HTML、CSS 和 JQuery 创建 CNN 菜单导航

javascript - 如何从 Iframe 打开新标签页?

html - 如何让一张图片覆盖另一张图片?

javascript - 我可以通过它包含的内容/值来隐藏 HTML 标签吗?

c# - 如何强制 Internet Explorer 打开它当前运行的实例而不是创建一个新实例?

html - 居中对齐包裹在 div 中的两个元素

html - CSS:垂直居中响应式 Bootstrap 表单