Vap*_*p0r 7 html css jquery layout internet-explorer-7
我有一些HTML:
<body>
<h1 id="header"></h1>
<div id="container">
<div id="left">
</div>
<div id="content">
<div id="titlebar">
<span id="date">Novermber 13, 3414</span>
<span id="title"> The importance of being earnest.</span>
<span id="author">HG Wellwhocares</span>
</div>
<iframe id="memo" />
<div id="attachments"></div>
<p id="description"></p>
<div id="action">
<div id="accept">Accept</div>
<div id="revise">Revise</div>
</div>
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
还有一些css:
#container{
width: 85%;
margin: 0 auto;
background: gray;
}
#left{
float: left;
width: 20%;
padding: 1%;
}
#left:after{
clear: both;
}
#content{
margin-left: 22%;
background: silver;
padding: 3em;
}
#titlebar{
text-align: center;
}
#date{
float: left;
}
#title{
clear: both;
}
#author{
float: right;
}
#memo{
width: 100%;
min-height: 500px;
}
Run Code Online (Sandbox Code Playgroud)
还有这个jQuery:
months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$(document).ready(function(){
items = new Array();
$.getJSON('_vti_bin/listdata.svc/BOTMemos?$orderby=MeetingDate', function(data){
date = "";
$.each(data.d.results, function(index, value){
if(value.MeetingDate!=null){
if(value.MeetingDate!=date){
if(date!=""){
$('#left').append('<hr />');
}
item = new Array(value.MeetingDate, value.Title0, value.Checkers);
date = value.MeetingDate;
month = months[parseInt(date.substring(5,7), 10)-1];
formattedDate = month + " " + date.substring(8,10) + ", " + date.substring(0, 4);
$('#left').append('<h1>'+formattedDate+'</h1>');
}
$('#left').append('<h2 class="memo">'+value.Title0+'</h2>');
}
});
});
});
Run Code Online (Sandbox Code Playgroud)
这导致两种不同的布局,这在ie9中:
这在ie7中:
我的两个问题是:
<span>标签#titlebar不像ie9那样在ie7中并排显示?用于float:left日期、作者和标题,span如下所示
#titlebar span {
float:left;
}
Run Code Online (Sandbox Code Playgroud)
对于文本对齐,请使用此代码还添加宽度:
#date {
text-align: left;
width: 33%;
}
#title{
text-align: center;
width: 34%;
}
#author{
text-align: right;
width: 33%;
}
Run Code Online (Sandbox Code Playgroud)
请参阅 IE7 中的演示并更新链接:http://jsfiddle.net/rathoreahsan/Jy7Sz/
编辑:
将此代码替换为上面的代码:
#date{
float: left;
}
#title{
clear: both;
}
#author{
float: right;
}
Run Code Online (Sandbox Code Playgroud)
编辑:答案已更新
| 归档时间: |
|
| 查看次数: |
589 次 |
| 最近记录: |