我的css
职位有问题。例如,当我在元素上设置position absolute
时,它们会在页面上获得空间但是不会显示。我的代码如下所示(我在我用过的一些旧的tabb框上做过)。希望有人知道解决这个问题,任何帮助都会非常感激!
$(".tabBoxContainer").css({
"position": "absolute",
"top": "50px",
"float": "none",
"z-index": "100"
});

#tabBoxContent {
position: relative;
top: 50px;
overflow: auto;
}
.tabBoxContainer {
position: relative;
float: left;
color: #232323;
}
.fixedTabContent {
position: absolute !important;
top: 50px !important;
left: 0 !important;
}
.tabBoxArticle {
float: left;
width: 33%;
box-sizing: border-box;
padding: 10px;
}
.tabBoxArticle img {
width: 90%;
}
.tabBoxArticle h1 a {
color: #222 !important;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<section id="tabBoxContent">
<div class="tabBoxContainer" id="tabBoxHTML">
<div class="tabBoxArticle">
<img src="img/juneca-rebra.jpg" alt="">
<h1><a href="#">Lorem ipsum dolor sit amet</a></h1>
</div>
<div class="tabBoxArticle">
<img src="img/jaja-sa-sunkom.jpg" alt="">
<h1><a href="#">Lorem ipsum dolor sit amet</a></h1>
</div>
<div class="tabBoxArticle">
<img src="img/keciga.jpg" alt="">
<h1><a href="#">Lorem ipsum dolor sit amet</a></h1>
</div>
</div>
<!-- /#tabBoxContainer -->
<div class="tabBoxContainer" id="tabBoxCSS">
<div class="tabBoxArticle">
<img src="img/piletina-na-mlimarski-nacin.jpg" alt="">
<h1><a href="#">Somme dummy long article title</a></h1>
</div>
<div class="tabBoxArticle">
<img src="img/pohovana-paprika.jpg" alt="">
<h1>Somme dummy long article title</h1>
</div>
<div class="tabBoxArticle">
<img src="img/pohovani-sir.jpg" alt="">
<h1>Somme dummy long article title</h1>
</div>
</div>
<!-- /#tabBoxContainer -->
<div class="tabBoxContainer" id="tabBoxJQuery">
<div class="tabBoxArticle">
<img src="img/rriblji-paprikas.jpg" alt="">
<h1>Dummy long article title</h1>
</div>
<div class="tabBoxArticle">
<img src="img/sat1.jpg" alt="">
<h1></h1>
</div>
<div class="tabBoxArticle">
<img src="img/satova-zakuska.jpg" alt="">
<h1>Dummy long article title</h1>
</div>
</div>
<!-- /#tabBoxContainer -->
</section>
<!-- /#tabBoxContent -->
&#13;
我还尝试添加jquery
类,但在设置绝对时它不会显示它。
答案 0 :(得分:1)
你的#tabBoxContent
CSS打破了它。如果删除overflow: auto
,则应该再次显示绝对定位的元素。
然后,根据您的问题,或者您为什么首先将overflow: auto
置于其上,并不是很明显您正在努力实现的目标。