Giter Club home page Giter Club logo

Comments (8)

xoniq avatar xoniq commented on July 29, 2024 1

If the structure of your CSS is correct, this should not be a problem or causing side-effects.
When someone want to override the buttons without having to change the source of this script, it is not possible anymore with these '!important'.

In my vision; '!important' is never a good idea if the structure of the overall website is correct.

from sharingbuttons.io.

matter3 avatar matter3 commented on July 29, 2024

I agree with @xoniq , using "!important" should try to be avoided in most cases.

from sharingbuttons.io.

olets avatar olets commented on July 29, 2024

Sure, you don't want to do anything that'll get in the way of your cascade, but there are definitely legitimate uses for !important. For context, this note was because of changes made to a.resp-sharing-button__links. I agree it probably the !important isn't necessary - the reason for it here would be to protect against something like a {color: #000 !important} but in my opinion anyone who wants to do that should have to figure out their own workaround ;)

from sharingbuttons.io.

xoniq avatar xoniq commented on July 29, 2024

@olets if you have an '!important' like that there is already something wrong with the CSS structure itself. Of something is overriding the global 'a' there is the error. Extensions should only have CSS concerning it's container. And if you want an extension to honor your global style, this should be overridden on a proper way.

from sharingbuttons.io.

peter-mouland avatar peter-mouland commented on July 29, 2024

just gonna give my 2cents...

i agree there are time when !important are valid, but these are only from things like .hidden .hidden--mobile` etc

other than that, things like BEM and SMACCS also agree that, if possible, it is preferable to not have nested classes or !important; both of these things make customising the css harder.

from sharingbuttons.io.

olets avatar olets commented on July 29, 2024

Ha I mean yes, it's true that !important can be a sign of beginner css coding. In a case like this, where people are including an outside module and counting on the buttons to look a certain, its purpose would be to make it really hard for the site styles to interfere with the sharingbuttons styles. For example,

a.resp-sharing-button__link,
a.resp-sharing-button__link:hover,
a.resp-sharing-button__link:focus {
    ... !important
}

(with as and !importants) would make it really impossible for the site styles to accidentally mess up the buttons.

As you've all said, the usual goal is to be just as specific as necessary, and no more. mxstbr originally had

.resp-sharing-button__link,
.resp-sharing-button__link:hover,
.resp-sharing-button__link:focus {
    ...
}

and I just wanted to make sure he saw that when I changed it to .resp-sharing-button__link {...} (in #48) we lost some of the specificity he'd had before. I think we all agree that !importants aren't needed here :D
bitmoji

from sharingbuttons.io.

olets avatar olets commented on July 29, 2024

(I've wanted to use the bitmoji github plugin for so long!!:)

from sharingbuttons.io.

mxstbr avatar mxstbr commented on July 29, 2024

Thanks for the discussion everybody!

from sharingbuttons.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.