1
我正在開發一個應用程序,並且在覆蓋background-position
屬性時遇到了一些問題。在應用程序中,我將font-size-big
類添加到html
元素以增加字體大小。這樣做,我的自定義下劃線圖像的位置變得很低。下劃線現在浮在鏈接文本上。如何用父級.class屬性覆蓋子元素屬性
我想達到的目標是爲每個字體大小的類(font-size-big,font-size-small,font-size-medium)設置不同的background-position
。看來我不能選擇a
元素,這取決於html
元素類。
HTML:
<html class="font-size-big">
<head></head>
<body class="article">
<section class="links">From <a href="http://foo.bar">Steven</section>
</body>
</html>
SCSS:
.font-size-big {
font-size: ($basic-fontsize * 1.2) + rem;;
}
.links {
color:$grey;
font: {
family:$fontTextItalic;
size: $basic-fontsize;
}
a {
color:$grey;
text-decoration: none;
background: url(/assets/images/article/dottedLinkUnderline_grey.png) repeat-x 0 23;
}
}
謝謝您的時間。我真的被困在這一個。
非常感謝你,這個技巧。我使用了'background-position:0 1rem',這同樣適用。 – stekhn