我想在用户或客户端使用IE 11打开我的网站时显示一个文本框,而我正在尝试解决代码中的问题。
或者,如果您可能有解决我的问题的想法,请在stackoverflow上写信给我的收件箱。 (IE 11杀死了我...)
您可以看到问题是,当您在IE上打开它时,它会使图像变大,并且控制台即对我没有太大帮助。
代码 HTML
<!doctype html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8">
<title>News | Designplace</title>
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<link href="CSS/Navigation.css" rel="stylesheet" type="text/css">
<link href="CSS/Content.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="NavScript.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<body>
<div class="sidenav" id="mySidenav">
<a href="/" id="homelink"></a>
<a href="news.html" id="news" class="active"></a>
<a href="contact.html" id="contact"></a>
<a href="about.html" id="about"></a>
<!--<a href="nav.html">NAv</a>-->
</div>
<div class="sidenav_small" id="mySidenav_small">
<a href="/" id="homelink"></a>
<a href="news.html" id="news" class="active"></a>
<a href="contact.html" id="contact"></a>
<a href="about.html" id="about"></a>
</div>
<div class="sidenav_icon" id="mySidenav_icon">
<a href="javascript:void(0);" style="font-size:40px;" class="icon" onclick="myFunction()">☰</a>
</div>
<div class="latest">
<h2 class="latest_news">Latest News</h2>
<a href="all_news"><h4 class="more">More...</h4></a>
<div class="table">
<div class="tr">
<div class="td">
<a class="img_link" href="/art/news/00004/Review-af-macos-Mojave-public-beta.html">
<img src="https://www.catster.com/wp-content/uploads/2017/08/A-fluffy-cat-looking-funny-surprised-or-concerned.jpg" alt="macOS">
<div class="inner">
<h3>Review af macOS Mojave beta: God men ikke perfekt.
</h3>
</div>
</a>
</div>
<div class="th"></div>
<div class="td">
<a class="img_link" href="/art/news/00002/206-400-danskere-har-downloadet-ny-nemid-app-i-foerste-doegn-efter-lancering.html">
<img src="https://www.catster.com/wp-content/uploads/2017/08/A-fluffy-cat-looking-funny-surprised-or-concerned.jpg" alt="NemID">
<div class="inner">
<h3>206.400 danskere har downloadet ny NemID-app i første døgn efter lancering.
</h3>
</div>
</a>
</div>
<div class="th"></div>
<div class="td">
<a class="img_link" href="/art/news/00001/hands-on-nokias-spritnye-foraarskollektion-viser-at-billige-smartphones-ikke-behoever-at-vaere-tarvelige.html">
<img src="https://www.catster.com/wp-content/uploads/2017/08/A-fluffy-cat-looking-funny-surprised-or-concerned.jpg" alt="Nokia telefon">
<div class="inner">
<h3>Hands-on: Nokias spritnye forårskollektion viser, at billige smartphones ikke behøver at være tarvelige.
</h3>
</div>
</a>
</div>
</div>
</div>
</body>
</head>
</html>
CSS
@charset "UTF-8";
html, body {
height: 100%;
}
.object {
height: 100%;
width: 100%;
}
.table {
display: table;
width: 100%;
}
.tr {
display: table-row;
}
.td {
display: table-cell;
/*border: 1px solid #ccc;*/
padding: 2px;
width: 31.1%
}
@media screen and (max-width: 400px) {
body {
background-color: #596770;
margin-left: 0px; /* Same as the width of the sidenav */
margin-top: 102.5px;
font-size: 18px; /* Increased text to enable scrolling */
padding: 0px 52px 0px 52px;
/*font-size: 35;*/
color:white;
font-family: montserrat, sans-serif;
}
.latest img {
max-width: 100%;
}
.About {
margin: -45px -52px 0px -52px;
}
.warning {
font-size: 40px;
text-align: center;
margin: -10px
}
.about-line {
margin: 30px;
}
.experimental {
text-align: center;
font-size: 14px;
}
.td {
position: relative;
color: white;
}
/* Bottom left text */
/* Bottom left text */
.inner {
position: absolute;
text-decoration: none;
font-size: 14px;
bottom: 15px;
left: 30px;
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
.img_link {
color: white;
text-decoration: none;
}
.more {
float: right;
margin-top: -45px;
color:white;
}
.more:hover {
text-decoration: underline;
}
td {
padding: 5px 8px 5px;
}
table {
width:100%;
}
thead {
display: none;
}
tr:nth-of-type(2n) {
background-color: inherit;
}
tr td:first-child {
/*background: #f0f0f0;*/
font-weight:normal;
font-size:1.3em;
}
tbody td {
display: block;
text-align:left;
}
tbody td:before {
content: attr(data-th);
display: block;
text-align:left;
font-weight: normal;
}
tbody td::before {
content: attr(data-th);
display: none;
}
.img {
width: 100%;
}
.content {
width: 400px;
overflow: hidden;
}
.teaser {
font-size: 13px;
min-height: 50%;
}
.columnrow {
padding: 10px 0px 10px 0px;
display:flex;
}
.contentimage {
Float:left;
width:20%;
margin-right: 20px;
}
.infoline {
font-size: 13px;
}
.article_img {
width: 100%
}
.article {
margin: 0% 15%;
}
.article_infoline {
font-size: 12px;
}
.article_teaser {
font-size: 18px;
margin-bottom: 10px;
}
.article_title {
margin-bottom: 3px;
}
.article_line {
margin: 30px 0px;
}
.article_image_text {
font-size: 14px;
margin-top: 0px;
}
}
@media screen and (min-width: 401px) and (max-width:600px) {
body {
background-color: #596770;
margin-left: 0px; /* Same as the width of the sidenav */
margin-top: 102.5px;
font-size: 18px; /* Increased text to enable scrolling */
padding: 0px 52px 0px 52px;
/*font-size: 35;*/
color:white;
font-family: montserrat, sans-serif;
}
th {
width: 423px;
height: 273px;
}
.latest img {
max-width: 100%;
}
.About {
margin: -45px -52px 0px -52px;
}
.warning {
font-size: 50px;
text-align: center;
margin: -10px;
}
.about-line {
margin: 30px;
}
.experimental {
text-align: center;
font-size: 18px;
}
.td {
position: relative;
color: white;
}
/* Bottom left text */
/* Bottom left text */
.inner {
position: absolute;
font-size: 14px;
bottom: 15px;
left: 30px;
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
.img_link {
color: white;
text-decoration: none;
}
.more {
float: right;
margin-top: -45px;
color:white;
}
.more:hover {
text-decoration: underline;
}
td {
padding: 5px 8px 5px;
}
table {
width:100%;
}
thead {
display: none;
}
tr:nth-of-type(2n) {
background-color: inherit;
}
tr td:first-child {
/*background: #f0f0f0;*/
font-weight:normal;
font-size:1.3em;
}
tbody td {
display: block;
text-align:left;
}
tbody td:before {
content: attr(data-th);
display: block;
text-align:left;
font-weight: normal;
}
tbody td::before {
content: attr(data-th);
display: none;
}
.img {
width: 100%;
}
.content {
width: 400px;
overflow: hidden;
}
.teaser {
font-size: 13px;
min-height: 50%;
}
.columnrow {
padding: 10px 0px 10px 0px;
display:flex;
}
.contentimage {
Float:left;
width:20%;
margin-right: 20px;
}
.infoline {
font-size: 13px;
}
.article_img {
width: 100%
}
.article {
margin: 0% 15%;
}
.article_infoline {
font-size: 12px;
}
.article_teaser {
font-size: 18px;
margin-bottom: 10px;
}
.article_title {
margin-bottom: 3px;
}
.article_line {
margin: 30px 0px;
}
.article_image_text {
font-size: 14px;
margin-top: 0px;
}
}
@media screen and (min-width: 601px) and (max-width: 720px) {
body {
background-color: #596770;
margin-left: 0px; /* Same as the width of the sidenav */
margin-top: 102.5px;
font-size: 18px; /* Increased text to enable scrolling */
padding: 0px 52px 0px 52px;
/*font-size: 35;*/
color:white;
font-family: montserrat, sans-serif;
}
th {
width: 423px;
height: 273px;
}
.latest img {
max-width: 100%;
}
.About {
margin: -45px -52px 0px -52px;
}
.warning {
font-size: 70px;
text-align: center;
margin: -10px;
}
.about-line {
margin: 30px;
}
.experimental {
text-align: center;
font-size: 24px;
}
.td {
position: relative;
color: white;
}
/* Bottom left text */
/* Bottom left text */
.inner {
position: absolute;
font-size: 14px;
bottom: 15px;
left: 30px;
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
.img_link {
color: white;
text-decoration: none;
}
.more {
float: right;
margin-top: -45px;
color:white;
}
.more:hover {
text-decoration: underline;
}
td {
padding: 5px 8px 5px;
}
table {
width:100%;
}
thead {
display: none;
}
tr:nth-of-type(2n) {
background-color: inherit;
}
tr td:first-child {
/*background: #f0f0f0;*/
font-weight:normal;
font-size:1.3em;
}
tbody td {
display: block;
text-align:left;
}
tbody td:before {
content: attr(data-th);
display: block;
text-align:left;
font-weight: normal;
}
tbody td::before {
content: attr(data-th);
display: none;
}
.img {
width: 100%;
}
.content {
width: 400px;
overflow: hidden;
}
.teaser {
font-size: 13px;
min-height: 50%;
}
.columnrow {
padding: 10px 0px 10px 0px;
display:flex;
}
.contentimage {
Float:left;
width:20%;
margin-right: 20px;
}
.infoline {
font-size: 13px;
}
.article_img {
width: 100%
}
.article {
margin: 0% 15%;
}
.article_infoline {
font-size: 12px;
}
.article_teaser {
font-size: 18px;
margin-bottom: 10px;
}
.article_title {
margin-bottom: 3px;
}
.article_line {
margin: 30px 0px;
}
.article_image_text {
font-size: 14px;
margin-top: 0px;
}
}
@media screen and (min-width:720px) and
(max-width:750px) {
body {
background-color: #596770;
margin-left: 0px; /* Same as the width of the sidenav */
margin-top: 102.5px;
font-size: 18px; /* Increased text to enable scrolling */
padding: 0px 52px 0px 52px;
/*font-size: 35;*/
color:white;
font-family: montserrat, sans-serif;
}
.latest img {
max-width: 100%;
}
.About {
margin: -45px -52px 0px -52px;
}
.warning {
font-size: 80px;
text-align: center;
margin: -10px
}
.about-line {
margin: 30px;
}
.experimental {
text-align: center;
}
.td {
position: relative;
color: white;
}
/* Bottom left text */
/* Bottom left text */
.inner {
position: absolute;
font-size: 14px;
bottom: 15px;
left: 30px;
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
.img_link {
color: white;
text-decoration: none;
}
.more {
float: right;
margin-top: -45px;
color:white;
}
.more:hover {
text-decoration: underline;
}
td {
padding: 5px 8px 5px;
}
table {
width:100%;
}
thead {
display: none;
}
tr:nth-of-type(2n) {
background-color: inherit;
}
tr td:first-child {
/*background: #f0f0f0;*/
font-weight:normal;
font-size:1.3em;
}
tbody td {
display: block;
text-align:left;
}
tbody td:before {
content: attr(data-th);
display: block;
text-align:left;
font-weight: normal;
}
tbody td::before {
content: attr(data-th);
display: none;
}
.img {
width: 100%;
}
.content {
width: 400px;
overflow: hidden;
}
.teaser {
font-size: 13px;
height: 50%;
}
.columnrow {
padding: 10px 0px 10px 0px;
display:flex;
}
.contentimage {
Float:left;
width:29%;
margin-right: 20px;
}
.infoline {
font-size: 13px;
}
.article_img {
width: 100%
}
.article {
margin: 0% 15%;
}
.article_infoline {
font-size: 12px;
}
.article_teaser {
font-size: 18px;
margin-bottom: 10px;
}
.article_title {
margin-bottom: 3px;
}
.article_line {
margin: 30px 0px;
}
.article_image_text {
font-size: 14px;
margin-top: 0px;
}
}
@media screen and (min-width: 750px) and (max-width: 1280px) {
body {
background-color: #596770;
margin-left: 85px; /* Same as the width of the sidenav */
margin-top: 102.5px;
font-size: 18px; /* Increased text to enable scrolling */
padding: 0px 52px 0px 52px;
/*font-size: 35;*/
color:white;
font-family: montserrat, sans-serif;
}
.th {
width: 20px;
}
.latest img {
max-width: 100%;
}
.About {
margin: -45px -52px 0px -52px;
}
.warning {
font-size: 80px;
text-align: center;
margin: -10px
}
.about-line {
margin: 30px;
}
.experimental {
text-align: center;
}
.td {
position: relative;
color: white;
}
/* Bottom left text */
/* Bottom left text */
.inner {
position: absolute;
font-size: 14px;
bottom: 15px;
left: 30px;
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
.img_link {
color: white;
text-decoration: none;
}
.more {
float: right;
margin-top: -45px;
color:white;
}
.more:hover {
text-decoration: underline;
}
td {
padding: 5px 8px 5px;
}
table {
width:100%;
}
thead {
display: none;
}
tr:nth-of-type(2n) {
background-color: inherit;
}
tr td:first-child {
/*background: #f0f0f0;*/
font-weight:normal;
font-size:1.3em;
}
tbody td {
display: block;
text-align:left;
}
tbody td:before {
content: attr(data-th);
display: block;
text-align:left;
font-weight: normal;
}
tbody td::before {
content: attr(data-th);
display: none;
}
.img {
width: 100%;
}
.content {
width: 400px;
overflow: hidden;
}
.columnrow {
padding: 10px 0px 10px 0px;
display:flex;
}
.contentimage {
Float:left;
width:20%;
margin-right: 20px;
}
.teaser {
font-size:70%;
min-height: 50%;
padding: 5px 0px 0px 0px
}
.infoline {
font-size: 70%;
color:white;
}
.article_img {
width: 100%
}
.article {
margin: 0% 15%;
}
.article_infoline {
font-size: 12px;
}
.article_teaser {
font-size: 18px;
margin-bottom: 10px;
}
.article_title {
margin-bottom: 3px;
}
.article_line {
margin: 30px 0px;
}
.article_image_text {
font-size: 14px;
margin-top: 0px;
}
}
@media screen and (min-width: 1281px) and (max-width: 1440px) {
body {
background-color: #596770;
margin-left: 85px; /* Same as the width of the sidenav */
margin-top: 102.5px;
font-size: 18px; /* Increased text to enable scrolling */
padding: 0px 52px 0px 52px;
/*font-size: 35;*/
color:white;
font-family: montserrat, sans-serif;
}
.latest img {
max-width: 100%;
}
.About {
margin: -45px -52px 0px -52px;
}
.warning {
font-size: 80px;
text-align: center;
margin: -10px
}
.about-line {
margin: 30px;
}
.experimental {
text-align: center;
}
.td {
position: relative;
color: white;
}
/* Bottom left text */
/* Bottom left text */
.inner {
position: absolute;
font-size: 14px;
bottom: 15px;
left: 30px;
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
.img_link {
color: white;
text-decoration: none;
}
.more {
float: right;
margin-top: -45px;
color:white;
}
.more:hover {
text-decoration: underline;
}
td {
padding: 5px 8px 5px;
}
table {
width:100%;
}
thead {
display: none;
}
tr:nth-of-type(2n) {
background-color: inherit;
}
tr td:first-child {
/*background: #f0f0f0;*/
font-weight:normal;
font-size:1.3em;
}
tbody td {
display: block;
text-align:left;
}
tbody td:before {
content: attr(data-th);
display: block;
text-align:left;
font-weight: normal;
}
tbody td::before {
content: attr(data-th);
display: none;
}
.img {
width: 100%;
}
.content {
width: 400px;
overflow: hidden;
}
.teaser {
font-size: 13px;
height: 50%;
}
.columnrow {
padding: 10px 0px 10px 0px;
display:flex;
}
.contentimage {
Float:left;
width:29%;
margin-right: 20px;
}
.infoline {
font-size: 13px;
}
.article_img {
width: 100%
}
.article {
margin: 0% 15%;
}
.article_infoline {
font-size: 12px;
}
.article_teaser {
font-size: 18px;
margin-bottom: 10px;
}
.article_title {
margin-bottom: 3px;
}
.article_line {
margin: 30px 0px;
}
.article_image_text {
font-size: 14px;
margin-top: 0px;
}
}
@media screen and (min-width: 1441px) and (max-width:1920px) {
body {
background-color: #596770;
margin-left: 85px; /* Same as the width of the sidenav */
margin-top: 102.5px;
font-size: 18px; /* Increased text to enable scrolling */
padding: 0px 52px 0px 52px;
/*font-size: 35;*/
color:white;
font-family: montserrat, sans-serif;
}
.latest img {
max-width: 100%;
}
.About {
margin: -45px -52px 0px -52px;
}
.warning {
font-size: 80px;
text-align: center;
margin: -10px
}
.about-line {
margin: 30px;
}
.experimental {
text-align: center;
}
.td {
position: relative;
color: white;
}
/* Bottom left text */
.inner {
position: absolute;
font-size: 14px;
bottom: 15px;
left: 30px;
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
.img_link {
color: white;
text-decoration: none;
}
.latest_news {
width: 300px;
}
.more {
float: right;
margin-top: -45px;
color:white;
}
.more:hover {
text-decoration: underline;
}
td {
padding: 5px 8px 5px;
}
table {
width:100%;
}
thead {
display: none;
}
tr:nth-of-type(2n) {
background-color: inherit;
}
tr td:first-child {
/*background: #f0f0f0;*/
font-weight:normal;
font-size:1.3em;
}
tbody td {
display: block;
text-align:left;
}
tbody td:before {
content: attr(data-th);
display: block;
text-align:left;
font-weight: normal;
}
tbody td::before {
content: attr(data-th);
display: none;
}
.img {
width: 100%;
}
.content {
width: 400px;
overflow: hidden;
}
.teaser {
margin-top: 5px;
font-size: 13px;
min-height: 25%;
}
.columnrow {
padding: 10px 0px 10px 0px;
display:flex;
}
.contentimage {
Float:left;
width:22%;
margin-right: 20px;
}
.infoline {
font-size: 12px;
}
.article_img {
width: 100%;
}
.article {
margin: 0% 15%;
}
.article_infoline {
font-size: 12px;
}
.article_teaser {
font-size: 18px;
margin-bottom: 10px;
}
.article_title {
margin-bottom: 3px;
}
.article_line {
margin: 30px 0px;
}
.article_image_text {
font-size: 14px;
margin-top: 0px;
}
}
@media screen and (min-width:1921px) and (max-width:2160px) {
body {
background-color: #596770;
margin-left: 85px; /* Same as the width of the sidenav */
margin-top: 102.5px;
font-size: 18px; /* Increased text to enable scrolling */
padding: 0px 52px 0px 52px;
/*font-size: 35;*/
color:white;
font-family: montserrat, sans-serif;
}
.latest img {
max-width: 100%;
}
.About {
margin: -45px -52px 0px -52px;
}
.warning {
font-size: 80px;
text-align: center;
margin: -10px
}
.about-line {
margin: 30px;
}
.experimental {
text-align: center;
}
.td {
position: relative;
color: white;
}
/* Bottom left text */
.inner {
position: absolute;
font-size: 14px;
bottom: 15px;
left: 30px;
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
.img_link {
color: white;
text-decoration: none;
}
.latest_news {
width: 300px;
}
.more {
float: right;
margin-top: -45px;
color:white;
}
.more:hover {
text-decoration: underline;
}
td {
padding: 5px 8px 5px;
}
table {
width:100%;
}
thead {
display: none;
}
tr:nth-of-type(2n) {
background-color: inherit;
}
tr td:first-child {
/*background: #f0f0f0;*/
font-weight:normal;
font-size:1.3em;
}
tbody td {
display: block;
text-align:left;
}
tbody td:before {
content: attr(data-th);
display: block;
text-align:left;
font-weight: normal;
}
tbody td::before {
content: attr(data-th);
display: none;
}
.img {
width: 100%;
}
.content {
width: 400px;
overflow: hidden;
}
.teaser {
font-size: 13px;
min-height: 50%;
}
.columnrow {
padding: 10px 0px 10px 0px;
display:flex;
}
.contentimage {
Float:left;
width:19.5%;
margin-right: 20px;
}
.infoline {
font-size: 13px;
}
.article_img {
width: 100%;
}
.article {
margin: 0% 15%;
}
.article_infoline {
font-size: 12px;
}
.article_teaser {
font-size: 18px;
margin-bottom: 10px;
}
.article_title {
margin-bottom: 3px;
}
.article_line {
margin: 30px 0px;
}
.article_image_text {
font-size: 14px;
margin-top: 0px;
}
}
@media screen and (min-width:2160px) and (max-width:3840px) {
body {
background-color: #596770;
margin-left: 85px; /* Same as the width of the sidenav */
margin-top: 102.5px;
font-size: 18px; /* Increased text to enable scrolling */
padding: 0px 52px 0px 52px;
/*font-size: 35;*/
color:white;
font-family: montserrat, sans-serif;
}
.latest img {
max-width: 100%;
}
.About {
margin: -45px -52px 0px -52px;
}
.warning {
font-size: 80px;
text-align: center;
margin: -10px
}
.about-line {
margin: 30px;
}
.experimental {
text-align: center;
}
.td {
position: relative;
color: white;
}
/* Bottom left text */
.inner {
position: absolute;
font-size: 14px;
bottom: 15px;
left: 30px;
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
.img_link {
color: white;
text-decoration: none;
}
.latest_news {
width: 300px;
}
.more {
float: right;
margin-top: -45px;
color:white;
}
.more:hover {
text-decoration: underline;
}
td {
padding: 5px 8px 5px;
}
table {
width:100%;
}
thead {
display: none;
}
tr:nth-of-type(2n) {
background-color: inherit;
}
tr td:first-child {
/*background: #f0f0f0;*/
font-weight:normal;
font-size:1.3em;
}
tbody td {
display: block;
text-align:left;
}
tbody td:before {
content: attr(data-th);
display: block;
text-align:left;
font-weight: normal;
}
tbody td::before {
content: attr(data-th);
display: none;
}
.img {
width: 100%;
}
.content {
width: 400px;
overflow: hidden;
}
.teaser {
font-size: 13px;
min-height: 50%;
}
.columnrow {
padding: 10px 0px 10px 0px;
display:flex;
}
.contentimage {
Float:left;
width:11%;
margin-right: 20px;
}
.infoline {
font-size: 13px;
}
.article_img {
width: 100%;
}
.article {
margin: 0% 15%;
}
.article_infoline {
font-size: 12px;
}
.article_teaser {
font-size: 18px;
margin-bottom: 10px;
}
.article_title {
margin-bottom: 3px;
}
.article_line {
margin: 30px 0px;
}
.article_image_text {
font-size: 14px;
margin-top: 0px;
}
}
编辑:
我将代码从.Img更改为.Img_link> Img,并且可以正常工作,但是如果有人想让var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
使用整个javascript,我会很高兴的,对于javascript还不是很好。
我尝试过:
function IncompatibleBrowser() {
var x = document.getElementById("simpleModal")
var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
if (true) {
x.className += " Incompatible";
} else {
x.className = "Compatible"
}
}
编辑2:
好的,Zani提供的代码还可以。我们浏览器中的控制台仅检测到IE11中的代码,这只是我想要的。但是代码给出了错误:
Script 5007: Unable to get property 'style' of undefined or null reference
这是Zani提供的代码。
<script type="text/javascript">
var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
if(isIE11)
document.getElementById("IDOfYourElement").style.display="block";
</script>
答案 0 :(得分:0)
您可以通过浏览器嗅探来定位IE11。您可能知道,这有其自身的缺点。
以我的经验,IE11还不错(与IE8或Safari相比)。因此,很可能可以处理您的问题或一系列问题。
请问一个更具体的问题。
答案 1 :(得分:0)
IE没有问题。问题出在您的代码中。
请在庞大的CSS中找到所有.img {width:100%}
,并替换为
img {width:100%}
(不带的点)。
答案 2 :(得分:-1)
<script type="text/javascript">
var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
if(isIE11)
document.getElementById("IDOfYourElement").style.display="block";
</script>
请先搜索,然后再提问。