【发布时间】:2014-10-04 20:07:01
【问题描述】:
好吧,我在玩 CSS,但我想做一些我想做的事情,但我做不到;我不知道该怎么做。见,this is the website I'm testing。如果您看到条目标题,它们有黑色背景。但是我想让这个背景占据整个空间,像这样:See the photo.
我需要什么代码?
【问题讨论】:
好吧,我在玩 CSS,但我想做一些我想做的事情,但我做不到;我不知道该怎么做。见,this is the website I'm testing。如果您看到条目标题,它们有黑色背景。但是我想让这个背景占据整个空间,像这样:See the photo.
我需要什么代码?
【问题讨论】:
这应该可以解决问题: 负边距放大黑框,填充保持文本回到原来的位置。
这样做有点脏,但这是最短的解决方案。
只需将其添加到 CSS 代码的末尾即可:
#contentmiddle div.title > h1{
margin-left: -40px;
margin-right: -40px;
margin-top: -40px;
padding: 50px;
padding-bottom: 30px;
}
或者更短的:
#contentmiddle div.title > h1{
margin: -40px;
padding: 50px;
margin-bottom: 20px;
padding-bottom: 30px;
}
【讨论】: