简体   繁体   English

Angular PrimeNG列表框十字标签

[英]Angular PrimeNG listbox cross label

I'm using angular 7.2.0 and primeng 7.0.0, i'm trying to show a list of elements in a listbox. 我正在使用angular 7.2.0和primeng 7.0.0,我试图在列表框中显示元素列表。

How can i cross the label of the selected element on the list instead of highlighting it 我如何跨列表中所选元素的标签而不是突出显示它

在此处输入图片说明

My advice would be to try and inspect the element you are trying to modify using the browser's DevTools (play in the Style section until you reach the desired result) and then change it in your code. 我的建议是尝试使用浏览器的DevTools检查要修改的元素(在“样式”部分中播放,直到获得所需的结果),然后在代码中进行更改。

As for the question, you want to remove the background for the selected state of the list item and then give the line-through text-decoration property. 对于问题,您要删除列表项所选状态的背景,然后提供直通文本装饰属性。 This should be the CSS part to solve your issue with the right selectors: 这应该是CSS部分,以使用正确的选择器解决您的问题:

body .ui-listbox .ui-listbox-list .ui-listbox-item.ui-state-highlight {
    color: #000000;
    text-decoration: line-through;
    background-color: none;
}

Please note that the text color is changed to be visible after we remove the blue background. 请注意,移除蓝色背景后,文字颜色将更改为可见。 This is only for the highlighted state of a list box item ( .ui-listbox-item.ui-state-highlight ). 这仅适用于列表框项目的突出显示状态( .ui-listbox-item.ui-state-highlight )。

  • If you are not sure how to use the inspect tool, please check this quick tutorial provided by Google developers. 如果你不知道如何使用工具进行检查,请查看由谷歌开发商提供的快速教程。 Hope this can be of any help 希望这会有所帮助

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

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