CSS将Div标签放在页面顶部,没有空格 [英] CSS Put Div Tag at top of page without space
本文介绍了CSS将Div标签放在页面顶部,没有空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在页面顶部放上一个带有wrapper的div标签,但问题是
,在div标签包装器是黄色之间有一个空格。
和页面顶部。
I want to put a div tag with id "wrapper" at top of page, but the problem is
that there is a white space between the div tag "wrapper is yellow color"
and the top of page.
我的问题是如何删除div标签和页面顶部之间的空格?
My question is how can I remove the white space between the div tag and the top of page?
这是我的代码
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
body {
margin: 0;
padding:0;
}
#wrapper {
width:1000px;
text-align:center;
margin-right:auto;
margin-left:auto;
margin-top:0px;
background-color: yellow;
padding:0px;
}
</style>
</head>
<body>
<div id="wrapper">
Testing
</div>
</body>
</html>
推荐答案
在css代码中尝试:
{
position:absolute;
top:0px;
}
您可以使用 right
或 left
以在div和角落之间创建一个空格
You can use the right
or left
to make a space between the div and the corner
这篇关于CSS将Div标签放在页面顶部,没有空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文