CSS Layers Are Changing How Specificity Works

Поделиться
HTML-код
  • Опубликовано: 4 окт 2024

Комментарии • 94

  • @VinceAggrippino
    @VinceAggrippino 11 месяцев назад +7

    7:17 "Boots-crap code"... I agree completely with this review 😁

    • @toyflish
      @toyflish 7 месяцев назад

      he really said that :D

  • @hugoanderkivi
    @hugoanderkivi 2 года назад +50

    Didn't think it was possible to make me hate !important even more, but you have done it.

    • @321sas
      @321sas Год назад +1

      YESSIR

    • @illyias
      @illyias 10 месяцев назад +1

      Why in the WORLD would they implement it like that? My god

  • @gohancomfejao
    @gohancomfejao 2 года назад +18

    It’s nice to see a great feature already implemented on tailwind being natively supported on major browsers!

  • @MajorRushMore
    @MajorRushMore 2 года назад +14

    Nice job not getting tongue tied saying "specificity" over and over! 🙌

    • @lamthaotran19
      @lamthaotran19 2 года назад +5

      Kevin Powell dislikes this comment.

  • @_the_one_1
    @_the_one_1 2 года назад +6

    Kyle your teaching style is amazing! I wish you could teach a little us some Sveltekit content! I know that you are more into React and personally I am more into Vue but man, Sveltekit is amazing! Please add some content related to it.

  • @sumandutta4074
    @sumandutta4074 2 года назад +1

    Congratulations to advance 1 million subscribers 🥳🥳🥳🥳

  • @ericnjanga3245
    @ericnjanga3245 Год назад +1

    Amazing, thank you!

  • @JuanIGN95
    @JuanIGN95 2 года назад +6

    Today on my work, I got some messy css old code that I need to improve and I had some problems with libraries… I will test this tomorrow and if it works I will be sooooo happy 😂 thanks for share and it’s crazy that you uploaded it the same day I encounter this problem 🤣

    • @JuanIGN95
      @JuanIGN95 2 года назад +4

      bad news... experimental thing not ready for production 😂 will wait till supported to all browsers.

  • @trimbrains911
    @trimbrains911 2 года назад +2

    Interesting feature and nicely explained. I found that adopting the ITCSS approach solved my specificity issues. The possibility to "layer" a third party framework is interesting though, especially if they've written overly specific selectors.

  • @dave6012
    @dave6012 2 года назад +1

    Great CSS insights! Nobody tell Kevin 😬😅

  • @StellarWeb008
    @StellarWeb008 2 года назад +1

    Thanks a lot for teaching such an important thing

  • @_the_one_1
    @_the_one_1 2 года назад +1

    Awesome explanation! Thank you!

  • @dancastady8571
    @dancastady8571 5 месяцев назад

    GAME CHANGER, HOW AM I JUST LEARNING THIS!?!?!?!

  • @Videoguy789
    @Videoguy789 Год назад +1

    7:17 bootsCrap - nice freudian slip there

  • @cristhiandelgado6189
    @cristhiandelgado6189 2 года назад +1

    Your explanation are the best

  • @fadfooood
    @fadfooood 2 года назад +1

    First time knowing about layers!

  • @Aalii6
    @Aalii6 2 года назад +1

    very interesting, thank you!

  • @alvarojflores
    @alvarojflores 2 года назад

    Thank you for the simplicity!

  • @biLLie_wiLLie
    @biLLie_wiLLie 2 года назад +2

    @layers has 59% support on caniuse

  • @AttilaButurla
    @AttilaButurla 2 года назад +1

    Excellent content, as always.

  • @goffyfoot82
    @goffyfoot82 Год назад +1

    Timestamp at 3.35 is spot on ...... try to say specificity is hard enough to say let alone understand.

  • @titan6392
    @titan6392 Год назад

    You're so good thanks a lot man 🙂 i learnt something new.

  • @romanext921
    @romanext921 2 года назад +1

    This is cool. But what about the backwards compatibility? Ios especially is a pain in the ass when it comes to styles incapatability

  • @paxdriver
    @paxdriver 2 года назад +1

    Why not replace !important with a layer called "important"? Any downsides to that?

  • @cursorcodecamp
    @cursorcodecamp 2 года назад +1

    hello.. off topic but wanted you to do a javascript async await video. i've gone through your playlists but there's none..

  • @borstenpinsel
    @borstenpinsel 2 года назад +1

    WTH. I always thought the later (higher line number) the style comed in the sheet, it will override earlier styles. First time I learn about specifity. This explains so much... why I had to resort to using !important even though I know I shouldn't need it, if I "order" by css right...

    • @ShadowVipers
      @ShadowVipers 2 года назад +2

      If the selectors are of the same specificity, then it goes by whichever selector comes last (order based), although, if specificity is higher then the order in which it's defined doesn't matter.

  • @MrCC-hx8xr
    @MrCC-hx8xr 2 года назад +1

    Fresh & modern & intuitive & fast curve of learning = KYLE aka WDS + luxury hair ;-)))))

  • @awekeningbro1207
    @awekeningbro1207 2 года назад +2

    why haven't i heard of this before?

  • @TheGarageboyz
    @TheGarageboyz 2 года назад +1

    First viewer! Enjoying your videos man!

  • @andyschulze4973
    @andyschulze4973 Год назад

    Thank you. Very well explained! However, I am aware that long tutorials don't sell, but could you please slow down a little next time!? :D It was a bit hard to follow along. Anyway: nice work! :)

  • @fadhilh3931
    @fadhilh3931 2 года назад +1

    Do you have any tips to improve CSS skill? I already have basic CSS, but sometimes I still struggled to implement some CSS property. Any tips is appreciated.

  • @spicynoodle7419
    @spicynoodle7419 2 года назад +1

    Basically like !default in sass

  • @Holy_Frijole
    @Holy_Frijole 2 года назад +1

    [11:10] ok we need @veryimportant j/k. Hmmm not sure if this reverse of importance is a good call or a mistake by those in charge.

  • @cricket_talk6197
    @cricket_talk6197 2 года назад +1

    U r the best

  • @mannumannu9200
    @mannumannu9200 2 года назад +1

    Then how to overridie !important of bootstrap

  • @danielm1
    @danielm1 2 года назад +7

    Very cool. What sources do you use and/or recommend to keep yourself up-to-date with state of art web dev (besides your amazing youtube channel :)?

    • @sicfxmusic
      @sicfxmusic 2 года назад +2

      A designer/developer should never reveal their sources 😛

    • @danielm1
      @danielm1 2 года назад +1

      @@sicfxmusic So you're saying it's like asking a drug dealer where he gets his drugs :)

    • @seekknowledge1928
      @seekknowledge1928 2 года назад +1

      @@danielm1 :)

  • @rajapoudel5037
    @rajapoudel5037 2 года назад +1

    can you make the another tutorial on react testing using jest. I have seen on tutorial already

  • @whatthefunction9140
    @whatthefunction9140 2 года назад +2

    @layer important 🤔

  • @alvaroprietovideos
    @alvaroprietovideos 2 года назад +1

    Wow! That is very interesting! Do you know if there is something to prevent css contamination? Something like isolated scopes, or some kind of easy and clean css reseter? Thank you!

  • @kareemsakr41
    @kareemsakr41 2 года назад +1

    You are amazing

  • @geforcesong
    @geforcesong 2 года назад +1

    @kyle This is nice, but how can i put css in multiple files in the same layer? define the layer with same name everywhere?

  • @clevermissfox
    @clevermissfox 9 месяцев назад +1

    I’m confused at the end. Does “@layer utilities.anotherLayer “ reference the same layer above it ? ie “@layer utilities {@layer anotherLayer{…} }”? Or utilites.anotherLayer completely separate and just one long name that isn’t related to the former ?
    Eg.
    ” @layers utilities, utilities.anotherLayer, frameworks, etc”
    @layer anotherLayer, frameworks, etc

  • @sicfxmusic
    @sicfxmusic 2 года назад +1

    How is the browser support? I hate when clients use outdated browsers and complain about things not working properly!! 😠

  • @WetaNewZealand
    @WetaNewZealand 2 года назад +1

    Nice

  • @andyschulze4973
    @andyschulze4973 Год назад +1

    Oh, and here is a question: you said that the important! rule inside bootstrap messes the whole thing up, since these rules are applied the other way around. But if so, I can never include an external CSS-library, because I can never gurantee, that they won't use important! in their code, right!? :/

    • @nielsdegroot9138
      @nielsdegroot9138 9 месяцев назад +1

      You can define a layer before the layer in which you import bootstrap. In that first layer you can create !important rules which will overwrite the bootstrap !important ones.
      But the best thing is for frameworks to not use !important in their css. But that might take their developers some time to take out. (If it was easy they probably wouldn't have put them in in the first place)

  • @david.petrey
    @david.petrey Год назад +1

    Now having watched the last part about nested layers and !important in layers I'm going to buy stock in Tylenol and any other company selling headache medicine. 🤣

  • @QwDragon
    @QwDragon 2 года назад

    What are use cases for nested layers? And where we need to order them?

  • @chaozou6283
    @chaozou6283 2 года назад +1

    Looks like scss wrapper

  • @Raaaww
    @Raaaww 2 года назад +1

    This is probably a dumb question, but is there any way to access a component(next js) in _apps.js from other pages? I want to move the change theme button to a menu, but can't figure out how to do it :/

  • @yadusolparterre
    @yadusolparterre 2 года назад +1

    Please tell me if I am wrong... If you put Bootstrap inside the lowest layer, it is impossible to override any of its rules that have the "!important" keyword in the higher layers... But since Bootstrap uses "!important" in virtually every single rule, I guess that it's useless to import it in a layer... Am I right?

    • @ogreeni
      @ogreeni Год назад +2

      I believe you could put Bootstrap inside its own layer and then define the rest of your styles at the top level. Then your own styles would be considered more specific.

    • @yadusolparterre
      @yadusolparterre Год назад +1

      @@ogreeni no because !important will override from the bottom layer to the top and not the other way around

    • @ogreeni
      @ogreeni Год назад +1

      @@yadusolparterre yes, but would it override everything including code that is not within a layer, or only up to the upmost layer?

    • @yadusolparterre
      @yadusolparterre Год назад +1

      @@ogreeni good question, I don't know

  • @devarshihazarika4871
    @devarshihazarika4871 2 года назад +1

    Important had to be different

  • @NitNet
    @NitNet 2 года назад

    CSS can be used in making advance animation, but SCSS/SASS is better over normal CSS.

  • @codehan
    @codehan 2 года назад

    Does it also work if you want to overwrite css rules from an external library within React css/scss modules?

  • @pfcokelly
    @pfcokelly 2 года назад +2

    With layers I don't need Kevin Powell no more! Jk

  • @lucasa8710
    @lucasa8710 2 года назад +1

    does it works on SCSS?

  • @MdFahimMuntasir
    @MdFahimMuntasir 2 года назад

    First viewer since your video starts

  • @david.petrey
    @david.petrey Год назад +1

    So now instead of having !important scattered all over the place devs will start adding non-layered styles whenever they are in a bind and have to override something. Only now there is no way at-all to override non-layered styles except with other non-layered styles plus specificity? And so !important will still get used. Isn't that what's going to happen when this isn't managed properly? lol

  • @TariqSajid
    @TariqSajid 2 года назад

    Can you please make tutorial on redux toolkit that do crud in array without making any api calls

  • @ryan-heath
    @ryan-heath 2 года назад +1

    Did you just scoff at bootstrap? 😆

  • @Sanguinezor
    @Sanguinezor 2 года назад +2

    Boots"Crap" code (^_^)

  • @sandeeptottadi
    @sandeeptottadi 2 года назад

    Hello

  • @amosmachora
    @amosmachora 2 года назад +1

    So like just Sass ryt

  • @DanThemes
    @DanThemes 2 года назад +1

    So basically you cannot overwrite both !important and non-!important styles. Since 3rd-party CSS might have both, that makes CSS Layers pretty much useless.

  • @nitsanbh
    @nitsanbh 2 года назад +1

    Very cool, but could you use a different color other than red?
    3 giant red rectangles on a white background during the whole video really hurt my eyes, and make it harder to watch

  • @reyzKhight
    @reyzKhight 2 года назад

    4th

  • @MrCC-hx8xr
    @MrCC-hx8xr 2 года назад

    does anyone know anything closer about this guy? His profession? Sometimes I feel like he can do everything

  • @Niko753A
    @Niko753A 2 года назад +1

    is it me who is very slow or is the video really really fast? :-)

  • @7heMech
    @7heMech 2 года назад

    888K subs

  • @swapnilkuwar7040
    @swapnilkuwar7040 2 года назад

    Second

  • @kinleygyeltshenwangdue1764
    @kinleygyeltshenwangdue1764 2 года назад

    First

  • @timm.7740
    @timm.7740 2 года назад +1

    I love your vids, am a subscriber, but my God you talk and teach so fast! I'm slowly learning, so it's probably my fault. I wished you would talk/teach slower. Love your teaching though, Kyle!

  • @luffySenpai-eb3fg
    @luffySenpai-eb3fg 2 месяца назад

    I hated CSS but now I hate it more..........

  • @finsflexin
    @finsflexin 2 года назад

    This could’ve been taught in 2 minutes

  • @babakfp
    @babakfp 2 года назад

    people that develop CSS, never disappointed me by releasing broken bs features.

  • @sohastar1985
    @sohastar1985 2 года назад

    Oh man , is anyone catching you !? Toooo much fast talking 😳🙄🥺🤐

  • @rajanpoudel7980
    @rajanpoudel7980 2 года назад

    First