解决IE 不居中问题

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <meta http-equiv="Content-Type" Content="text/html; charset=utf-8;">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
  <script type="text/javascript" src="http://www.putclub.com/images/jquery-1.4.0.min.js"></script>
 </HEAD>

 <BODY>
 
 <style type="text/css">
	body { font-size: 14px; text-indent: 40px; line-height: 30px; margin: 0 0 ; padding: 0 0; 
		   
	}
	#left { width: 100%; background-color: #D7E7F7;  margin: 0 auto;}
	#main { width: 60%; margin: 0 auto;  display: block; }
	#viewall {color: blue; }
	#fade {margin-top: 50px; margin: 0 auto;}
 </style>
 
 <script type="text/javascript">
	$(document).ready(function(){
		$('#left').hide();
		$('#wenzi').hide();
		$('#viewall').toggle(function(){
			$('#left').slideDown();
			$(this).text('隐藏');
		},
		function(){
			$('#left').slideUp();
			$(this).text('查看余文');
		}
		);

		$('#viewme').click(function(){
			$('#wenzi').fadeIn(8000).show();
		});
	});
 </script>

<div id="main">	
 Do they? Everybody thinks they know because of science fiction.But where do they really come from?

They come from stars. A black hole is what you get when a really big star uses up all its fuel. Gravity is always trying to push all the stuff that makes up a star into its center.<span id="viewall">查看余文</span>
<div id="left">
But as long as the star has enough nuclear fuel in its core to keep burning, it pushes back. It’s only when it runs out of fuel that everything gets crushed down into the middle of the star.

If the star is big enough, gravity just keeps squeezing and squeezing until everything that made up the star is compressed into a tiny point.
</div>


<div id="fade">
<input type="button" id="viewme" value="从不透明到透明查看" /><br/>

<div id="wenzi">
And get this — the gravitational attraction of that tiny point will be so strong anything that comes too close will be sucked in, never to return! Not even light can escape. Even a passing beam of light will be pulled right in.
</div>

</div>

</div>



 </BODY>
</HTML>



由于 新建标准html的时候 只有 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

而在代码中 div css  设置成  width: 60% ; margin: 0 auto在firefox 中可以居中 而在IE  下不居中

把doctype  更改为

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

就可以了。

http://topic.csdn.net/u/20110928/17/2014c9c9-1d6a-4e07-bb8c-5655e07d0a88.html





评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值