如何根据应用于对象的文本应用CSS覆盖?

问题描述 投票:0回答:1

我正在使用一个我无法更改/配置的平台(Salesforce的社区云),因此为了改变UI,我需要应用CSS覆盖。

在UI中,在问题详细信息页面上(仅显示父帖子和所有相关回复),它:1)截断对前几行的每个回复2)提供“显示更多”或“展开更多”可点击文本以展开这篇文章

我想仅在应用于对象的文本满足特定条件时才覆盖,这可能吗?

我已经使用了这个覆盖,它可以工作,但全局应用于对象

/* Hides the .cuf-more object */
.forceChatterFeedBodyText .cuf-more {display:none !important;}
/* when this .cuf-more object is hidden, I want to override a max-height variable and show all of what is there */
.forceChatterFeedBodyText .feedBodyInnerTruncated {max-height:100% !important;}

我不希望它应用于对象的每个实例,只有在子规范是应用/使用的文本的情况下:

用于此条件(文本为“显示更多”):

<a tabindex="0" href="javascript:void(0);" title="Show more text" class="cuf-more fadeOut">
<div class="">Show More</div></a>

请勿使用此文本(文本为“Expand Post”):

<a tabindex="0" href="javascript:void(0);" title="Show more text" class="cuf-more fadeOut">
<div class="">Expand Post</div></a>
css override
1个回答
0
投票

您可以在每种情况下设置特定的类名称标识符。

例如:

<div class="show-more">Show More</div>
<div class="expand-post">Expand Post</div>

然后,您可以在CSS中查询类名

.show-more {

}

.expand-post {

}
© www.soinside.com 2019 - 2024. All rights reserved.