Heim >Web-Frontend >HTML-Tutorial >父元素设置overflow:hidden对定位元素也有效_html/css_WEB-ITnose

父元素设置overflow:hidden对定位元素也有效_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 11:27:481810Durchsuche

父元素设置overflow:hidden对定位元素也有效:
如果父元素使用overflow:hidden,那么定位的子元素也会受到影响。
代码实例如下:

<!DOCTYPE html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style>#box{  width:200px;  height:100px;  background:#999;  position:relative;  overflow:hidden;}#inner{  width:100px;  height:100px;  background:#F00;  position:absolute;  top:50px;}</style></head><body><div id="box">  <div id="inner"></div></div></body></html>

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=16795

更多内容可以参阅:http://www.softwhy.com/divcss/

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn