Home > Web Front-end > HTML Tutorial > 子级div使用了margin-top,连父级div都应用到了?_html/css_WEB-ITnose

子级div使用了margin-top,连父级div都应用到了?_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:39:26
Original
1197 people have browsed it

本帖最后由 phf0313 于 2011-10-21 12:27:24 编辑

<div class="qiandao">        	<div class="qd_circle">            	            </div>        </div>
Copy after login

.qiandao {	width:210px;	height:267px;	background:url(http://192.168.1.3/image/my_qd_bg.jpg) no-repeat;}.qd_circle {	border:1px solid #d0ccc3;	width:196px;	height:35px;	margin-top:6px;	margin-left:5px;	}
Copy after login

qd_circle用了margin-top,但是qiandao也被撑下来了,求解?

回复讨论(解决方案)

恩 如果 父标签有边框的 话 在有些浏览器中直接把边框干断 用padding   子标签用padding不方便那就用在父标签上,  

.qiandao {
    width:210px;
    height:267px;
    background:url(http://192.168.1.3/image/my_qd_bg.jpg) no-repeat;
overflow:hidden
}
.qd_circle {
    border:1px solid #d0ccc3;
    width:196px;
    height:35px;
    margin-top:6px;
    margin-left:5px;    
}

google 垂直边距叠加/压缩

父div设置overflow:hidden就可以

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template