【发布时间】:2013-06-09 22:30:04
【问题描述】:
我必须从某个位置开始背景颜色,而不是申请整个元素。
html
<p class="tax-free-keksis">text here text here text here text here text here text here text here text here text here text here text here text heretext here text here</p>
css
p.tax-free-keksis {
background-image: url(http://tax.allfaces.lv/templates/tax/images/poga_keksis.png);
background-position: left center;
background-repeat: no-repeat;
background-color: #c2e8fb;
padding-top: 15px;
padding-left: 50px;
padding-right: 10px;
text-align: left;
}
jsfiddle 链接:http://jsfiddle.net/MVST6/
我需要 background-color: #c2e8fb 从左边开始大约 50 像素(这样复选标记图像背景是白色而不是蓝色)。
我认为我不能以某种“正常”的方式定位背景颜色。在这里我需要一些我不知道的修复,因为我不是 CSS 开发人员而且我是设计网页的新手。
【问题讨论】:
-
我认为 CSS 伪选择器
:before和:after将有助于实现这一目标,请查看。
标签: css background-color