• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 CSS modification doesn't work anymore

Betclever

Active member
#1
Hello all,

I want to add some CSS code into the CSS sheet "extra.css" but nothing change...
I have tried with 10 different codes which are correct and available on Xenforo but nothing change...

I have added, removed several times, it is maybe the reason...

How can I fix this?

Thanks,
 

Tracy Perry

Well-known member
#3
There can be several reasons of this happening.
A few of the most common are
#1 - You are adding it to the EXTRA.css of the wrong style
#2 - Somewhere in your EXTRA.css you have incorrectly closed CSS code
#3 - The style you are using over-rides the CSS you are trying to use (I run into this frequently)
#4 - Active caching is causing a delay in the change.
 
Last edited:

Tracy Perry

Well-known member
#7
I personally just use important on everything just in case.
As I said.. that's a very BAD habit to get into.

Just a few comments from research I've done on why:
Unfortunately, and quite predictably, its usage has spread massively, but not in the right direction. Nowadays, it’s used to counteract the pain of having to deal with CSS specificity, otherwise known as the set of rules which dictate that “div h1 a” is more specific selector than “div a”. Most people that use CSS on a daily basis don’t know enough about CSS specificity to solve their problems without using the “!important” suffix.
from here.

and
When Should !important Be Used?
As with any technique, there are pros and cons depending on the circumstances. So when should it be used, if ever? Here’s my subjective overview of potential valid uses.

NEVER
!important declarations should not be used unless they are absolutely necessary after all other avenues have been exhausted. If you use !important out of laziness, to avoid proper debugging, or to rush a project to completion, then you’re abusing it, and you (or those that inherit your projects) will suffer the consequences.

If you include it even sparingly in your stylesheets, you will soon find that certain parts of your stylesheet will be harder to maintain. As discussed above, CSS property importance happens naturally through the cascade and specificity. When you use !important, you’re disrupting the natural flow of your rules, giving more weight to rules that are undeserving of such weight.
from here.

Use of the !important should almost never be used. It is an indicator that the person is usually not familiar with CSS and is having to rough-shod over the problem instead of fixing it correctly.
Generally for a lot of them the template search utility will reflect where you can change it in your style without using the EXTRA.css (especially when using child styles of a purchased one).

Have I used it before? Yes... and I slowly try to work through my styles to eliminate the need of them.
 

Tracy Perry

Well-known member
#9
The valid use I find in XenForo is to leave the templates untouched.
If you are working on a child style of an existing template... then there is no harm in modifying it instead of relying entirely on the EXTRA.css. I started that way myself (at one time one of my EXTRA.css had over 3000 lines in it). Now I just modify the child style directly.
 

Tracy Perry

Well-known member
#11
Upgrade process could mess up in future (maybe).
Haven't on any of mine. The merge process works just fine on the Audentio styles I use.
Before the ability to merge them then it did present problems.

Just saying... EXTRA.css has it's place - but not really the catch all to do all styling (or modifying of styling) in.
 

Amaury

Well-known member
#12
@Tracy Perry, I'll have to show you our CSS when @Nights gets the name servers for KH-Flare updated, but a lot of the CSS I have in EXTRA.css comes from things already controlled in the templates, but rather than edit the templates directly, I use EXTRA.css as recommended, and I think that's one of the avenues to use !important.
 

Russ

Well-known member
#13
As I said.. that's a very BAD habit to get into.

Just a few comments from research I've done on why:
from here.

and from here.

Use of the !important should almost never be used. It is an indicator that the person is usually not familiar with CSS and is having to rough-shod over the problem instead of fixing it correctly.
Generally for a lot of them the template search utility will reflect where you can change it in your style without using the EXTRA.css (especially when using child styles of a purchased one).

Have I used it before? Yes... and I slowly try to work through my styles to eliminate the need of them.
To be fair his main complaint with it just briefly reading over the article is how troublesome it can be for the END user. If XenForo used !importants for every CSS they laid out it would be beyond annoying. Someone throwing in an !important in their own extra.CSS isn't really going to make a difference in the end. Style authors should though take his advice and just use an extra selector(or obviously a style property) so end users can if they need to, use an important.

Oh and on topic haha I'm going to randomly guess you have some corrupt CSS, but no telling what is it without seeing your extra.css.
 

Tracy Perry

Well-known member
#14
To be fair his main complaint with it just briefly reading over the article is how troublesome it can be for the END user. If XenForo used !importants for every CSS they laid out it would be beyond annoying. Someone throwing in an !important in their own extra.CSS isn't really going to make a difference in the end. Style authors should though take his advice and just use an extra selector(or obviously a style property) so end users can if they need to, use an important.

Oh and on topic haha I'm going to randomly guess you have some corrupt CSS, but no telling what is it without seeing your extra.css.
yep.... and from what @Maru indicated... he used !important "on everything - just in case". That in and of itself is not a good idea. One here and there isn't going to hurt - but using them for everything is ridiculous.

One of the biggest complaints I have is even sometimes using an !important would not change some of the style selectors I've tried. That's the main reason I started editing the CSS in the style templates themselves.
 

Russ

Well-known member
#15
yep.... and from what @Maru indicated... he used !important "on everything - just in case". That in and of itself is not a good idea. One here and there isn't going to hurt - but using them for everything is ridiculous.

One of the biggest complaints I have is even sometimes using an !important would not change some of the style selectors I've tried. That's the main reason I started editing the CSS in the style templates themselves.
Gatta love the automerge featured :D