简体   繁体   English

滑块行高 CSS

[英]slider line height CSS

I want to reduce the text size of the top left slider from the linked page .It is set to H2 on default and I can't figure a way to change it.我想减小链接页面左上角滑块的文本大小。默认设置为 H2,我想不出改变它的方法。 The text size is too big for it and it looks stupid.文字大小对它来说太大了,看起来很愚蠢。 I tried with the CSS below, but it only reduces the text size, unfortunately the spacing between the lines and words stays like in H2, which doesnt look appropriate either.我尝试使用下面的 CSS,但它只会减小文本大小,不幸的是,行和单词之间的间距保持在 H2 中,这看起来也不合适。 Please help!请帮忙!

.fusion-flexslider.flexslider-posts .slide-excerpt h2 a {
    color: #fff;
    font-size: 20px !important;
    line-height: 0.5 !important;
}

It's because the <a> derives font-related styling from the <h2>这是因为<a><h2>派生出与字体相关的样式
Try this selector .fusion-flexslider.flexslider-posts .slide-excerpt h2 , it works for me https://prnt.sc/v52pmy试试这个选择器.fusion-flexslider.flexslider-posts .slide-excerpt h2 ,它对我.fusion-flexslider.flexslider-posts .slide-excerpt h2 https://prnt.sc/v52pmy

If you set the a element style to include display: inline-block the element will then use the CSS styling you are giving it (though I guess you probably want to set line-height back to normal rather than try 0.5).如果您将 a 元素样式设置为包含display: inline-block元素将使用您提供的 CSS 样式(尽管我猜您可能希望将 line-height 设置回正常而不是尝试 0.5)。 I have tested this on your site using browser dev tools.我已经使用浏览器开发工具在您的网站上对此进行了测试。

The reason is (to me) a quite complex one - why it doesn't work as you might expect on inline blocks.原因(对我来说)是一个相当复杂的原因 - 为什么它不能像您期望的那样在内联块上工作。 An explanation is given at https://stackoverflow.com/questions/22816123/why-cant-you-set-line-height-on-an-anchor-element-with-a-background https://stackoverflow.com/questions/22816123/why-cant-you-set-line-height-on-an-anchor-element-with-a-background给出了解释

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM