Home >Web Front-end >HTML Tutorial >Is there any way to disable global CSS? _html/css_WEB-ITnose

Is there any way to disable global CSS? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:07:371764browse

I used bootstrap, but this powerful framework has its own CSS for all html elements.

I have a special that I want to set the CSS by myself, but its global CSS is always Will affect me.

Is there any way to disable global CSS? Just so that the CSS set elsewhere will not affect this element of mine.


Reply to discussion (solution)

It should be possible to put it in an iframe


You don’t Can you write more details and give it a higher priority than him?

Reply to Floor 1:
Do you mean to add an independent body in the iframe? Sounds like a good method, I'll try it later.

Reply to Floor 2:
Bootstrap has a lot of default CSS. Even if I don’t write anything in the div, its CSS will be applied. I don’t even know which attribute affects me, how come it has a higher priority than it?

Can it be set to only be effective for certain elements and their sub-elements?

Write it directly in the span style. If the called style does not have !important, you can ignore it.

It stands to reason that bootstrap has not made any settings for the span tag.


Bootstrap always adds the exclusive class name first, and then affects it.

If you just want to apply this small span style, just copy its style directly. Or, you put the bootstrap style reference in front, and then introduce your own css. It will not overwrite your style

Write it directly in the style of span. If the called style does not have !important, you can ignore it
After looking at the css file of bootcss, there are a lot of !important
My own css is written like this

I don’t know which one conflicts with it, but it does display normally without bootcss. Is there any way to disable its importance?

! important

That’s about span important


You can do this
level>level2>level3>span

Assume that your tag is span and there are a class . You can define span.classname{} like this. Note that this style is written at the bottom of the css table if you only have one css table. Please pay attention to the order of references when there are multiple.

The stupidest way is to override the global CSS style in the page

Hey, thank you everyone. Because my class directly references a third party, it is difficult to change it.
So I ended up using the method on the first floor. iframe does work, although it’s a little more troublesome. . .

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn