<分区>
关闭 7 年前。
- 这个问题是由于打字错误或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这个问题的解决方式不太可能帮助 future 的读者。
- 编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
标签 javascript html css padding
<分区>
关闭 7 年前。
我目前有一个显示图表的 div。在我的 HTML 页面中,我给它的 ID 是“main”。在我的 CSS 中,我试图让图表在页面中更靠上一点,但是遇到了问题。我目前有一个边界,正在尝试将图表带到边界。换句话说,我不想在 div 和边框顶部之间有任何填充/空间。这是它现在的样子:
这是我的 CSS 代码现在的样子:
#main {
position:relative;
width:95%;
left:3%;
border: 3px solid green;
padding-top: 0px;
}
如有任何帮助,我们将不胜感激。谢谢!
最佳答案
尝试将负 marging
或负 top
应用到您的图表容器...
例如:
#main {
position:relative;
width:95%;
left:3%;
border: 3px solid green;
padding-top: 0px;
top:-20px
}
或
#main {
position:relative;
width:95%;
left:3%;
border: 3px solid green;
padding-top: 0px;
margin-top:-20px;
}
关于javascript - 如何删除边框顶部和 div 之间的间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32234302/