是否可以在CSS3背景上附加其他类/样式?
|
今天,我了解到CSS3支持多种背景,这非常棒。
我真正想要的是能够动态合并多个背景的功能,例如:
.Watermarked{
background: url(\'text/logo.png\') bottom right no-repeat;
}
HTML:
<div class=\"Watermarked\"
style=\"background:url(\'photos/very_pretty_sunset.jpg\') 0 0 no-repeat;\">
...
以某种方式产生计算出的样式:
background: url(\'text/logo.png\') bottom right no-repeat,
url(\'photos/very_pretty_sunset.jpg\') 0 0 no-repeat;
当然,我可以对额外的背景样式进行硬编码或使用jquery添加它。我正在寻找那种纯净的纯CSS解决方案。
已回答
接受纯CSS答案的三十点-“您不能\”。
值得强调的是,如果您使用的是SASS(Rails 3.1等),则硬编码的样式可以通过变量使用变得更可口:
$watermarkImage: url(\'text/logo.png\') left top no-repeat;
...
#very_pretty_sunset{
background: $watermarkImage, url(\'photos/very_pretty_sunset.png\') right bottom no-repeat;
}
没有找到相关结果
已邀请:
3 个回复
降女陷费券
哩翔购
粱委教
= img的宽度-
img宽度 div的
= img的高度-
img高度
img高度=
img宽度=
您的边框图像必须是透明的(明显的) 的CSS
替代 前提条件
= logo.png高度
= logo.png宽度 您的边框图像必须是透明的(可选) 的CSS