Another 5 Must Know CSS Tricks That Almost Nobody Knows

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

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

  • @mrbjjackson
    @mrbjjackson 3 года назад +9

    Hey Kyle, watching the conical gradient tip has just helped me solve a problem I've been having over the last two days. I was looking for a way of revealing an image in a kind of circular wipe reveal. I was trying to do it using clip-path but it wasn't working in Safari. I've now switched my method by using a conical gradient with two colours. One of these colours has an alpha value of 0 and I've animated it so as it animates round the circle, it reveals the image underneath. It looks great and was much simpler than the other method I was using and it's cross-browser compatible. Thanks so much for the tip!

  • @nicolas.chauvet
    @nicolas.chauvet 3 года назад +26

    After 20 years of battling with css, I'm starting to love it!

    • @shaderone07
      @shaderone07 3 года назад

      Whoa!! 20years ...

    • @nicolas.chauvet
      @nicolas.chauvet 3 года назад

      @@shaderone07 I'm not so old, CSS is 25 years old!

    • @lelandhamza9245
      @lelandhamza9245 3 года назад

      i guess it is kind of off topic but does anybody know a good place to watch new series online ?

    • @nikoaldo4394
      @nikoaldo4394 3 года назад

      @Leland Hamza i use FlixZone. Just search on google for it =)

    • @ethanarjun3798
      @ethanarjun3798 3 года назад

      @Niko Aldo Yea, I've been watching on Flixzone for months myself :)

  • @devashishbahri3353
    @devashishbahri3353 3 года назад +10

    Out of all the coding channels on RUclips, yours and Max's (Academind) are the best! Excellent video as always.. always excited for your videos because there's always something new to learn irrespective of how experienced of a coder I am. Keep up the great work man!

  • @4499664
    @4499664 3 года назад +11

    additionally, for the tooltip, instead of the "top position + transform" combination you can use "bottom: 100%;", which will position tooltip exactly at top of its parent. or "bottom: calc(100% + any positive value);" to make a bit distance between tooltip and its parent.

  • @nevadadimitri4153
    @nevadadimitri4153 3 года назад +2

    Regarding the flexbox gap (11:00):
    While we wait for those other browsers to catch up, we can simplify it further by using :not...
    .flex :not(:last-child) {
    margin-right: 10px;
    }

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

    Flexbox was such a game changer for me. I have been using gap for personal projects because it is just so darned easy.

  • @lbobrov
    @lbobrov 3 года назад +21

    conic-gradient - W-O-W !!!
    That really looks like a cone! :)

  • @alihasnain8097
    @alihasnain8097 3 года назад +1

    conic gradient property is very cool. I will use this in my future projects. Thanks Kyle

  • @ZackPyle
    @ZackPyle 3 года назад

    I don't normally learn a new property in videos like this but I love counter() and never new about counters()... 🤯

  • @AmodeusR
    @AmodeusR 3 года назад +1

    11:24 I think it's better to make .flex + .flex { margin-left: 10px;}, you don't need to rewrite the "last child" thing and reach the same effect.
    It looks for a .flex item that has another one before it, if it has, it gets the properties given, if not, it doesn't, which is exactly what we want to achieve; give a margin for every .flex item except the first one, which doesn't have any other .flex item before it.

  • @Krokodil986
    @Krokodil986 3 года назад +37

    I love these videos, u can literally make as many of them as you want and we'll still watch them 😉

  • @radekpiekny2837
    @radekpiekny2837 3 года назад

    All tips are kind of not great when you already work as a web dev doing SPAs and there are better ways how to deal with the problem but dude that conical gradient is AMAZING. That really does have huge value that I can use. Thanks for that.

  • @brianevans4
    @brianevans4 3 года назад +21

    Next video: how to fetch a document from mongo db using only CSS

  • @willianandrade1357
    @willianandrade1357 3 года назад +1

    I really do like videos like this one for css and general layout because you actually give us examples of use cases for the thing you're talking about instead of just explaining the documentation for that particular selector.
    Ps: This video came in an awesome time for me. I'm actually having a lot of problems trying to code projects of my own because I can't seem to grasp how to create my own layouts and choose colors well. Knowing these new selectors can help me a lot! Thank you!

  • @Z3ROR
    @Z3ROR 3 года назад +5

    Why not making those flex gaps like this: .flex > * + * { margin-left: ... }
    You wont need that lastchild thing then.

  • @nirke_
    @nirke_ 3 года назад

    until flex gap has wide compatibility, you can save a bit of code by using:
    .flex > :not(:last-child) { margin-right: 5px }

  • @Hangoutapp
    @Hangoutapp 3 года назад +1

    Your video really helpful

  • @saghait
    @saghait 3 года назад

    awesome, and at the end, you're real my online mentor

  • @parahumanoid
    @parahumanoid 3 года назад

    way to go! you do have tricks up your sleeve! thanks for posting these.

  • @cmtg4471
    @cmtg4471 3 года назад

    This is nice stuff learning new things really makes you love and appreciate more in coding

  • @scotthclay
    @scotthclay 3 года назад

    These are great, Thank you. Any idea how these effect accessibility? For example, the counter?

  • @АлександрБадаландабад

    Goog job, this css tricks are simplified ! Thanks !

  • @basix250
    @basix250 3 года назад +1

    The counter literally blew my mind 🤯

  • @CodeWithTomi
    @CodeWithTomi 3 года назад +5

    Another great video!

  • @IAmSamuelCharpentier
    @IAmSamuelCharpentier 3 года назад +3

    The :is() selector has a lower level of specificity I believe, so you should be careful when using it!

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

    This is pretty cool, but I was taught by Epicodus that you should never mix CSS into HTML outside of the styles file. If these can be used in the styles file then this would be useful.

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

      Yes you can do this in separate style files. In fact you can do anything in a style file which you can do in a style tag and vice versa.

  • @tylovset
    @tylovset 3 года назад

    I'm a c/c++/python developer, but love these videos none the less. Soon time to do some js css coding I guess...

  • @Maruth
    @Maruth 3 года назад

    Last year get to know counter from an interview and i am amazed

  • @mauricemakesmovies
    @mauricemakesmovies 3 года назад

    You're amazing! Thank you for your service. I also like your guitar haha

  • @KrishnaKumar-jr7qq
    @KrishnaKumar-jr7qq 3 года назад

    flex gap really wow .. You just saved my life.

  • @zigaudrey
    @zigaudrey 3 года назад

    Oh, I heard the counter before. I saw it in a page. There is also a CSS code that order a list by alphabetic or numeral order. Perfect for imitating a TvTropes Page. I never though using this counter properties for my Tumblr Archive.

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

    Just curious...
    I don't know if this is the correct forum to ask this but I will ask anyway...
    When it comes to CSS tags, does sequence matter?
    I like to put them in alphabetical order just to see if it already exists.
    For example, I always put "background" before "margin" just to see if it's already there but I don't know if it matters.
    So far, I haven't seen any difference but just want to know if it matters.
    Thanks!

  •  3 года назад +3

    Amazing as usual.

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

    Do you have any suggestions for using this tooltip strategy for non-container elements? Such as an img or an input tag? Preferably in a way that doesn't mess up other styling -- we could just wrap those tags in a span or div and then put the tooltip on that, but that can effect the styling in annoying ways

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

    Would like to see you struggle with WCAG 2.1
    And remember: the specifity of :is is 0

  • @sanjibchanda21
    @sanjibchanda21 3 года назад +1

    Awesome thanks ❤️

  • @whynot9963
    @whynot9963 3 года назад

    Although this does point some pretty nice features, i would say most of these are really niche, and almost never used in production, hence why nobody knows about them. Most of these are redundant since nowadays nobody uses plain html, but rather some sort of templating.
    I am not trying to be a hater, i really like your content, but i think as an educator you should somehow point out to those that are just now beginning that some stuff, while cool, should not be used in production. Keep up with great work!

  • @grzegorzt
    @grzegorzt 3 года назад +1

    .flex > *:last-child is unnecessary, enough .flex > * + * { margin-left: 10px; }

  • @papanokiss
    @papanokiss 3 года назад

    Looking forward to gap support :)

  • @sapindersingh1165
    @sapindersingh1165 3 года назад

    I rarely hit like on youtube videos but yours always compel me to do so

  •  3 года назад

    Thanks Kyle!

  • @sweetpotatoS2
    @sweetpotatoS2 3 года назад

    thank you so much! super informative video👍

  • @lumiuko
    @lumiuko 3 года назад

    12:22 now Safari supports it as well

  • @scribblingjoe
    @scribblingjoe 3 года назад

    Your videos are always so useful.

  • @KaroCodes
    @KaroCodes 3 года назад +10

    Why do I find this so entertaining 🤯

  • @m2kdevelopments
    @m2kdevelopments 3 года назад

    Awesome video!

  • @TurtleKwitty
    @TurtleKwitty 3 года назад +1

    Actually for the flex trick without gap, I set margin to half the gap I want, if I dont want there to be a padding on the exterior then the flex element itself gets a padding of minus half the gap, that way they're all even without having to do the last child trick

    • @manuelcasares7270
      @manuelcasares7270 3 года назад

      Thx for sharing this

    • @TurtleKwitty
      @TurtleKwitty 3 года назад +1

      @@manuelcasares7270 Absolute pleasure, always fun to have tricks that play well with wrapping

    • @JoaoPedro-qt7dc
      @JoaoPedro-qt7dc 3 года назад

      You can also use
      .child + .child {
      margin-left: 1rem;
      }
      It works like a charm. Margin-top works too

    • @TurtleKwitty
      @TurtleKwitty 3 года назад

      @@JoaoPedro-qt7dc That breaks in multi line though

  • @luissutil9595
    @luissutil9595 3 года назад

    33 seconds in and i already subscribed

  • @nikolaymatveychuk6145
    @nikolaymatveychuk6145 3 года назад

    why not to do "li li { blablabla }" instead of using ":is"? :)
    WOW! The thing about gradient is awesome. Thank you!

  • @eddier.6749
    @eddier.6749 3 года назад

    Great video! Thank you!

  • @ygeb93
    @ygeb93 3 года назад

    Why did you comment out the code in 5:36?
    Is it because of a specificity issue? How specific is the :is() selector?

  • @arctan2
    @arctan2 3 года назад +1

    hey can you use counter() in calc() ?
    because staggering animations will be so much easy😵

  • @noozzoo5152
    @noozzoo5152 3 года назад

    Thanks!
    Also, what do you play on the Dinky?
    (Edit: I have a circa '98 Jackson Performer PS-2)

  • @iakhimsh375
    @iakhimsh375 3 года назад

    This is gold.

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

    Thanks

  • @nirmesh44
    @nirmesh44 3 года назад

    This really have blown my mind. 👀

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

    You blow my mind 🙂

  • @superchrishovids
    @superchrishovids 3 года назад

    or use attr html tag to make a hacky tooltip hover? saves on all the extra css

  • @leofun01
    @leofun01 3 года назад +2

    5:15 - ? ... CSS: li li { ... } , man.

  • @MultiMigh
    @MultiMigh 3 года назад

    Or you go .flex > * + * {margin-left: 10px;} so you don't need to deal with :last-child, but gap is definitely nicer.

  • @jcubic
    @jcubic 3 года назад

    You can use gap with lobotmized owl:
    .flex * + * {
    margin-left: 10px;
    }

  • @rangabharath4253
    @rangabharath4253 3 года назад

    Awesome as always 👍😀

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

    strangely that "left: 50%" works for button but doesn't work for things like

  •  3 года назад

    Talking about tooltip: What's the matter with good old "title"?

  • @axiezimmah
    @axiezimmah 3 года назад

    Have you ever made a functional todo list with ONLY css? (so no javascript at all?). It's possible.

    • @StrikerFeed
      @StrikerFeed 3 года назад

      It sounds like a fun challenge, but for real - unnecessary idea))

  • @noozzoo5152
    @noozzoo5152 3 года назад

    For Safari mobile, this should work:
    .flex:nth-child(n+2):nth-last-child(n+2){
    margin-right: 10px;
    }

  • @awekeningbro1207
    @awekeningbro1207 3 года назад

    can we make some sort of data visualization using conic-gradient and css variables?

  • @saurabhfegade3713
    @saurabhfegade3713 3 года назад

    Quality tips!

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

    How do you wrap the flex items in a single div and the first item in each row marginLeft: 0 and the last item has marginRight: 0?

  • @jasonlough6640
    @jasonlough6640 3 года назад

    Regarding his cheatsheets: theyre legit. They make some funky parts of css very clear, connecting some dots in very nice visual ways. Ive seen it worse explained in $50 books. In fact, I wonder... @kyle: are these cheatsheets licensed for use in schools by teachers?

  • @joelqrq
    @joelqrq 3 года назад

    Nice video but is there any performance impact?

    • @Endrit719
      @Endrit719 3 года назад +2

      I doubt, as these are new features they try to always bring optimal solutions

  • @JulienReszka
    @JulienReszka 3 года назад

    This is awesome

  • @gamewebdevchannel3116
    @gamewebdevchannel3116 3 года назад +1

    Will you make a tut on game development

  • @Matalina
    @Matalina 3 года назад

    The is selector is cool. But the css could have just been li li and it would get all nested li's no matter how deep. Am I wrong?

  • @xdiepx
    @xdiepx 3 года назад

    Tool tip- i wish you can do that with dropdown menu

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

    14:24 Why is there a black line between green and blue?

  • @peterpiper3291
    @peterpiper3291 3 года назад

    About tooltip, how u gonna put tooltip below button if button on top of page?

  • @susmitdas
    @susmitdas 3 года назад

    Please make video on mern/react google classroom clone.

  • @funnehhhh
    @funnehhhh 3 года назад

    Subbed

  • @confushiarch3421
    @confushiarch3421 3 года назад

    wonder if there is a rng function... one could use cirular gradient and that to animate some kind of spoke of retro snes era smoke effect or something hmmm..

  • @jonasboardwalker
    @jonasboardwalker 3 года назад +1

    “Drop some cheap sh*t” 😂

  • @peanut-butter-e1r
    @peanut-butter-e1r 3 года назад

    Make tutorial on how to create code generator.
    Eg: css or js code generator

  • @colinm3130
    @colinm3130 3 года назад

    Irony being that Safari added flex gap support on just about the same day this video came out.

  • @qwerty-wk4pz
    @qwerty-wk4pz 3 года назад

    You're a fking genius, omg I just need some more videos like that srzl. Amazing content!!! Love you

  • @huevitofeliz
    @huevitofeliz 3 года назад +1

    Why I can't use :is( ) in css???

  • @c__beck
    @c__beck 3 года назад

    Mere days after recording this video the flexbox gap property became supported on Safari and Safari iOS (caniuse.com/flexbox-gap): released April 25th…two days before this episode dropped :p

  • @ThePaulohubert
    @ThePaulohubert 3 года назад

    Change the tooltip hover, I tried for a project but I didn't manage to change the css. I assumed it wasn't native html but a part of the bootstrap I was using, so I stop.

  • @whatthefunction9140
    @whatthefunction9140 3 года назад

    I want to use a css preprocessor and use all the newest css tools, is there a tool what will let me use all the new css then compile it down to cross browser supported css?

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

    Does it only work on buttons ? i tried to an img and didn't show up the text

  • @ScaramoucheFandango
    @ScaramoucheFandango 3 года назад

    I don't understand the is ul ol section very well. Why did you have to repeat is:(ul, ol) twice?

  • @Digital963
    @Digital963 3 года назад

    Was this video just to show that you can do these things in css now OR another purpose? Yes you did say “traditionally you could only do with js” but I’d say that I’d still do it in js because it’s simpler to do in js. There’s this weird culture where devs make things more complex than they need to be & I don’t understand it 🤷🏻‍♂️ To be fair, each way of doing things can be done 100 different ways in both css & js BUT if I’m being honest there is a place & time for each as well as being better in one or the other.

    • @Digital963
      @Digital963 3 года назад

      Hold up hold up, ima just watch this again to make sure I completely understand the point before I comment again.

    • @CathrineMacNiel
      @CathrineMacNiel 3 года назад

      so you probably like Houdini? Its made in css because the layouting engine is faster than the script engine.

    • @Digital963
      @Digital963 3 года назад

      @@CathrineMacNiel I mentioned nothing about speed. I stated my preference based on simplicity. In a simple app the speed differences are negligible. You can make your argument if we’re discussing complex web apps.

    • @CathrineMacNiel
      @CathrineMacNiel 3 года назад

      @@Digital963 so it's simpler to pull several DOM operations causing several redraws than to simply write some lines of css instructions?

    • @Digital963
      @Digital963 3 года назад

      @@CathrineMacNiel yep! It’s waaaaaayyyyyyyyyyyy simpler to write any of these examples in JavaScript. Any other pointless questions?

  • @oldclient
    @oldclient 3 года назад

    I don't like CSS counters. In my opinion we should keep apart models and views. OL tag is enough for this purpose. This is a reason why most text and style formatting attributes and tags were deprecated in HTML5, right?

  • @fahad.hossain
    @fahad.hossain 3 года назад

    you are great.

  • @bvaroni
    @bvaroni 3 года назад

    Can you say Cheatsheet once more please :D

  • @Musikur
    @Musikur 3 года назад

    I just want the browsers to put the full print specifications in 😭

  • @ScaramoucheFandango
    @ScaramoucheFandango 3 года назад

    You've caught a bit of sun 🌞

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

    Make an extension for VScode like "SimplyKyle" which will automatically simplify code and offer alternatives with explanations, some kind of study assistant :D that would shake the IT study ground 100% guaranteed :D

  • @tomdevisser8150
    @tomdevisser8150 3 года назад

    Safari added support for Flexbox gaps 4 days after this video, guess someone's watching :)

  • @krtirtho
    @krtirtho 3 года назад

    Believe me I haven't been writing a single line of CSS for almost 1/2 year. Now I'm confused with :before & ::before

    • @ongke3655
      @ongke3655 3 года назад +1

      Same.
      ::before is official, :before is now supported in modern browsers

    • @greenonionsalad
      @greenonionsalad 3 года назад

      Before with a single ':' was kind of a mistake. A single ':' is meant to be for pseudo classes like hover. ::before is the more accepted way as '::' refers to a pseudo element. It's funny though as :before has more support as it was first. So whichever you'd rather.

  • @a.anvarbekov
    @a.anvarbekov 3 года назад +3

    "Your job is to simplify the web dev for us, so we like your video, then you ll make money"