IE8的CSS怪癖,有什么建议吗?
为什么要这么难 在ASP.NET MVC平台上构建站点。电子邮件页面在表单周围有边框(由div设置)。把事情搞得一团糟 IE8中呈现的页面截图: Firefox 3.6中呈现的页面截图: Chrome 8中呈现的页面截图: 我想我已经缩小了问题的范围,这是电子邮件页面的代码(css“hack”是我隐藏它的失败尝试):IE8的CSS怪癖,有什么建议吗?,css,asp.net-mvc,internet-explorer-8,Css,Asp.net Mvc,Internet Explorer 8,为什么要这么难 在ASP.NET MVC平台上构建站点。电子邮件页面在表单周围有边框(由div设置)。把事情搞得一团糟 IE8中呈现的页面截图: Firefox 3.6中呈现的页面截图: Chrome 8中呈现的页面截图: 我想我已经缩小了问题的范围,这是电子邮件页面的代码(css“hack”是我隐藏它的失败尝试): HTML源(由IE呈现): 请求回拨 导航的东西在这里 请填写以下表格,Perri Building将很快与您联系 名字: 姓氏: 电话号码: var Recaptcha
HTML源(由IE呈现):
请求回拨
导航的东西在这里
请填写以下表格,Perri Building将很快与您联系
名字:
姓氏:
电话号码:
var RecaptchaOptions={
主题:"清洁",,
索引:0
};
| | | | |
| | | |
IE开发工具的图像合成:
一定是这个
<% using (Html.BeginForm("CallBack","Home", FormMethod.Post, new {@id="CallBack"})) {%>
您正在这里创建并呈现另一个名为CallBackForm的表单(除了您在
上已有的
)。请查看。不要使用div标记来提供边框,您可以使用Fieldset标记吗?您可以根据需要设置字段集边框的样式,而字段集标记将使此处更加“语义化”,并且它与任何其他div都不同
比如:
<fieldset class="CallBackForm">
<div class="centerform">
<p>Please fill out the following form and Perri Building will contact you shortly!</p>
//Form Stuff
</div>
</fieldset>
能否验证html以确保没有未关闭的div标记?从IE复制/粘贴源代码将通过XHTML 1.0的验证。如果你能提供一个实时页面,你肯定会更快地得到答案。我可以看到它目前托管在您的计算机上,但您肯定可以将呈现HTML的快照放在某个在线位置?您的愿望已实现。应该先这样做。
是960.gs布局系统的一部分。按照建议,我删除了它们以及无用的“黑客”。同样的结果。不,你的代码肯定出了问题,Firefox和Chrome仍然能够正确地显示出来。自从我开始使用IE8以来,IE在渲染方面没有任何问题。以前有很多问题,但大多数问题都是IE8出现的。为什么有*html.centerform?@mare-仅测试,我试图使用一个仅限IE8的css黑客(课前的*html
)。它不起作用,所以我在发布问题后删除了它。另外,检查我文章底部的新编辑。同时拉出IE的开发工具栏(F12),将它的选择器指针指向第二个矩形,并检查它从哪里获得CSS布局。顺便说一句,如果您只向我们显示CSS文件的一部分,可能是其他类/ID干扰。是的,字段集很好,但现在我们必须弄清这一点。;)当然,我会试试这个。它将用ID替换外部DIV,对吗?无论哪种方式,用fieldset替换外部DIV或内部DIV在IE中仍然有幻影框。
<div id="CallBackForm">
<div class="centerform">
<% using (Html.BeginForm()) { %>
//.....
<% } %>
test1
</div>
test2
</div>
test3
@import 'reset.css';
@import 'text.css';
@import '960_24_col.css';
/* Styles for validation helpers
-----------------------------------------------------------*/
.field-validation-error
{
color: #ff0000;
}
.field-validation-valid
{
display: none;
}
.input-validation-error
{
border: 1px solid #ff0000;
background-color: #ffeeee;
}
.validation-summary-errors
{
font-weight: bold;
color: #ff0000;
}
.validation-summary-valid
{
display: none;
}
/* Styles for recaptcha
-----------------------------------------------------------*/
.recaptchatable .recaptcha_image_cell, #recaptcha_table {
background-color:transparent !important; /*reCaptcha widget background color*/
}
#recaptcha_table {
border-color: transparent !important; /*reCaptcha widget border color*/
}
#recaptcha_response_field {
border-color: #abadb3 !important; /*Text input field border color*/
background-color: white !important; /*Text input field background color*/
}
#recaptcha_logo , #recaptcha_tagline
{
display:none !important;
}
/* Styles for front page layout
-----------------------------------------------------------*/
#top_border
{
height:1px;
margin-bottom:2px;
border-bottom:1px solid #42699d;
}
#bottom_border
{
height:1px;
margin: 2px 0px 2px 0px;
border-bottom:1px solid #42699d;
}
#layout_main
{
margin-top:15px;
}
#top_nav
{
display:block;
height:54px;
}
#side_ads
{
margin-left:-10px;
}
#side_ads .first
{
margin-top:3px;
margin-bottom:2px;
}
#side_ads .second
{
margin-top:10px;
margin-bottom:10px;
}
#side_ads .third
{
margin-top:2px;
}
#testimonials
{
margin-left:5px;
background-image: url("images/page_curl.png");
background-repeat: no-repeat;
display:block;
height:338px;
}
#testimonials .content
{
margin-left:20px;
margin-top:30px;
width:225px;
}
#testimonials h2
{
font-weight:bold;
font-size:14px;
}
#testimonials p.body
{
display:block;
height:175px;
}
#testimonials p.by
{
font-style:italic;
text-align:right;
width:200px;
}
#testimonials .buttons
{
margin-top:110px;
}
#bottom_links
{
margin-top:10px;
text-align:center;
}
#bottom_links p
{
margin:0px;
color:#9a081b;
}
#bottom_links a
{
color:#42699d;
text-decoration:none;
}
#bottom_links a:hover
{
border-bottom:1px solid #42699d;
}
/* Styles Product Pages
-----------------------------------------------------------*/
#side_img
{
margin-left:-10px;
margin-top:3px;
}
#product_content
{
padding:0px 5px 5px 5px;
display:block;
width:639px;
height:185px;
background-color:#dcd2c3;
border:1px solid black;
}
#product_content h2
{
margin-bottom:0px;
font-weight:bold;
color:#970016;
font-size:24px;
}
#product_content p
{
text-align:justify;
margin-top:0px;
width: 515px;
font-size:12px;
}
#product_content #content_image
{
position:relative;
top:58px;
float:right;
display:block;
width:112px;
height:92px;
}
/* Styles Mailing Pages
-----------------------------------------------------------*/
#mail_ads
{
}
#mail_ads .first
{
margin-top:3px;
margin-bottom:2px;
}
#mail_ads .second
{
margin-top:10px;
margin-bottom:10px;
}
#mail_ads .third
{
margin-top:2px;
}
/*#mail_content
{
display:block;
}*/
#CallBackForm
{
margin-top:65px;
padding:10px 10px 15px 10px;
background-color:#eef7ff;
border:1px solid #ccc;
height:260px;
overflow:hidden;
}
.centerform
{
margin-left:auto;
margin-right:auto;
width:360px;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
Request a Callback
</title>
<link href="/Content/Site.css" type="text/css" rel="Stylesheet" />
</head>
<body>
<form name="aspnetForm" method="post" action="CallBack" id="aspnetForm">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEwNTM3NTY3MTNkZIccQzHp+0a2l4J4rJdeDfOAYoCO" />
</div>
<div class="container_24" id="layout_main">
<div class="grid_10" id="logo">
<a href="/"><img alt="Perri Building &amp; Renovations" src="/Content/images/logo.png" /></a>
</div>
<div class="grid_14" id="top_nav">
Navigation stuff goes here
</div>
<div class="clear">
</div>
<div class="grid_24" id="top_border"></div>
<div class="grid_7" id="mail_ads">
<a href="/Product/Windows"><img alt="Perri Windows" class="first" src="/Content/images/windows_ad.jpg" /></a>
<a href="/Product/Siding"><img alt="Perri Siding" class="second" src="/Content/images/siding_ad.jpg" /></a>
<a href="/Product/Roofing"><img alt="Perri Roofing" class="third" src="/Content/images/roofing_ad.jpg" /></a>
</div>
<div class="grid_12" id="mail_content">
<div id="CallBackForm">
<div class="centerform">
<p>Please fill out the following form and Perri Building will contact you shortly!</p>
<form action="/Home/CallBack" method="post">
<div class="grid_3">
<label for="FName">First Name:</label>
</div>
<div class="grid_6">
<input id="FName" name="FName" type="text" value="" />
</div>
<div class="clear"></div>
<div class="grid_3">
<label for="LName">Last Name:</label>
</div>
<div class="grid_6">
<input id="LName" name="LName" type="text" value="" />
</div>
<div class="clear"></div>
<div class="grid_3">
<label for="Phone">Phone Number:</label>
</div>
<div class="grid_6">
<input id="Phone" name="Phone" type="text" value="" />
</div>
<div class="clear"></div>
<div class="grid_9">
<script type="text/javascript">
var RecaptchaOptions = {
theme : 'clean',
tabindex : 0
};
</script><script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6Lc608ASAAAAAPi_2PD2wK1P_o3r2daH0j1B26Eu">
</script><noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=6Lc608ASAAAAAPi_2PD2wK1P_o3r2daH0j1B26Eu" width="500" height="300" frameborder="0">
</iframe><br /><textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea><input name="recaptcha_response_field" value="manual_challenge" type="hidden" />
</noscript>
</div>
<div class="grid_8" style="text-align:right;"><input type="submit" value="Send" /></div>
</form>
</div>
</div>
</div>
<div class="grid_24" id="bottom_border">
</div>
<div class="grid_8">
<a href="/Product/Windows"><img alt="Perri Windows" src="/Content/images/windows.jpg" /></a>
</div>
<div class="grid_8">
<a href="/Product/Roofing"><img alt="Perri Roofing" src="/Content/images/roofing.jpg" /></a>
</div>
<div class="grid_8">
<a href="/Product/Siding"><img alt="Perri Siding" src="/Content/images/siding.jpg" /></a>
</div>
<div class="clear" style="margin: 5px 0px 5px 0px;"> </div>
<div class="grid_8">
<a href="/"><img alt="Perri Insulation" src="/Content/images/insulation.jpg" /></a>
</div>
<div class="grid_8">
<a href="/"><img alt="Perri Gutters" src="/Content/images/gutters.jpg" /></a>
</div>
<div class="grid_8">
<a href="/"><img alt="Perri Patio Doors" src="/Content/images/patio.jpg" /></a>
</div>
<div class="clear">
</div>
<div class="grid_14 push_5" id="bottom_links">
<p><a href="/Product/Windows">Windows</a> | <a href="/Product/Roofing">Roofing</a> | <a href="/Product/Siding">Siding</a> | <a href="#">Insulation</a> | <a href="#">Gutters & Gutter Protection</a> | <a href="#">Patio Doors</a></p>
<p><a href="#">Kitchens</a> | <a href="#">Bathrooms</a> | <a href="#">Additions</a> | <a href="#">Decks</a> | <a href="#">Doors</a></p>
</div>
</div>
</form>
</body>
</html>
<% using (Html.BeginForm("CallBack","Home", FormMethod.Post, new {@id="CallBack"})) {%>
<fieldset class="CallBackForm">
<div class="centerform">
<p>Please fill out the following form and Perri Building will contact you shortly!</p>
//Form Stuff
</div>
</fieldset>
fieldset.CallBackForm
{
/*Your Style*/
}