<script type="text/javascript">
window.onload=function(){
var date=new Date()
var day=date.getDay()
var xing=new Array("1","2","3","4","5","6","7")
var cssDiv=document.getElementById("mycss")
switch(xing[day]) {
case "1":
cssDiv.href="1.css"
break
case "1":
cssDiv.href="2.css"
break
case "2":
cssDiv.href="1.css"
break
case "3":
cssDiv.href="3.css"
break
case "4":
cssDiv.href="4.css"
break
case "5":
cssDiv.href="5.css"
break
case "6":
cssDiv.href="6.css"
break
case "7":
cssDiv.href="7.css"
}
}
</script>
给个span标签,让他右浮动,示例代码:
<!doctype html><html>
<head>
<meta charset="utf-8">
<title>文汇建站</title>
<style>
ul li{ width:300px}
ul li span{ float:right}
</style>
</head>
<body>
<ul>
<li>陕西省陕西省陕西省<span>2017-4-28</span></li>
<li>陕西省<span>2017-4-28</span></li>
<li>陕西省陕西省<span>2017-4-28</span></li>
<li>陕西省<span>2017-4-28</span></li>
</ul>
</body>
</html>
按我的来 保证没有问题 不用写什么margin移位这种来画蛇添足了浏览器全面兼容
我发现你的页面在firefox有移位哦 注意标准写法
<!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>
<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />
<title>无标题文档</title>
<style>
ul li {
margin:0
padding:0
width:500px
line-height:25px
}
a {
color:#000
}
a:hover {
color:#666
}
li a {
width:800px
background:#f00
display:inline-block
}
li a span {
width:400px
background:#0f0
display:inline-block
float:left
}
li a span.l {
width:200px
background:#0f0
display:inline-block
float:right
}
</style>
</head>
<body>
<div style="height:700px"><img src="3.10湖南检察院.jpg" width="300" height="300" style="float:left"/>
<ul style="list-style:nonepadding:0margin:0width:500pxheight:500pxfloat:leftmargin-left:20px">
<li><a href="#"><span>奥巴马就职后对中国持敌对态度,中国高层很懊恼!</span><span class="l">2009-08-08</span></a></li>
<li><a href="#"><span>奥巴马就职后对中国持敌对态度,中国高层很懊恼!</span><span class="l">2009-08-08</span></a></li>
<li><a href="#"><span>奥巴马就职后对中国持敌对态度,中国高层很懊恼!</span><span class="l">2009-08-08</span></a></li>
<li><a href="#"><span>奥巴马就职后对中国持敌对态度,中国高层很懊恼!</span><span class="l">2009-08-08</span></a></li>
<li><a href="#"><span>奥巴马就职后对中国持敌对态度,中国高层很懊恼!</span><span class="l">2009-08-08</span></a></li>
</ul>
</div>
</body>
</html>