This changed how I use media queries

Поділитися
Вставка
  • Опубліковано 26 вер 2024

КОМЕНТАРІ • 107

  • @quizmastergary
    @quizmastergary 6 місяців тому +88

    Love exploring your content. I was today years old when I realised your intro is “Hello my front-end friends” and not “hello my friend and friends” as my brain chose to mishear it. 😂

    • @Thor6398-jt4mb
      @Thor6398-jt4mb 6 місяців тому +8

      I realized that a month or two ago, when he did a logo for front-end friends. Mind-blowing stuff.

    • @philwatts
      @philwatts 6 місяців тому +1

      Same! 😄

    • @NamVu-im2xm
      @NamVu-im2xm 6 місяців тому +1

      Same 😂

    • @peterpan47511
      @peterpan47511 6 місяців тому

      Same!

    • @yousefwaleed3955
      @yousefwaleed3955 6 місяців тому

      Wait .. does he say front-end and not friend 😐

  • @DebopriyoBasu
    @DebopriyoBasu 6 місяців тому +8

    Wow! I think I know CSS and now I see I don’t know it well enough. Thanks! A lot to discover!

  • @VeitLehmann
    @VeitLehmann 6 місяців тому +8

    Nice, I also didn't know that this was possible. However, it breaks one major benefit of your original approach: You can't use custom properties in the definition of container queries or media queries, so you have to hard-code the column count and column width.

    • @KevinPowell
      @KevinPowell  6 місяців тому +4

      Yeah, waiting for the day when custom media queries actually gain support! They are in the spec, afterall

    • @muisadinam9615
      @muisadinam9615 6 місяців тому

      @veitLehmann, that's actually what I asked myself watching to the end of the video. Thx for the comment. That makes the solution less perfect than I initially thought :/

  • @igordasunddas3377
    @igordasunddas3377 6 місяців тому +7

    I love this. While media- and container-less design is nice, I really appreciate this kind of approach, because thats CSS how I know it. Never knew one could use calc for the breakpoint value. I wonder if one can use variables in there, too....

    • @KevinPowell
      @KevinPowell  6 місяців тому +6

      Sadly, no 😞. Custom media queries are in the spec, but so far, no one has implemented them

  • @alexpanteli3651
    @alexpanteli3651 6 місяців тому +3

    This is awesome. Please post more tricks like this

  • @ElectricKota
    @ElectricKota 6 місяців тому +1

    WOW 👏👏 thank you, this is best discovery I completly missed

  • @BlackxesWasTaken
    @BlackxesWasTaken 6 місяців тому

    Every single time I think "Ohh yeah I actually have good knowledge of css" BOOM you upload something and increase it :D nice one!

  • @lyon-dev
    @lyon-dev 6 місяців тому

    You're awesome Kevin! Thank you for the video! 😊

  • @yahayaoyinkansola8258
    @yahayaoyinkansola8258 5 місяців тому

    This is really cool to know, didn't know CSS has evolved this much

  • @RobertMcGovernTarasis
    @RobertMcGovernTarasis 6 місяців тому

    Thank you to your both, you have both helped me learn today

  • @easysolutions8628
    @easysolutions8628 6 місяців тому +1

    Thanks for the video Sir❤

  • @TheItamarp
    @TheItamarp 6 місяців тому +2

    Really cool approach. Can you use a variable for column count in the media query calc?

    • @KevinPowell
      @KevinPowell  6 місяців тому

      Sadly no 😞

    • @rorymax
      @rorymax 6 місяців тому

      No but with something like SASS you could create them in a loop!

  • @gio2156
    @gio2156 6 місяців тому

    Awesome approach, definitely gonna try it and test it out; i think this enables using media breakpoints as css variables; if it is so - it's mindblowing - currently i postcss for this

    • @KevinPowell
      @KevinPowell  6 місяців тому

      Sadly we still can't use variables in there....

    • @einatblackrose
      @einatblackrose 6 місяців тому

      Same here. I think people working on small to medium size websites should familiarize themselves with postcss, it really is a great and easy solution for those who don't want to dig into sass / less etc.

    • @gio2156
      @gio2156 6 місяців тому

      @@einatblackrose Agree, actually i think postcss is really powerful when using along with sass (sass compies scss to css and then postcss comes in play), thus you can use features of both sass and postcss, which is really neat; i have been using them together for like 6-7 months without a problem

    • @einatblackrose
      @einatblackrose 6 місяців тому

      @@gio2156 That's interesting, I never thought of using them together. What can postcss add in addition to the capabilities of sass?

  • @clamhammer2463
    @clamhammer2463 6 місяців тому

    You can use this together with clamp to make some cool stuff too

  • @sampathbasnayake7149
    @sampathbasnayake7149 6 місяців тому

    Thanks Kevin
    Could you please advise how I could center the last item if I use a grid.

  • @Jarrod0067
    @Jarrod0067 6 місяців тому

    now all we're waiting on is using custom :root properties as conditions

  • @einatblackrose
    @einatblackrose 6 місяців тому

    Thank you and Miriam for this. Have you tried it with postcss yet? I wonder if this would allow to use it with variables.

  • @Linuxdirk
    @Linuxdirk 6 місяців тому +4

    I should totally dig deeper here. Never used grid before, though. Only flexbox.

    • @KevinPowell
      @KevinPowell  6 місяців тому +7

      You could use this for flexbox stuff too! I just used this for a quick example :)
      But, I'd also say to definitely dive into grid! You won't regret it!

    • @mikeysd
      @mikeysd 6 місяців тому

      @@KevinPowell Absolutely. I held off on learning grid for a few years. Wish I hadn't.

    • @einatblackrose
      @einatblackrose 6 місяців тому +1

      It took me a while to really dig into grid, and honestly I'm still more comfortable with flexbox, but grid opens a world of new options for advanced layout, and often times just saves on some code writing (such as less divs) which is cool, you should give it a try.

    • @georgesaunders3532
      @georgesaunders3532 6 місяців тому +1

      ​@@mikeysd grid is so powerful for templating pages quickly, and to be able to change the format of them quickly. Was a game changer when I learnt how to use it

  • @deatho0ne587
    @deatho0ne587 6 місяців тому

    Doing the math for the gap and verry much short hand
    .class
    --c: 3;
    --w: 20ch;
    --g: 1rem;
    --m-w: calc(var(--w) * var(--c) + var(--g) * (var(--c) - 1))
    @media/@container (width > var(--m-w))

    • @DannyHobo
      @DannyHobo 6 місяців тому

      you can't use variables in the media query

    • @deatho0ne587
      @deatho0ne587 6 місяців тому

      That means I am not the biggest fan of it, since it is not as modular.

  • @francoisguezengar6255
    @francoisguezengar6255 6 місяців тому

    Cool to know it's possible. What's the difference with repeat(auto-fill/auto-fit, minmax(200px, 1fr)) in this case ?

  • @tomaz-laurensoft
    @tomaz-laurensoft 6 місяців тому

    \o/ Kevin CSS Things nobody can miss that 😂😊😊

  • @kotlapallihemanth1629
    @kotlapallihemanth1629 6 місяців тому

    How to make the border width with respect to size of element (either width or height of element) and also font-size with respect to size of element in which it is present

  • @utkarshchaturvedi7948
    @utkarshchaturvedi7948 6 місяців тому

    Nice concept

  • @not_amanullah
    @not_amanullah 6 місяців тому

    thanks ❤

  • @hellohell143
    @hellohell143 6 місяців тому

    please talk about devin a first ai software engineer what is your perspective

  • @tymiller2596
    @tymiller2596 6 місяців тому +2

    What is the "ch" in the @container query?
    In other words what does 30ch stand for?

    • @einatblackrose
      @einatblackrose 6 місяців тому +2

      ch = character, essentially a single letter of your text

    • @tymiller2596
      @tymiller2596 6 місяців тому

      @@einatblackrose thank you so much man.

    • @ormuriauga
      @ormuriauga 6 місяців тому +1

      specifically, 1ch is the width of the glyph '0' in the used font, like 1ex is the height of the glyph 'x'.
      I think this is taken from the current font-size for all values except if you use them in specifying font-size, which will instead evaluate it in terms of the parent font-size just like when you use "em" (of course, what else could it mean?)

  • @FarazFKhan
    @FarazFKhan 6 місяців тому +1

    Can you have a font always take up the full width of a responsive parent div?

    • @KevinPowell
      @KevinPowell  6 місяців тому +1

      Without JS, not that I know of

  • @jamjam3448
    @jamjam3448 6 місяців тому

    Thanks 🎉

  • @RandomGeometryDashStuff
    @RandomGeometryDashStuff 6 місяців тому +1

    03:57 which font @media queries use for ch and ex units?

    • @KevinPowell
      @KevinPowell  6 місяців тому +1

      If it's a media query, it'll use the default font + size in the browser. If it's a container query, it uses that containers font and size

  • @RaphaelGolin
    @RaphaelGolin 6 місяців тому

    I know you are exploring, and I like that, but I feel that overall we are now making webpages as if they were accessed in a accordion, that is constantly changing width while browsing 😅

  • @itxpphere
    @itxpphere 6 місяців тому

    Thnx 👍👍

  • @justkailash
    @justkailash 6 місяців тому

    BTW how much safe is to use Container query? or still should we use media-query?

  • @loathesome_pilk_drinker
    @loathesome_pilk_drinker 6 місяців тому

    Haha, this is awesome!

  • @jennifershen4273
    @jennifershen4273 6 місяців тому

    Awesome!

  • @vac1e
    @vac1e 6 місяців тому

    May somebody help me out from which video does the first solution comes from?

  • @theophiled
    @theophiled 6 місяців тому

    Would be great if css variable where working inside of media/container queries, they could inherit from :root ..

    • @ormuriauga
      @ormuriauga 6 місяців тому

      In my opinion, without thinking it all the way through, I'd like it to evaluate variables in the context of the specific container that is being tested.

  • @thebeginner613
    @thebeginner613 6 місяців тому

    Hi,
    I have a doubt that,
    I am mern stack developer and a beginner from india.
    Using tailwind is better than css or not..?
    If concentrate more on tailwind, will it help more to get a job...?

  • @clevermissfox
    @clevermissfox 6 місяців тому +1

    Will it be possible to use custom properties within queries ? EG
    @container (width > var(-col-size)){…}

    • @KevinPowell
      @KevinPowell  6 місяців тому +2

      We'll *eventually* have custom media queries... it's in the spec: www.w3.org/TR/mediaqueries-5/#custom-mq - when it will happen, I don't know :( - I also don't know if we'll be able to do it like you put, but I hope we'll be able to do something like that.

    • @VeitLehmann
      @VeitLehmann 6 місяців тому +1

      @@KevinPowell I can't wait! That's a major missing piece, and I didn't know they are working on something like this.

  • @henrijohansson2482
    @henrijohansson2482 6 місяців тому

    I tried to use variables ones inside media query and it totally failed. I think that would be really useful. I wonder if it will work inside the calc()

  • @imralav
    @imralav 6 місяців тому

    Couldn't "repeat(auto-fill, ...)" be used here instead?

    • @zip753
      @zip753 Місяць тому

      it would then create a different number of columns depending on the available width, while here it's specifically going from 1 to 3 after the specific column width is exceeded

  • @keithprice3369
    @keithprice3369 6 місяців тому

    Is the point if "* 3" so it's clearer that you're looking for 3 columns of 200px vs just having 600, where that's not obvious?

    • @KevinPowell
      @KevinPowell  6 місяців тому +1

      Yeah, the 600 is kind of magic numbery, whereas if you do it like this, it's more explicit. Same thing, if you're doing the math in your head, but also allows for other units and less thinking on our end 😅

  • @REDISCOVERTHEWORLD
    @REDISCOVERTHEWORLD 6 місяців тому

    please make one more projects of full responsive website i have just started your course to develop full website responsive but that’s very old please make more videos i want learn all the possible ways to make responsive website quickly and very smooth. I’m stuck and only you can help me

    • @KevinPowell
      @KevinPowell  6 місяців тому +1

      That course is older, but what it teaches is timeless as so much of it is about taking the right mindset into how to do things. I have a few more recent videos with larger builds too

    • @REDISCOVERTHEWORLD
      @REDISCOVERTHEWORLD 6 місяців тому

      @@KevinPowell Thanks Kevin glad you replied,yes i agree though that course is old but its worth watching,i am very fascinated watching your videos.I must say your the "CSS EXPERT GURU"

  • @omkargarde5867
    @omkargarde5867 6 місяців тому

    Every time i make my portfolio website you drop new a new way to make layout vedio, but can you make a vedio on how to select color scheme and font vedio please?

    • @KevinPowell
      @KevinPowell  6 місяців тому

      When you say select, do you mean come up with a color scheme and pick fonts? I've covered both :D - ua-cam.com/video/mq8LYj6kRyE/v-deo.html and ua-cam.com/video/zUMAjJ88NJ0/v-deo.html

    • @omkargarde5867
      @omkargarde5867 6 місяців тому

      @@KevinPowell yes, I did thanks

  • @mathew-sunny
    @mathew-sunny 6 місяців тому

    Why can't we use custom properties inside nth selectors

    • @KevinPowell
      @KevinPowell  6 місяців тому

      There are a few places we can't use them, sadly

    • @einatblackrose
      @einatblackrose 6 місяців тому

      Just curious to know how would you use them?

    • @mathew-sunny
      @mathew-sunny 6 місяців тому

      @@KevinPowell 😐

  • @nomadshiba
    @nomadshiba 6 місяців тому +1

    we need mixins

    • @KevinPowell
      @KevinPowell  6 місяців тому

      There's a proposal by Miriam Suzanne for them, so it's sort of in the works!

  • @lenarnie2973
    @lenarnie2973 6 місяців тому +1

    I do not understand, try it in real project

  • @raj080288
    @raj080288 6 місяців тому

    what is the difference between a media and container query?

    • @einatblackrose
      @einatblackrose 6 місяців тому +1

      Kevin has some videos about it, I'd recommend you to look for them

  • @SRG-Learn-Code
    @SRG-Learn-Code 6 місяців тому

    How you dare to have a class named wrapper... #WWAD

    • @KevinPowell
      @KevinPowell  6 місяців тому

      What would Adam do? 😂

    • @einatblackrose
      @einatblackrose 6 місяців тому

      @@KevinPowell Let's be honest - he would call it wrapper...

  • @LokiGodOfMischief.
    @LokiGodOfMischief. 6 місяців тому

    First

  • @kinetic_pixels
    @kinetic_pixels 6 місяців тому +1

    Kevin, The Wizard Mathematician....who dabbles in CSS for fun 😆