Jump to content
  • 0
roattw

Managing CSS from Caspio and CSS from hosted solution

Question

Im trying to abandon the Caspio CSS and soley use the custom CSS on a Weebly page.  Do I have to !important every Weebly side CSS to overcome the Caspio cSS?  Is there a best practice for this?

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi roattw, I'm afraid the answer for that is yes. You need to put !important if you will be using an external or internal css because if you don't that might cause conflict on other css code with the same class/id name.

Share this post


Link to post
Share on other sites
  • 0
On 3/19/2018 at 3:06 PM, roattw said:

Im trying to abandon the Caspio CSS and soley use the custom CSS on a Weebly page.  Do I have to !important every Weebly side CSS to overcome the Caspio cSS?  Is there a best practice for this?

It means, essentially, what it says; that 'this is important, ignore subsequent rules, and any usual specificity issues, apply this rule!'

In normal use, a rule defined in an external stylesheet is overruled by a style defined in the head of document, which, in turn, is overruled by an in-line style within the element itself (assuming equal specificity of the selectors). Defining a rule with the !important 'attribute' (?) discards the normal concerns as regards the 'later' rule overriding the 'earlier' ones.

Also, ordinarily, a more specific rule will override a less-specific rule. So:

a {
    /* css */
}

Is normally overruled by:

body div #elementID ul li a {
    /* css */
}

As the latter selector is more specific (and it doesn't, normally, matter where the more-specific selector is found (in the head or the external stylesheet) it will still override the less-specific selector (inline style attributes will always override the 'more-', or the 'less-', specific selector as it's always more specific.

If, however, you add !important to the less-specific selector's CSS declaration, it will have priority.

Using !important has its purposes (though I struggle to think of them), but it's much like using a nuclear explosion to stop the foxes killing your chickens; yes, the foxes will be killed, but so will the chickens. And the neighborhood.

It also makes debugging your CSS a nightmare (from personal, empirical, experience).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...