我正在用rails.
编写应用程序我对css还不是很熟悉。虽然,我在努力。而且有一个问题,我的生成HTML标签在css帮助下缩进生成的html div类
<div class="sub-product post-1">
// content goes here
</div>
<div class="sub-product post-2">
// content goes here
</div>
<div class="sub-product post-3">
// content goes here
</div>
<div class="sub-product post-4">
// content goes here
</div>
现在,你可以看到布置为post
有不同的号码。我试图做的是向他们展示缩进,这里是我的CSS
.sub-product.post-1 {
margin:30px
}
它的工作原理,但如果我让.sub-product.post-1.post-2.post-3.post-4
它只表示缩进。我想我知道这里错了什么,但是什么是一个优雅的解决方案来显示它们缩进?
谢谢
我想对不同的帖子类型应用不同的边距。 Post-1从开始缩进30px。后2 30多等等,直到4后。 – psharma
我已更新帖子。希望能帮助到你! – leoMestizo
是的,它确实有帮助。有没有其他的方式(更干净的方式来做到这一点)? – psharma