为什么用div设置背景的时候左边和上面会有1像素的空白?_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:08:07
Original
2084 people have browsed it

不知道怎么回事,在div里面设置背景后背景会有1个像素的空白
.container {	display: block;	float: left;	background:url(../images/body-bg.jpg) no-repeat;	margin: 0px;	width: 100%;	height: 100%;	position: fixed;	}
Copy after login


回复讨论(解决方案)

body{padding:0px;margin:0px;}

*{paddinf:0px;margin:0px;}

因为bady的margin的值默认是2px; 所以要在CSS里面声明body{padding:0px;margin:0px;}

原来是这样啊...谢谢

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!