gpt4 book ai didi

html - 通过 Excel 从文件加载时,自定义 HTML 元素符号在 IE 11 中不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 11:05:01 24 4
gpt4 key购买 nike

我正在尝试创建一个 Excel 工具,允许人们使用模板化 HTML 并在 IE 选项卡中预览它。我使用 en Excel 表单创建一个 HTML 文件,该文件保存在本地并导航到 IE 实例中。

不幸的是,当我从文件加载代码时它不起作用(它似乎忽略了 li:before 样式),但它似乎在 Chrome 中工作正常,在 IE 中工作正常 here .

我正在使用以下 CSS/HTML:

<!DOCTYPE html>
<html>
<frame name="prevHtml">
<head>
<style media="screen" type="text/css">
body
{
font-size:14px;
font-family: Helvetica;
}
h2
{
font-size:14px;
margin:10px 0px;
font-family: Helvetica;
}
p
{
font-family: Helvetica;
}
ul {
margin-left: 0;
padding-left: 0;
list-style-type: none;
}
li {
position: relative;
left: 1em;
}
li:before
{
position: absolute;
left: -1em;
content: "-";
}
table.dims
{
font-size:14px;
font-family: Helvetica;
border-collapse: collapse;
border:solid 1px #eee;
border-bottom: 2px solid #eee;
margin-bottom:30px;
}
table.dims tr:hover
{
background: #f4f4f4;
}
table.dims tr:hover td
{
color: #555;
}
table.dims td
{
padding:3px 12px 3px 12px;
border-right:solid 1px #eee;
font-size:13px;
text-align:left
}
table.dims th
{
padding:5px 0px;
text-align:left
}
.grey
{
background-color:#eee;
}
.links
{
background-color:#000;
color:#fff;
padding:6px;
font-size:12px;
margin-right:10px;
}
#bar
{
float:left;
width:980px;
margin-bottom:15px;
}
</style>
</head>

<body>
<ul>
-<li>item1</li>
-<li>item2</li>
-<li>item3</li>
</ul>
</body>
</html>

有什么想法吗?!?!

更新:

将下面的代码简化后,将其保存到文本文件并在 IE 11 中打开,它看起来像这样:

css issue

<!DOCTYPE html>
<html>
<frame name="prevHtml">
<head>
<style media="screen" type="text/css">
body {
font-size: 14px;
font-family: Helvetica;
}
ul {
margin: 0;
padding: 0;
list-style-type: none;
}
.absolute li {
position: relative;
left: 1em;
width: 99% /* add this [or another value that fits you best] to avoid horizontal scrollbar */
}
.absolute li:before {
position: absolute;
left: -1em;
content: "-";
}
.relative li {
/* position: relative; not needed in this case */
}
.relative li:before {
position: relative;
content: "-";
margin-right:.6em
}
</style>
</head>
<body>
<h1> absolute ::before </h1>
<ul class="absolute">
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
<hr />
<h1> relative ::before </h1>
<ul class="relative">
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
</body>
</html>

最佳答案

将你的代码剥离到最基本的部分,它可以工作,看一看:

代码段,在 上有 2 个选项 absoluterelative: :之前

body {
font-size: 14px;
font-family: Helvetica;
}
ul {
margin: 0;
padding: 0;
list-style-type: none;
}
.absolute li {
position: relative;
left: 1em;
width: 99% /* add this [or another value that fits you best] to avoid horizontal scrollbar */
}
.absolute li:before {
position: absolute;
left: -1em;
content: "-";
}

.relative li {
/* position: relative; not needed in this case */

}
.relative li:before {
position: relative;
content: "-";
margin-right:.6em
}
<h1> absolute ::before </h1>
<ul class="absolute">
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
<hr />
<h1> relative ::before </h1>
<ul class="relative">
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>

SS IE11


SS IE11

注意:这是在 IE11 上测试过的,100% 有效

关于html - 通过 Excel 从文件加载时,自定义 HTML 元素符号在 IE 11 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34045999/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com