Maison > interface Web > tutoriel HTML > IE6下怎么实现height:100%;width:100%;四周空10px,父div的clientheight不变,急_html/css_WEB-ITnose

IE6下怎么实现height:100%;width:100%;四周空10px,父div的clientheight不变,急_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Libérer: 2016-06-24 12:11:05
original
1090 Les gens l'ont consulté

IE6下怎么实现height:100%;width:100%;四周空10px,父div的clientheight不变,急!!!!

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



无标题文档






  
dfd






回复讨论(解决方案)

<!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/html; charset=utf-8" /> <title>无标题文档 </title> <style> *{margin:0px;padding:0px} .div1{width:300px;height:300px;background:#aacc00;} .div2{background:#aaccff;} /*---------IE7/IE8其他浏览器-------------*/ .div1{position:relative} .div2{position:absolute;top:20px;left:20px;right:20px;bottom:20px;}  /*---------IE6-------------*/ .div1{_padding:20px;} .div2{_height:expression(div1.clientHeight-40);_width:100%;}</style> </head> <body> <div class="div1" id="div1">  <div class="div2">dfd </div> </div> </body> </html>
Copier après la connexion

楼上很全面

如果你的div1是可知宽高的,那么你可以这样

.div1 { width:260px; height:260px; padding:20px; background:#aacc00; }
.div2 { height:100%; background:#aaccff; }

如果div2的内容可能会比规定高度高,那么可能还需要配合overflow。

另,当你有

的时候,不用单独为ie6写样式

参照楼上给出的方法

呵呵.看看.

JF

网络终于通了,期待各位的答案很久了,

很感谢hookee,ddcatlee;
因为div的高度是未知的,所以借鉴了hookee的答案,问题解决了,

还要回复啊!

回复还要回复可见吗?

Copier après la connexion
Copier après la connexion
Copier après la connexion


Copier après la connexion
Copier après la connexion
Copier après la connexion






js编写在网页中运行代码效果 - 懒人源码(www.lrcode.com)













Copier après la connexion
Copier après la connexion
Copier après la connexion

Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal