css - 形式失去所有风格?

标签 css ajax forms internet-explorer-8

我有一个通过 ajax (facebox) 生成的表单。

在 FF、Chrome、IE > 8 中,一切正常,但在 IE < 9 中,表单没有样式。 Image Diff

什么会导致这个*?

*由于 CSS3 而缺少一些效果,但 css3 不是高度/宽度/填充。


group name 输入上使用 IE 的“element source with style”给出:

IE8

<html>
<head><style>
BODY
{
    color: #4f5155;
    padding-top: 0px;
    padding-right: 0px;
    padding-bottom: 0px;
    padding-left: 0px;
    font-family: Tahoma, Helvetica, Arial, sans-serif;
    font-size: 12px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
    background-image: url("../images/pageBackground.png");
    background-attachment: scroll;
    background-repeat: no-repeat;
    background-position-x: center;
    background-position-y: top;
    background-color: rgb(58, 58, 58);
}
#facebox
{
    left: 0px;
    top: 0px;
    text-align: left;
    position: absolute;
    z-index: 100;
}
#facebox .popup
{
    position: relative;
}
#facebox .content
{
    width: 370px;
    padding-top: 10px;
    padding-right: 10px;
    padding-bottom: 10px;
    padding-left: 10px;
    display: table;
    background-image: none;
    background-attachment: scroll;
    background-repeat: repeat;
    background-position-x: 0%;
    background-position-y: 0%;
    background-color: rgb(255, 255, 255);
}

</style></head>
<body><div id="facebox" style="left: 477px; top: 40px;"><div class="popup"><div class="content"><div class="inputSeperator">

<input name="name" type="text" />

</div></div></div></div></body></html>

IE9

<html>
<head><style>
body
{
    color: #4f5155;
    padding-top: 0px;
    padding-right: 0px;
    padding-bottom: 0px;
    padding-left: 0px;
    font-family: Tahoma, Helvetica, Arial, sans-serif;
    font-size: 12px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
    background-image: url("../images/pageBackground.png");
    background-attachment: scroll;
    background-repeat: no-repeat;
    background-position-x: center;
    background-position-y: top;
    background-size: auto;
    background-origin: padding-box;
    background-clip: border-box;
    background-color: rgb(58, 58, 58);
}
form#newForm
{
    width: 500px;
    padding-top: 16px;
    padding-right: 16px;
    padding-bottom: 16px;
    padding-left: 16px;
    font-weight: normal;
    border-top-color: #e5e5e5;
    border-right-color: #e5e5e5;
    border-bottom-color: #e5e5e5;
    border-left-color: #e5e5e5;
    border-top-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-left-width: 1px;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    border-bottom-left-radius: 5px;
    box-shadow: 0px 4px 18px rgba(200,200,200,1);
    background-image: none;
    background-attachment: scroll;
    background-repeat: repeat;
    background-position-x: 0%;
    background-position-y: 0%;
    background-size: auto;
    background-origin: padding-box;
    background-clip: border-box;
    background-color: rgb(255, 255, 255);
}
form#newForm input[type='text'], form#newForm input[type='password'], form#newForm textarea, form#newForm select
{
    width: 97%;
    color: #555;
    padding-top: 3px;
    padding-right: 3px;
    padding-bottom: 3px;
    padding-left: 3px;
    font-size: 16px;
    margin-top: 2px;
    margin-right: 6px;
    margin-bottom: 16px;
    border-top-color: #e5e5e5;
    border-right-color: #e5e5e5;
    border-bottom-color: #e5e5e5;
    border-left-color: #e5e5e5;
    border-top-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-left-width: 1px;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
    background-image: none;
    background-attachment: scroll;
    background-repeat: repeat;
    background-position-x: 0%;
    background-position-y: 0%;
    background-size: auto;
    background-origin: padding-box;
    background-clip: border-box;
    background-color: rgb(251, 251, 251);
}
#facebox
{
    left: 0px;
    top: 0px;
    text-align: left;
    position: absolute;
    z-index: 100;
}
#facebox .popup
{
    border-top-color: rgba(0,0,0,0);
    border-right-color: rgba(0,0,0,0);
    border-bottom-color: rgba(0,0,0,0);
    border-left-color: rgba(0,0,0,0);
    border-top-width: 3px;
    border-right-width: 3px;
    border-bottom-width: 3px;
    border-left-width: 3px;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
    position: relative;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    border-bottom-left-radius: 5px;
    box-shadow: 0px 0px 18px rgba(0,0,0,0.4);
}
#facebox .content
{
    width: 370px;
    padding-top: 10px;
    padding-right: 10px;
    padding-bottom: 10px;
    padding-left: 10px;
    display: table;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 4px;
    background-image: none;
    background-attachment: scroll;
    background-repeat: repeat;
    background-position-x: 0%;
    background-position-y: 0%;
    background-size: auto;
    background-origin: padding-box;
    background-clip: border-box;
    background-color: rgb(255, 255, 255);
}

</style></head>
<body><div id="facebox" style="left: 397.5px; top: 40.5px;"><div class="popup"><div class="content"><form id="newForm" action="none" method="POST"><div class="inputSeperator">

<input name="name" type="text" />

</div></form></div></div></div></body></html>

最佳答案

发现它是什么,

格式错误的 html,

如果你看一下 html,就会有一个额外的结尾 div。

出于某种原因,这导致 ie8 简单地丢弃实际的表单元素,绝对奇怪的行为......

关于css - 形式失去所有风格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5238274/

相关文章:

css - 如何制作响应式组件?

css - Laravel Sass 包含在 html 中

javascript - (WordPress/Ajax) 引用错误 : Can't find variable: ajaxobject

Javascript ParseFloat 自动填充没有小数点

python - Django:使用动态字段加载表单

html - 数字输入不遵循@media 样式

javascript - 拖动开始时更改可拖动元素的大小

jquery - AJAX表单如何显示加载gif

javascript - 使用ajax将javascript变量传递给PHP但它给出错误

c# - 当 .NET 应用程序因 System.AccessViolation 异常而崩溃时,这意味着什么?