CSS定位问题

标签 css

我目前正在研究这个 page当它最初加载时,幻灯片缩略图将位于它们应该位于的位置,但稍后会下降。我试过从

.pika-thumbs {
    width: 995px;
    margin-left: 55px;
} 

.pika-thumbs {
    width: 995px;
    margin-left: 55px;
    position: relative;
    top: -150px;
    Z-index: 999;
}

它正好停留在我想要它停留的位置,但是当我删除整个 CSS 之类的东西时,空间会停留并消失。

最佳答案

你在 relative 之后忘记了你的分号:

.pika-thumbs {
    width: 995px;
    margin-left: 55px;
    position: relative;
    top: -150px;
    z-index: 999;
}

编辑:

and it stayed exactly where I wanted it to stay but the space stays and goes away when I remove the whole like of CSS.

这就是使用负值的 position: relative 和 top 的实际情况。尝试 margin-top: -150px; 而不是 top

关于CSS定位问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12061950/

相关文章:

html - 导航栏,列表项之间的可见空间

html - 滚动元素上的边框半径

jquery按长度限制文本

html - 传单JS : How to flip tiles vertically on-the-fly?

html - 试图在 twitter bootstrap 2.3.2 行/跨度中对齐三个图像

html - 如何设置<select>的高度

javascript - Jquery/Javascript 和 Css 条件不适用于 firefox 和 IE。它适用于 Chrome

css - 如何让 Bootstrap 列跨越多行?

javascript - 当前 View 的位置

javascript - 如果找到重复的 <a> 标签,则删除 Li