gpt4 book ai didi

javascript - Tumblr 帖子在两种不同颜色之间循环

转载 作者:太空宇宙 更新时间:2023-11-03 20:14:12 24 4
gpt4 key购买 nike

我想使特定帖子周围的容器与相邻的容器颜色不同。基本上,容器只需要在两种不同颜色之间循环。

Left is current, right is what I require

左边是当前的样子,右边是我想要的样子。谢谢!

CSS

#content {
float:left;
width:800px;
padding:25px;
top:-50px; left:45px;
background:transparent;
{block:PermalinkPage}
width:300px;
{/block:PermalinkPage}
}

.entry {
width:150px;
margin:50px;
overflow:hidden;
background:#336136;
margin-left:-12px;
margin-bottom: -10px;
padding:12px;
{block:PermalinkPage}
width:250px;
margin-left:40px;
{/block:PermalinkPage}
}

.entry:nth-child(odd) {
background: #000;
}

HTML

<div id="content">
{block:Posts}
<div class="entry">

{miscellaneous_blocks_here}

</div>
{/block:Posts}
</div>

最佳答案

为什么不使用 CSS3 选择器并放弃 javascript 舞蹈?

.entry:nth-child(odd) {
background: #000;
}

.entry:nth-child(even) {
background: #ff003d
}

浏览器支持:http://caniuse.com/css-sel3

关于javascript - Tumblr 帖子在两种不同颜色之间循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24658949/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com