如何覆盖 CSS [英] How to override CSS

查看:53
本文介绍了如何覆盖 CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有基本的 CSS 经验,所以我想知道如何删除由 Primefaces 设置的样式 CSS?

I have basic CSS experienced so I would like to know how can I remove a style CSS that was set by Primefaces?

.ui-inputfield, .ui-widget-content .ui-inputfield, .ui-widget-header .ui-inputfield {
    box-shadow: 0 2px 2px #74B2E2 inset;
}

我创建了自己的样式表 myCustomStyle.css

I created my own stylesheet myCustomStyle.css

.ui-inputfield, .ui-widget-content .ui-inputfield, .ui-widget-header .ui-inputfield {
    box-shadow: ?????? (How can I override the styling)
}

谢谢

推荐答案

使用 box-shadow:nonebox-shadow 重置为默认值.

Use box-shadow:none to reset the box-shadow to the defaults.

有关box-shadow<的信息,请参阅此来源/代码> 属性.可以通过定义相同的属性并使用默认值来重置"所有属性.

See this source for information about the box-shadow property. All properties can be "resetted" by defining the same property, and using the default value.

要让您的 myCustomStyle.css 覆盖 Primefaces 的 css 文件,您必须在 Primefaces 文件之后包含您的自定义文件.

To get your myCustomStyle.css override the Primefaces' css file, you have to include your custom file after the primefaces' file.

最后的手段:如果您的自定义样式没有得到应用,请在声明之后(但在分号之前)添加 !important:box-shadow:无!重要

A last resort: If your custom style doesn't get applied, add !important after your declaration (but before the semicolon): box-shadow: none !important

这篇关于如何覆盖 CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆