3 modern CSS techniques for responsive design
VloĆŸit
- Äas pĆidĂĄn 8. 07. 2024
- My free course, Conquering Responsive Layouts: courses.kevinpowell.co/conque...
A look at how we can use CSS comparison functions min(), max(), and clamp() for responsive layout techniques, plus a look at Utopia, a fluid type scale that we can use in our projects!
đ Links
â Utopia Fluid Type Scale: utopia.fyi
â SmolCSS - minimal snippets for modern CSS layouts and components: smolcss.dev
â Modern CSS: moderncss.dev
â vmin and vmax: âą CSS Units: vh, vw, vmi...
â Timestamps
00:00 - Introduction
00:47 - widths with min()
02:53 - padding and margin with max()
06:50 - typography with clamp()
09:10 - fluid type scales with Utopia
#css
--
Come hang out with other dev's in my Discord Community
đŹ / discord
Keep up to date with everything I'm up to
â www.kevinpowell.co/newsletter
Come hang out with me live every Monday on Twitch!
đș / kevinpowellcss
---
Help support my channel
đšâđ Get a course: www.kevinpowell.co/courses
đ Buy a shirt: teespring.com/stores/making-t...
đ Support me on Patreon: / kevinpowell
---
My editor: VS Code - code.visualstudio.com/
The theme I use: Atom One Dark
---
I'm on some other places on the internet too!
If you'd like a behind the scenes and previews of what's coming up on my CZcams channel, make sure to follow me on Instagram and Twitter.
Twitter: / kevinjpowell
Codepen: codepen.io/kevinpowell/
Github: github.com/kevin-powell
---
And whatever you do, don't forget to keep on making your corner of the internet just a little bit more awesome!
margin-inline instead of margin : 0 auto is so much clearner ! thank you Kevin for your videos, learning new things every single time, keep doing what you do !
Ditto!
Yeah this tip is awesome
The nice thing is that you will never override margin top and bottom with it. đ
@FinnDefault the end result is the same but in your code it allows you to not overwrite margin top / bottom values, cleaner !
Dude! I went like, "Why don't I know that?" Freaking cool!
Super-duper pro tip: at 1:15 and 3:53 you mention that the min() and max() functions choose between two options/values, but both of those functions can actually accept more than two parameters, and will return the minimum/maximum of _all_ passed values.
Very good point! I should have mentioned that đ
I started my web dev course a few months ago from 0 to hero :-) i almost finished my first website and tomorrow i wanted to start my media queries for my website. Im stoked that i found your page! I have learned a lot last hour. Keep it up!
I will highly recommend the conquering responsive layouts course by Kevin Powell. I took the course and completed the side projects (very tiny, mini course that's loaded with great stuff). Believe me, my CSS improved beyond what I imagined. Thanks Kevin!
Could you share the link for the course!
@@mahipalsinhdabhi9223 Check in the description.
Yeah, it kinda makes my CSS fundamentals stronger, highly recommended!
@@smz702 I found it :D
Great tip.
Big fan of your channel. I'm an old guy, been programming for about 45 years (starting with Assembler and COBOL on mainframes.) I try to catch all of your videos.
margin-inline and clamp just blew my mind. đ€Ż Thank you!
Thank you!!! You definitely make CSS much more fun as well as easier to figure out! This video was especially helpful to me right now, as I am working on a project where I need to use clamp() for the typography. Your explanation along with the Utopia Fluid Type Scale resource has made it so much easier and quicker.
last video this year? thank you once again for all the love for CSS and sharing it with us. CU next year !
Happy new year!
Love the work you do Kevin - you have helped so many people - thank you
Ok, I already missed the times I changed something I always did, just by watching your videos! Thanks for enlightening us with these small but valuable tips.
You literally uploaded this vid while i was studying Media Queries and Responsive designs ... I was like woohoo what a magical coincidence đ
Love đ
Of all the CZcamsrs I follow, Kevin is the most deserving of patreon support. Excellent information, delivered excellently. Excellent dude!
Like a lot of other people have said this video has taught me a thing or two! Many thanks for sharing it
I describe you beyond a mere CSS evangelist. You're a philanthropist as well, 'cause You share with us a top-tier invaluable content for free, so my gratitude in advance KP.
Thank you! And Happy new year!!
Kevin is on đ„. Thanks a lot for sharing your work!
That fluid type scales is a game changer for me!
*Thank You so much* Sir you improved my UI, *Thank You đ*
Thanks for the fluid fonts tip. It's a problem I faced in my last project. It was really frusterating. I had a very nice looking h1, I opened mobile view for testing and... BOOM, an uglily big h1 is covering half the screen. Also thanks for the min/max tip it will really change the way I write css.
ĐŃĐșŃŃ ĐŽŃŃжД , ŃĐ” бŃĐ»ĐŸ ĐŽŃжД ĐșŃŃŃĐŸ !
Thanks for this BIG opportunity to get a free course (Conquering Responsive Layouts) from the master of CSS KP!
Man your videos are amazing. I always learn new things watching your videos. Thank You
max and min property is new for me i see first time thats greate and its very helpfull thank for sharing your knowledge sir.
Thank you very much for the recommended sites for training . They are fantastic!
Thanks Kevin! Helped me solve a problem at work that's been there a couple weeks lol
Excellent tutorial Kevin!
Great content, always fun and useful. Thanks a lot
Amazing tip and tools as always! Thanks
A big big big big like again! Thank you Kevin!
Thank you Kevin, really helpful. Greetings from Argentina
I usually avoid using css functions aside from calc( ), looking forward for more css next year!
Why?
You're the best!! Thanks for all Kevin
I've used clamp() in the past but ran into issues with Safari and Chrome for iOS 11.3-13.3. You can create the same effect using min(max()) method instead (especially with responsive font size),
Example: min(max(, ), ) creates a fallback way if you need to support as many systems as possible.
Thanks for the video Mr Powell
Thank you so much for sharing these valuable tips with us.
That font size tool is super cool, I'm gonna start using it for sure
This is cool! Thank you so much kevin
BROOOO THANK YOU SO MUCH THAT WAS FROM MY BIGGEST WEAKNESS POINTS UR MY SAVOIR â„
Thanks for all the great information!!!
Thanks so much!
I dont know how to say thank you .Kevin This is amazing
The Chuck Norris of CSS does it again! Thank you for yet another usefull tutorial, I bet your viewers are falling in love with CSS a little more day by day :D.
Thanks Kevin for this useful info â€ïž
Man you deserve subcribe! You save my project ass sm
I always had problems with CSS but with your videos I think I can become better with it. Thank you, Kevin.
Thank You Very Much đ
Thank you so much!. Very useful for me.
Thank you! Itâs sop amazing all the things you can do compared to what i learnt in the past
Aww clamp() solves a problem I was previously super proud to have solved in more complex ways. Its hard to let go, but I guess it will be worth it!
Thanks, brilliant
You are our CSS Mentor
Thank you so much â€ïž I think trick this very good
Very interesting, thnx for you work
it's really really wonderful video thank you so so much for this wonderful tricks â€â€â€
Thanks for such amazing videos.. hope you was one my faculty! đ
Cheers Kevin!
Amazing video ! like always ! and happy new year , wish you and your family good and healthy life â€â€â€
Hi, thanks for the videos.
Why I don't see this video before... đŻ It amazing !! đ
I always feel so smart when I successfully use clamp(),min(), max().
Nice T-Shirt! Totally agree! :D
Iâm so delighted for all of these responsive values and possibilities but when coding in real time I tend to forget a few and kick myself later. Clamp, min() max(), minmax() for grid, %s, viewport units, vmin vmax, then the behaviour with flex and grid where the children will stretch by default , itâs a lot. Something I really intend on mastering (along with using more obscure selectors)
as always you rock!
nice, thank you )
awesome Powell
Bahut khub kevin bhaiya
Happy New year my friend.
Thanks â€
đvery good Kevin
Thanks for using Vite đ
Great job
Happy new year
Love the shirt Kevin!
thanks!
Thank you
Thank you so much!
Nice T-Short ! )
quick tips for making a webpage responsive
for width rem
Instead of using hardcore width use max-width which is more responsive,
padding in em,
don't fix height,
but in some cases if you want to fix height use min-height,
for making font responsive use (font-size: clamp(2rem, 1rem + 10vh,5rem)) ,
we can use the same method for making padding responsive using (clamp)
Osm ... it's very nice dear
Thanks!
Thank you!
have a good new year!
Thanks, you too!
Great Tutorial on modern CSS techniques. Thanks, Kevin
{2022-01-07}
loved your resource sir now i dont have to scratch my head for responsive font which taked me like a our do this s###
Superb helpful. I know the deal is to design by oneself and to test a lot, but I was wondering if there are some kind of "default" settings or specific parameters to start with, kind of css starter template
Thanks You Kevin That was Very Helpful !! I was Wondering if u could do a tut about building a CSS Framework That would be awesome !!
Hi Kevin! Thank you so much for your videos, i love them :)
I've got a question tho regarding the usecases of clamp or min max while coding mobile first. Is it changing something or can we use it the same way? Thank you again for your amazing job here!
Loving the t-shirt đ€Ł
Thank you for the presentation. Notice that I need to refresh my old CSS skills. What are the prerequisites in a CSS structure for your examples to work?
See bro đ, The only one thing i need to say is `You're Awesome`
Love the t-shirt đ€Ł
cool video)
Love that t shirt :D
Super...
Thanks. Great content. Please, why is repeat(auto-fit, minmax(min-value, max-value) not working when max-width of a specific value is applied to the same element?
I signed up for your free 21 day responsive layout challenge.
Thanks for the content!How have you done that nice title? Amazing...
Oh,, Man.... U r a God in CSS đđ Happay Ending 2021#
Mr. Kevin, do you recommend I use the fluid font trick you showed above in Large/Commercial sites
;) Kevin, you did it again. Made me laugh when I realised what's on your tshirt. :oD Nice one ;) Cheers !
Awesome shirt.
Great video Kevin, would you please consider making a video on how would all this responsive techniques translate to accessibility? like what can be done to have a fluid responsive site that is also accessible.
Brilliant video, great tips. Does using the min and max settings effect layout shift measurement in lighthouse?
Not that I know of, but I never dug in there... but also never had something come up that made me think that might be the issue.
Nice video Kevin! Do you have any suggestion or explanation on whether to use min() and max() or min/max-height and min/max-width? Sometimes I get confused about what's better to use. Thanks :)
You could always use both :
.foo { max-width: min(12rem + 22vw, 68rem); min-width: min( 8rem+1vmin, 11.5rem); }
or similar