Giter Club home page Giter Club logo

Comments (13)

AllThingsSmitty avatar AllThingsSmitty commented on May 10, 2024

@DanGamble89 I appreciate the feedback but I have to disagree. The additional specificity is negligible and one of the reasons I'm advising it is that the use of :not(:last-child) is very clear with the CSS selector defining the border the way a human would describe it.

from css-protips.

dan-gamble avatar dan-gamble commented on May 10, 2024

I wouldn't say it's negligible. Once you start having to style dropdowns on the same nav or style it different on mobile where there are no borders then you will hit conflicts. I use to be an advocate of this method but once you start implementing these things it just causes headaches.

If you have to style the asset responsively i'd go for child specific pseudo's as opposed to hitting all of them with a :not

from css-protips.

kathgironpe avatar kathgironpe commented on May 10, 2024

I think if you're supporting IE, stick to using classes and learn more than CSS. Not a good "PRO" tip.

from css-protips.

robsonsobral avatar robsonsobral commented on May 10, 2024

I think if you're supporting IE, stick to using classes and learn more than CSS. Not a good "PRO" tip.

+1

from css-protips.

johnmcdowall avatar johnmcdowall commented on May 10, 2024

I think if you're supporting IE, you should know that IE has supported :not since IE9.

http://caniuse.com/#feat=css-sel3

from css-protips.

kathgironpe avatar kathgironpe commented on May 10, 2024

I'm very much aware of that, thank you. I don't see the point of this PRO tips, honestly. I feel like avoiding selectors may even be a better practice.

I am aware there are probably no performance issues now.

from css-protips.

dan-gamble avatar dan-gamble commented on May 10, 2024

I'd say using selectors is bad practice too, stick to classes 100% unless you can't

from css-protips.

vwochnik avatar vwochnik commented on May 10, 2024

I'd say using selectors is bad practice too, stick to classes 100% unless you can't

Not sure if srs. The new CSS3 selectors are there so we can strip the HTML markup of unnecessary classes to make it cleaner and to further separate content from style. I have to say I like both the nav and inline list :not() tip. I wasn't aware of the :not() selector before.

from css-protips.

kohenkatz avatar kohenkatz commented on May 10, 2024

I'd say using selectors is bad practice too, stick to classes 100% unless you can't

@DanGamble89 So what about if I want to style the first and/or last elements of a list differently? Should I add first and last classes instead of using selectors, because it "can" be done that way?

from css-protips.

dan-gamble avatar dan-gamble commented on May 10, 2024

Using pseudo selectors is fine, using HTML selectors i.e, div, span, h1 is bad practice.

:first-child, :last-child are totally fine. :not() can be okay as well. But in instances like this it's bad as it adds an extra level of specificity for little to no gain. It will cause you problems when you want to style dropdowns in the navigation or make the navigation responsive

from css-protips.

vwochnik avatar vwochnik commented on May 10, 2024

@DanGamble89 then just don't use them for dropdowns!

Styling divs may not be advisable since a div is fairly generic but styling h1 is just fine!

from css-protips.

AllThingsSmitty avatar AllThingsSmitty commented on May 10, 2024

It will cause you problems when you want to style dropdowns in the navigation or make the navigation responsive.

@DanGamble89 how so? Do you have an example of that so we can see if :not() is really the problem?

from css-protips.

AllThingsSmitty avatar AllThingsSmitty commented on May 10, 2024

styling h1 is just fine!

@vwochnik agreed, especially when you have to consider accessibility.

from css-protips.

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.