Html 如何删除/禁用某些引导元素的样式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17751430/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to remove/disable styling on some bootstrap elements
提问by None None
I want to know if it is possible to disable styling on a specific html element.
我想知道是否可以禁用特定 html 元素的样式。
In my case it is a input text. I cannot resize it. I went through the bootstrap css and found it has padding. I tried to use padding: none
and 0 0 0 0
plus !important
and it did not work.
在我的情况下,它是一个输入文本。我无法调整它的大小。我浏览了 bootstrap css,发现它有填充。我试图用padding: none
与0 0 0 0
加!important
,并没有奏效。
Is possible to disable the styling for that specific item?
是否可以禁用该特定项目的样式?
回答by Allan
As of Bootstrap 3, you'd use the list-unstyled
class to achieve this.
从 Bootstrap 3 开始,您将使用list-unstyled
该类来实现这一点。
Example:
例子:
<ul class="list-unstyled">
<li>...</li>
</ul>
Hope this solves your problem.
希望这能解决您的问题。
回答by enam
Yes it is possible. You can achieve it in following way:
对的,这是可能的。您可以通过以下方式实现它:
- Load your own
stylesheet
definition after thebootstrap.css
. For your case defineinput[type=text]{padding:0px;}
must call after thebootstrap's
css file(s). - If you want to use in-line css you can try:
<input type="text" style="padding:0px" />
- 后加载您自己的
stylesheet
定义bootstrap.css
。对于您的情况,定义input[type=text]{padding:0px;}
必须在bootstrap's
css 文件之后调用。 - 如果您想使用内联 css,您可以尝试:
<input type="text" style="padding:0px" />
Hope it helps.
希望能帮助到你。
回答by enam
Set it in the style of the element in the style attribrute if an item is there it has priority.
如果项目在那里,则在样式属性中将其设置为元素的样式,则它具有优先级。
Also if you want to be double sure add !important as well
此外,如果你想成为双重肯定添加 !important
回答by bibs2091
in the 'head' of your HTML change the order of the local css file and bootstrap css, the local css should be the after the bootstrap css:
在 HTML 的“head”中更改本地 css 文件和 bootstrap css 的顺序,本地 css 应该在 bootstrap css 之后:
<head>
<!-- bootstrap css is the first here -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- bootstrap css is the last -->
<link rel="stylesheet" href="style.css">
</head>
now if you applied !important in your css it should work.
现在,如果你在你的 css 中应用了 !important 它应该可以工作。
another solution is to apply your css inline <element style="padding:0"></element>
另一个解决方案是内联应用你的 css <element style="padding:0"></element>
回答by Raymond
Would Javascript be of any help to you? If so the .setAttribute
native javascript function can help:
Javascript 对你有帮助吗?如果是这样。setAttribute
本机 javascript 函数可以帮助:
Just replace the id that I made up with the id of input element you want to change
只需将我制作的 id 替换为您要更改的输入元素的 id