iframe 自适应高度 宽度 全css 实现 无 javascript
<html>
<body style="margin:0;">
<div>
<table style="width:100%;height:100%" cellpadding='0' cellspacing='0'>
<tr>
<td style="width:120px;background-color:Red">
<iframe id="MU" name="MU" style="position:absolute;top:auto;bottom:0px;height:100%;left:auto;right:0px;width:100%">
</iframe>
</td>
<td style="background-color:Yellow">
<iframe id="WA" name="WA" style="position:absolute;top:0px;bottom:0px;left:120px;right:0px;width:100%;height:100%"
src="about:blank">
</iframe>
<div >a</div>
</td>
</tr>
</table>
</div>
</body>
</html>
注: position:absolute;top:auto;bottom:0px;height:100%;left:auto;right:0px;width:100%
去掉top:auto;bottom:0px;height:100%;为宽度自适应
去掉left:auto;right:0px;width:100%为高度自适应
相关文档:
静态定位:position:static(为position属性的默认值)。
动态定位:position:relative或position:absolute或position:fixed。
祖元素:任意包含该元素的元素。 父元素:直接包含该元素的祖元素。 同辈元素:拥有共同的父元素的元素。
注:这些概
念为作者 ......
自己总结的心得:
1:在css设计中,当图片不够宽时,这时可以考虑使用背景颜色(与该图片相似的颜色)来补充。
2,在css设计中,可以使用图片的背景色向网页的背景色过渡
如图:
具体参照《精通JavaScript+Jquery》3-20.html ......
当连续输入英语字符后,由于浏览器默认为一个单词,并不会换行处理,在IE6/IE7 中,我们可以添加css中的word-wrap 属性,实现自动换行。但是在IE8 版本中,该属性不支持。
我们可以采用判断浏览器版本后,使用JavaScript进行换行。
if ($.br ......
第一种,是CSS HACK的方法
height:20px; /*For Firefox*/
*height:25px; /*For IE7 & IE6*/
_height:20px; /*For IE6*/
注意顺序。
这样也属于CSS HACK,不过没有上面这样简洁。
#example { color: #333; } /* Moz */
* html #example { color: #666; } /* IE6 */
*+html #example { color: #999; } /* IE7 */
......