Home  >  Article  >  Web Front-end  >  父元素设置overflow:hidden对定位元素也有效_html/css_WEB-ITnose

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

WBOY
WBOYOriginal
2016-06-24 11:27:481748browse

父元素设置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/

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn