IE双倍边距的问题 :body{margin:0;}

                           div{float:left;margin-left:10px;width:200px;height:200px;border:1px solid red;display:inline;}

div浮动后display:一定要设为inline;

一般我们设置顶部风格为:

body{margin:0;padding:0;border:0;}

image 在IE中是有边框的。

1、如何定义高度很小的容器? 

在IE6下无法定义小高度的容器,是因为有一个默认的行高。  列举2种解决方案:overflow:hidden | line-height:0 

4、文本垂直方向对齐文本输入框? 

设置input为vertical-align:middle,textarea也是如此 

5、为什么在web标准下ie无法设置滚动条的颜色? 

将设置滚动条颜色的样式定义到html标签选择符上即可

7、如何使得文字不换行? 

定义包含文字的容器为:width:xxx;white-space:nowrap; 

8、ie中如何让超出宽度的文字显示为省略号? 

定义容器为:overflow:hidden;width:xxx;white-space:nowrap;text-overflow:ellipsis; 

9、如何在点文字时也选中checkbox? 

<input id="test" type="checkbox" value="on" /> <label for="test">测试 </label> 

10、一个div为margin-bottom:10px,一个div为margin-top:5px,为什么2个div之间的间距是10px而不是15px? 

这种情况浏览器会自动进行margin重叠,只显示较大的margin值  解决方案:只设置其中一个div的margin为15px 

11、如何解决ie下当li中出现2个或以上的浮动时,li之间产生的空白间隙? 

设置li的vertical-align,值可以为top | text-top | middle | bottom | text-bottom 

12、如何使得英文单词不发生词内断行? 

word-wrap:break-word; 

13、为什么被访问过的链接颜色没有变化? 

定义链接的样式时,需要按照:link,:visited,:hover,:active这样的顺序,可以使用LoVe HAte(喜欢讨厌)来记忆 

14、单行文本如何垂直居中? 

height:xxx;line-height:xxx; 高和行高相同即可 

15、已知高度的容器如何在页面中水平垂直居中? 

参阅:http://blog.doyoe.com/article.asp?id=74 

16、未知尺寸的图片图如何水平垂直居中? 

参阅:http://blog.doyoe.com/article.asp?id=159 

17、标准模式和怪异模式下的盒模型区别? 

标准模式下:实际宽度 = width + padding + border  怪异模式下:实际宽度 = width - padding - border 

19、如何做1像素细边框的table? 

方法1:设置table的border-collapse:collapse;  <style type="text/css">  table{border-collapse:collapse;border-color:#000;}  td{border-color:#000;}  </style>  <table cellspacing="0" cellpadding="0" border="1">  <tr>  <td>测试 </td>  <td>测试 </td>  </tr>  </table> 

方法2:关键在于设置cellspacine="1",用间隙来作为边框  <style type="text/css">  table{background:#000;}  tr{background:#fff;}  </style>  <table cellspacing="1" cellpadding="0" border="0">  <tr>  <td>测试 </td>  <td>测试 </td>  </tr>  </table> 

22、如何去掉链接的虚线框? 

IE下: <a href="#" onfocus="this.blur();"...>  FF下:a{outline:none;} 

23、如何使得页面字体行距始终保持n倍字体大小为基调? 

在body内设置line-height:n即可,注,不可以为它加上单位  原因可参阅:http://blog.doyoe.com/article.asp?id=195 

24、

如何解决按钮在IE7及更早浏览器下随着value增多两边留白也随着增加的问题?

方法:

 

input,button{overflow:visible;}

posted on 2013-08-08 15:48  javascript程序员  阅读(227)  评论(0编辑  收藏  举报