1

我想在我的 div 之间添加一个空格。

我尝试添加 1 个 div,然后使用 CSS 中的属性,如 margin-top、padding-top 等......我可以在互联网上找到的所有其他东西。唯一增加空间的是当我使用 margin-top:2000px 或更多...

这给了我一个可怕的巨大空间。div 是空的,里面什么都没有。

有人可以告诉我如何在 2 个 div 之间添加一些垂直空间吗?谢谢。

4

3 回答 3

5

有些浏览器不喜欢显示空标签。尝试在里面添加句号或粘性空间。粘性空格是浏览器显示为空格的代码。只需输入   在您的间隔 div 内,但分号前没有空格。
或者,您可以使用中断标签 (<br>) 来填充空间,或者使用设置为所需高度的透明间隔图像。

于 2013-05-25T21:07:22.010 回答
1

使用边距、填充或在它们之间放置一个具有一定高度的块元素。但是如果没有看到您的代码,很难说出为什么 margin-top: 2000px 只为您工作。

于 2013-05-25T21:06:00.207 回答
0

This solved my problem using div as blank space. Just create a blank div with padding and some attributes that might help you.

.yourBlankSpaceDivClass {
   padding: 20px 30px; // blank div(or blank space) height and width. Depends on you.
   position: absolute; // so that you can place the blank div(or blank space) wherever you want it. Make sure you have a "position: relative;" div. Absolute div must be inside a Relative div.
   top: 0; // Depends on you.
   left: 0; // Depends on you.
}
于 2020-05-13T05:18:38.143 回答