假设我有一些HTML,如下所示:
<div id="non-adjustable">
<a id="adjustable-a" href="example.html">
<div id="adjustable-div">Button</div>
</a>
</div>然后我有一个样式表,上面有一些精彩的动画,我想把它们添加到#non-adjustable div中。
Limitations/Requirements:
#non-adjustable div的HTML,所以我不能向这个div添加一个类。#non-adjustable div (#adjustable-a和#adjustable-div)下编辑#non-adjustable。基本上,如果这是件事的话,我会想要这样做:
<style type="text/css">
#non-adjustable(.fantastic-animation) {
/*Other Declarations*/
}
</style>但要么不行,要么我做错了。还有人有其他的想法吗?
发布于 2015-07-06 03:01:10
您可以使用“前”和“后”伪元素,并对它们进行样式设置以满足您的需要。
http://www.smashingmagazine.com/2011/07/13/learning-to-use-the-before-and-after-pseudo-elements-in-css/
这是大多数字库所做的..。它们在样式表中创建伪元素,并设置背景图像、对齐等。
https://stackoverflow.com/questions/31237170
复制相似问题