简体   繁体   English

覆盖内联CSS样式

[英]Override an inline CSS style

I'm using Twitter's typeahead script to autosuggest with my search form. 我正在使用Twitter的预输入脚本来自动建议我的搜索表单。 However, the script generates its own CSS styles, which I can't seem to override. 但是,脚本会生成自己的CSS样式,我似乎无法覆盖它。 You can see the problem here: http://bahcalculator.org/dev/nano.php . 你可以在这里看到问题: http//bahcalculator.org/dev/nano.php I tried to create a copy of the style .tt-hint within my style sheet, but the inline style is overriding it. 我尝试在样式表中创建样式.tt-hint的副本,但内联样式覆盖了它。 How can I make .tt-hint inherit the styles from my form? 如何使.tt-hint继承自表单的样式?

使用CSS您别无选择,只能对.twitter-typeahead .tt-hint选择器中的每个声明使用!important规则,因为没有其他方法可以使用外部样式表覆盖内联样式。

You can change the styles using JavaScript, which will replace the inline style or you can use the !important keyword in your CSS, which will overwrite inline styles: 您可以使用JavaScript更改样式,这将取代内联样式,或者您可以在CSS中使用!important关键字,这将覆盖内联样式:

div.uk-form-row > span.twitter-typeahead {
    position: absolute !important;
}

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

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