style.css 更新不适用于某些代码

时间:2021-04-18 11:23:23

标签: html css

我想更新 mywebsite 的 style.css ,它正在处理大部分内容,但搜索图标存在特定问题。我把相关的照片放在用黄色标高的附件中,你可能会看到我可以在浏览器上做,但是当我在 style.css 上更改它时,它不起作用,随着年龄的增长而出现。顺便说一下,我通过 style.css 更改了搜索框,没有任何问题。 Style.css 代码如下。

你能帮忙解决这个问题吗,我有什么想念的吗。

form.search-form [type="submit"] {
       border: none;
       cursor: pointer;
       padding: 0 16px;
       line-height: 38px;
       height: 65px;
       vertical-align: middle;
       position: absolute; 
       top: 0;
       right: 0;
 }

enter image description here enter image description here

1 个答案:

答案 0 :(得分:0)

这主要发生在您当前的 css 代码无法覆盖默认应用于元素的默认 css 代码时。

要覆盖默认代码,您只需使用 !important 并将其添加到您要使用的 css 代码前即可。

form.search-form [type="submit"] {
       border: none;
       cursor: pointer;
       padding: 0 16px;
       line-height: 38px;
       height: 65px !important;
       vertical-align: middle;
       position: absolute; 
       top: 0;
       right: 0;
 }