懂得放弃,才会有新的收获!

再谈firefox 、IE下 height 高度

By weisnet On 2009-05-04 At 20:34 View:869

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head>
  <title>Viewresume</title>
  <LINK href='CommandStyle.css' type="text/css" rel="stylesheet">
  <LINK href='resume.css' type="text/css" rel="stylesheet">
 </head>
 <body>
  <form id="Form1" method="post" runat="server">
   <div id="TopPage">
    <div class="TopPage_left">
     <img src="../../cvs/logo/logo.jpg?t=2.0" alt="" border="0" align="left" height="60">
    </div>
    
   </div>
  </form>
 </body>
</html>

 

CommandStyle.css 页面是这样的

body,td {font-size:12px;text-align:center;margin:0px auto; overflow-y:scroll !important; overflow-y:hidden;}
td {padding:1px !important;padding:0px;}
td input {height:16px;}
a:link {color:#000000;text-decoration:none}
a:visited {text-decoration:none;color:#000000}
a:active {text-decoration:none;color:#000000}
a:hover {color:#3366FF;text-decoration:underline}

p {margin:3px auto;}

 

resume.css 页面是这样的

* {margin:0px;padding:0px;border:0px solid #fff;}
body {width:780px;}
#TopPage {width:780px;height:100%;background:#fff;border:2px solid green; margin:0px;padding:0px;float:left;}
#TopPage .TopPage_left
{
 width:200px;height:60px;float:left;padding:0px;margin:0px;

}

 

我们主要看 resume.css 的 CSS

这里IE都是比较正常的

 

在FF出现问题比较多. 要使得每个div在FF里面能自适应height; 要用到height:100%;float:left 

也有使用oveflow:auto配height:100%;但在FF会出现滚动条, 比较难解决.

 

height:100%;float:left这样使用时,如果DIV里面有图片或其他元素或容器,一定要设定他的高度(HEIGHT). 不然图片会溢出来. 与div 重叠.(而且与div之间会有空隙.)

 

在IE下 <img >要加个align="left"或align="middle";不然div 里会有小空隙.

 

 

当div 不是全屏时, 但在FF下又要自适应,又要居中. body {width:780px;}要设定,当然大小可自己控制.

因为要用到float:left;

·上一篇:javascript 版 hashtable
·下一篇:c# 中 '常数中有换行符' 错误

for this post

 
 

Leave a Reply

赶快抢个沙发坐坐!
请先 登陆  还没帐号

Hot Posts Powered by weiseditor

  • Add to Google

Friend links