Truly Fluid Typography with 1 CSS PROPERTY!

Тәжірибелік нұсқаулар және стиль

bit.ly/2IPcPgA - Become a frontend developer (50% off limited time!)
-- Want to learn UI/UX? designcourse.com
-- Today, we're going to be checking out a really cool new function for CSS called clamp(). It allows you to specify 3 parameters (a minimum value, a fluid value, and a maximum value). This effectively allows you to create fluid typography, white space, etc..
More reading:
caniuse.com/?search=clamp
dev.to/vtrpldn/write-fewer-me...
0:00 - Introduction
1:25 - An awesome offer from Scrimba
1:55 - Using Clamp()
7:00 - Outro
Let's get started!
- - - - - - - - - - - - - - - - - - - - - -
Subscribe for NEW VIDEOS!
Learn UI/UX: designcourse.com
My personal FB account: logodesigner
Coursetro FB: coursetro
Coursetro's Twitter: / designcoursecom
Join my Discord! / discord
^-Chat with me and others
- - - - - - - - - - - - - - - - - - - - - -
Who is Gary Simon? Well, I'm a full stack developer with 2+ decades experience and I teach people how to design and code. I've created around 100+ courses for big brands like LinkedIn, Lynda.com, Pluralsight and Envato Network.
Now, I focus all of my time and energy on this channel and my website Coursetro.com.
Come to my discord server or add me on social media and say Hi!

Пікірлер: 124

  • @DesignCourse
    @DesignCourse3 жыл бұрын

    Do you use clamp() in production? PS: Check out the new designcourse.com to enter your email. It will be released shortly!

  • @yogeshdevaggarwal

    @yogeshdevaggarwal

    3 жыл бұрын

    Yes!!

  • @AmandaLucaseu

    @AmandaLucaseu

    3 жыл бұрын

    I will now 👌🏻

  • @LabhamJain

    @LabhamJain

    3 жыл бұрын

    So Awesome 😍

  • @k-techdev8992

    @k-techdev8992

    3 жыл бұрын

    where is Trad Braversy avatar ?

  • @Anton-cv2ti

    @Anton-cv2ti

    3 жыл бұрын

    It's not supported on iPhone 5 and 6, so not quite, but soon.

  • @lisins2kill
    @lisins2kill3 жыл бұрын

    The 90 percent property was line clamp not the clamp function. Min and max have more support, and clamp resolves as max( x, min(y, z)) per mdn.

  • @earthlydigital5248
    @earthlydigital52483 жыл бұрын

    This is hands down the simplest and best solution I've found. Thank you so much.

  • @kvncnls
    @kvncnls3 жыл бұрын

    Seriously man, I love how you upload these tutorials just as I'm learning something related to it. It's like you're watching my progress. Kinda creepy, but helpful LOL..

  • @juliantoscani548
    @juliantoscani5483 жыл бұрын

    EXACTLY what I was looking for! Thanks Mate!

  • @abdullokhmukhammadjonob3891
    @abdullokhmukhammadjonob38913 жыл бұрын

    At right this moment I was learning fluid typography, but in other methods. This one seems best of them. Thanks dude.

  • @ricardorien
    @ricardorien3 жыл бұрын

    Thanks Gary! you always awesome!

  • @theman7050
    @theman7050 Жыл бұрын

    Finally, I understand! Thank you very much.

  • @fr3847
    @fr38473 жыл бұрын

    simple and effective! using it for my portfolio right now!

  • @dgloria
    @dgloria3 жыл бұрын

    Extremely useful and a must have.

  • @mehmetemin5404
    @mehmetemin54043 жыл бұрын

    I loved it Gary, thanks.

  • @sumedhmohod2564
    @sumedhmohod25643 жыл бұрын

    Wow its really amazing thanks bro u helped me alot with responsive web hope u will upload more videos.

  • @narcos1024
    @narcos10243 жыл бұрын

    I'm rebuilding my website and this new feature is really good. Thank you for the tip. :)

  • @cmnweb
    @cmnweb3 жыл бұрын

    Finally i will stop using calc() in sass, greetings from Mexico.

  • @helloestouaqui3438

    @helloestouaqui3438

    3 жыл бұрын

    Search the min() and max() functions in CSS

  • @BabyYoda5555
    @BabyYoda55553 жыл бұрын

    This is cool! Thanks for sharing. Now I gotta update my landing page and marketing pages.

  • @omaryassir5885
    @omaryassir58853 жыл бұрын

    Damn bro, the new intro is sick 🔥

  • @AlDawoode
    @AlDawoode3 жыл бұрын

    Helpfull video as usual.

  • @HellGamer777
    @HellGamer7772 жыл бұрын

    I never thought it was that easy HAHAHAHA, thank you man, you saved me hours

  • @hitthecity2
    @hitthecity23 жыл бұрын

    Hi! first of all congrats for your scrimba excellent courses. Just one question: if I put margin in 'ems shouldn't the follow the varying font size already?

  • @danielbark
    @danielbark3 жыл бұрын

    Really coool stuff!

  • @ramiandrisoaandriamandrant7239
    @ramiandrisoaandriamandrant72393 жыл бұрын

    Helpful so thank you guy

  • @UniqueBots
    @UniqueBots3 жыл бұрын

    Wow that's cool I will be using that a lot in my new code.

  • @chrissbenitez
    @chrissbenitez3 жыл бұрын

    Awesome 🔥🔥🔥 thanks a lot

  • @andresfrr100
    @andresfrr1003 жыл бұрын

    Really useful!

  • @ihajo
    @ihajo3 жыл бұрын

    Amazing feature great video just when I was wondering if we gonna really have an easier way to do a responsive web design 😁

  • @castlemoyle
    @castlemoyle3 жыл бұрын

    Very useful and clearly presented (as usual... grin). Pretty soon and we'll be able to have totally responsive pages and sites with no breakpoints.

  • @migueldomingos4570

    @migueldomingos4570

    3 жыл бұрын

    With grid, flexbox and clamp you rarely need to use media queries

  • @whipstitchwebwork1383
    @whipstitchwebwork13833 жыл бұрын

    Good shit. Keeping up with css is something most of us don't do enough...

  • @amoggoma430
    @amoggoma4303 жыл бұрын

    thanks, very helpful

  • @ngalladiouck7924
    @ngalladiouck79243 жыл бұрын

    It makes my live a lot easier 👌🏾

  • @sumandevulapalli7042
    @sumandevulapalli70423 жыл бұрын

    Thank you

  • @eldyko
    @eldyko3 жыл бұрын

    Wow I love this

  • @DooDootGaming
    @DooDootGaming3 жыл бұрын

    Thanks

  • @trimbotee4653
    @trimbotee46533 жыл бұрын

    Nice one Gary! Great video!

  • @SKaren-lz9sc
    @SKaren-lz9sc3 жыл бұрын

    Wow, I like it new chanel logo

  • @poooooow
    @poooooow3 жыл бұрын

    Wow, thx!!

  • @patroclus8796
    @patroclus87963 жыл бұрын

    Gary you have taken over from brad traversy hah. I love your videos man you've helped me tons thank you!

  • @Grabster
    @Grabster3 жыл бұрын

    Whoa! New logo? Intro? Damn

  • @CodingUnited
    @CodingUnited3 жыл бұрын

    What editor font do you use? I just switched from consolas to cascadia and I like it after 4 years with consolas.

  • @codeSTACKr
    @codeSTACKr3 жыл бұрын

    clamp is a game changer!!

  • @W1ndshades
    @W1ndshades3 жыл бұрын

    Clamp() sounds great, but what happens if I want to make a zoom-in of the entire browser? If I working with VW I don't have access to the root font-size. So, need I to sacrifice the possibility of zoom-in/zoom-out if I want to have a dynamic font-size?

  • @rafaelperes4140

    @rafaelperes4140

    2 жыл бұрын

    I think you can add a + 1rem or whatever on that vw and it will allow it, like that h1 { font-size: clamp(40px, 5vw + 1 rem, 70px }; This might work for the zoom-in thing

  • @anoop.225
    @anoop.2252 жыл бұрын

    On what basis will decide how much vw use? If I wanted to fit font size between 1000px to. 1920px screens with 16px to 28px accordingly. If I use rem for both value is it possible to limit font size even I change browser appearance font settings ?

  • @tonypatino1765
    @tonypatino17653 жыл бұрын

    YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSs, this will help so much

  • @1306dk
    @1306dk2 жыл бұрын

    Is it possible to use the clamp property und its parameters for variables inside scss for example? So you could set a variable like $header: clamp();

  • @MoayadChannel
    @MoayadChannel3 жыл бұрын

    My best channel just uploaded…

  • @ced4841
    @ced48413 жыл бұрын

    insane!

  • @zooom4462
    @zooom44623 жыл бұрын

    Thank you for the tutorial! Btw, I am completely new to programming ( i am learning adobe photoshop/xd to become ui designer). What kind of coding program should I learn first? Is css a good place to start? Or are there something easier I can try? 🤔

  • @frizm1543

    @frizm1543

    3 жыл бұрын

    css and html are the easiest to start off with

  • @francescob.3019
    @francescob.30193 жыл бұрын

    if I may, I'm not a fan of how you laid this out. I'd explain it this way: the actual size clamp is assigning to the property is the middle value (in this case 5vw), that is how it gets fluid. Then clamp says that it should stop resizing when it hits the low or the high value. I like it better this way.

  • @lourenxoweb6348

    @lourenxoweb6348

    3 жыл бұрын

    Thanks for the clarification, I got so confused.

  • @bhuvaneshdesai3053
    @bhuvaneshdesai30533 жыл бұрын

    Browser support? Can I use this in react project without worrying of clamp works or not for all browsers? Is there a css pollyfill?

  • @shashwatgupta_
    @shashwatgupta_3 жыл бұрын

    Calc(12px +2vw) ; calc() is also a great way to make typography fluid 👍

  • @kobod

    @kobod

    3 жыл бұрын

    So that would be the same like clamp, but without a maximum size, right?

  • @shashwatgupta_

    @shashwatgupta_

    3 жыл бұрын

    Yes without the maximum size . Honestly i haven't faced any issues with the maximum size my headings never really gets too big when i use this calc() i usually play around with values . But nevertheless clamp is better

  • @rathernotdisclose8064
    @rathernotdisclose80643 жыл бұрын

    I've been using calc(16px+1vw) or something similar. I like this clamp version tho..

  • @jameshagooddesigndevelopme7819
    @jameshagooddesigndevelopme78193 жыл бұрын

    Fluid typography has been driving me crazy lately.

  • @redrising2104
    @redrising2104 Жыл бұрын

    aaah...so good

  • @onlineuniversity3718
    @onlineuniversity37183 жыл бұрын

    Does middle unit has to be View Port(vw) width? Can it be PX or % ?

  • @ahmedali006
    @ahmedali0062 жыл бұрын

    what difference does it make if we used max and min width just asking to clear my concept

  • @rickyu1978
    @rickyu19783 жыл бұрын

    is there a polyfill or prefix for ie11?

  • @anifowosehabeeb4716
    @anifowosehabeeb47163 жыл бұрын

    I swear if you say linod... Oh.. scrimba. I love scrimba🥰

  • @shahreazneeloy2119
    @shahreazneeloy21193 жыл бұрын

    really really cool...just 1 line to fix this big problem.

  • @balazskoti2603
    @balazskoti26033 жыл бұрын

    What if you set your base font size with clamp and then use rem-s and em-s for all the different properties throughout your code (margin: 2rem; font-size: 1.5em)?

  • @anon5992

    @anon5992

    3 жыл бұрын

    that is a greate idea

  • @alexlytle089
    @alexlytle0893 жыл бұрын

    This is cool but its really hard to have fine control. The middle value which is the preferred value. It's really hard to understand exactly what pixel value is the vw is. I think this is great for a quick fix

  • @jonathanpiet
    @jonathanpiet3 жыл бұрын

    Very cool indeed! The 'caniuse' that you looked at however is for 'line-clamp' which is something completely different. Clamp is included in here: caniuse.com/css-math-functions with browser support currently at 88%

  • @antoniostarace78
    @antoniostarace783 жыл бұрын

    Is line-clamp the same as clamp()? The first has 95% support, the second 77%. The syntax you're using looks like the second.

  • @Anton-cv2ti

    @Anton-cv2ti

    3 жыл бұрын

    Nope, he showed the wrong support table. Support for clamp() is 77%, but it is supported in all browsers, so that number will soon be 95% The only real slowdown is missing support on Iphone 6 and earlier.

  • @ginthozan
    @ginthozan3 жыл бұрын

    I'll see you size 😂, This video is cool ❤

  • @martin_E79

    @martin_E79

    3 жыл бұрын

    The man got CSS (font-size) on his mind you know ;)

  • @michaelsd28
    @michaelsd282 жыл бұрын

    great hack

  • @ssk7690
    @ssk7690 Жыл бұрын

    media query without js?

  • @abduljabbar4249
    @abduljabbar42493 жыл бұрын

    Please also upload how to make the ReactJS website responsive.

  • @nikoma_
    @nikoma_3 жыл бұрын

    Clamp recently saved me bc our main client is blocking style tags so I can’t use media queries any more.

  • @mudrank4184
    @mudrank41843 жыл бұрын

    5th New intro need more effects

  • @piyushvaidya5086
    @piyushvaidya50863 жыл бұрын

    hail to the algorithm gods!

  • @christianrudder4826
    @christianrudder48263 жыл бұрын

    life saver jesus

  • @DanailKirilov
    @DanailKirilov3 жыл бұрын

    I see you size soon!

  • @karangill2065
    @karangill2065 Жыл бұрын

    Your voice was clamp() 🤣

  • @user-nq4ho4hp5v
    @user-nq4ho4hp5v9 ай бұрын

    vw is good but causes issues when zooming in and out

  • @justingiovanetti
    @justingiovanetti3 жыл бұрын

    The thing is .... smaller viewports don’t need smaller fonts. And making a header super large on a large viewports is just filling space for filling space sake.

  • @castlemoyle

    @castlemoyle

    3 жыл бұрын

    Of course not. He was just showing you what you could do, not what you necessarily should do. (edited to change the 2nd could to should, which is what I meant.)

  • @MrMasteryder
    @MrMasteryder3 жыл бұрын

    I don't really get the middle parameter

  • @MrMasteryder
    @MrMasteryder3 жыл бұрын

    1:30 "in case you've been living under a rock" So why are you telling me about it? since I'm supposed to know anyways... hmm

  • @RavMucha
    @RavMucha3 жыл бұрын

    Ah, now life has a meaning!

  • @Zero-oq1jk

    @Zero-oq1jk

    3 жыл бұрын

    I'm not sure if your sentence have a right scale. Try to use clamp() on it.

  • @XiagraBalls
    @XiagraBalls3 жыл бұрын

    Oh, and it's not a beta CSS feature either - already supported in Chrome, Edge and FF.

  • @x3mmusic1
    @x3mmusic13 жыл бұрын

    looks like my IDE doesnt recognize this function in scss files

  • @soorajkj1564

    @soorajkj1564

    3 жыл бұрын

    Also my vs doesn't recognise this function

  • @kingnonnnnn
    @kingnonnnnn3 жыл бұрын

    truly fluid typography is possible since years without clamp and without any javascript. just use 2 breakpoints for the min and max values and calc for the rest. but the clamp() makes it much easier :)

  • @thedahaby
    @thedahaby3 жыл бұрын

    Where is Linode ??!!

  • @yurisamarin8200
    @yurisamarin82003 жыл бұрын

    hah its really works

  • @eRick-lv9zj
    @eRick-lv9zj3 жыл бұрын

    667k subscribers and so few views?

  • @DexterLolInd
    @DexterLolInd3 жыл бұрын

    I think you showed the wrong caniuse, it's actually this, and the support is 80% for clamp 88% for min/max: caniuse.com/css-math-functions

  • @cball97
    @cball973 жыл бұрын

    Eh! You’ve been able to produce fluid values and font sizes using sass for years. I have a mixin I’ve used on projects for the last 3 years. No doubt this is slightly easier as you don’t need scss

  • @TomHermans

    @TomHermans

    3 жыл бұрын

    You could do it even without sass, just with calc. Clamp is even better though.

  • @mosesnandi
    @mosesnandi3 жыл бұрын

    Not a game changer...but pretty cool

  • @bendyamin86
    @bendyamin863 жыл бұрын

    I thought this was gna be about Line clamping...

  • @MilanDrazic
    @MilanDrazic3 жыл бұрын

    Response typography? impossible!

  • @woodywoodz628
    @woodywoodz6283 жыл бұрын

    To scale the text properly in a smart way was one of most annoying issues during the last years. This property was more than necessary.

  • @ManeelxAkosAdor
    @ManeelxAkosAdor3 жыл бұрын

    This is good but I deduce it can be a fuckery when clamping multiple inline elements..

  • @j.k24
    @j.k243 жыл бұрын

    IE still a problem in 2020 🤣

  • @shafii
    @shafii3 жыл бұрын

    It's nice to have on your backpocket, but I really don't see any use for it. It's not like a regular user's gonna resize the browser window enough to notice that it's even there at all.

  • @BC-zl3ez

    @BC-zl3ez

    3 жыл бұрын

    Not for people resizing the browser, but instead different resolutions. Nice alternative to media query hard break

  • @dhimandepanshu
    @dhimandepanshu3 жыл бұрын

    I think that the total percentage of IE users are no one but developers and companies only who want to make their websites IE compatible. The real users might not even care about IE. Whatever the statistics shows, maybe it's just the developers

  • @simmslabs
    @simmslabs3 жыл бұрын

    151st Liker

  • @redacted1946
    @redacted19463 жыл бұрын

    This seems good in the surface but is a horrible poor mans fluid typography. Unfortunately there is no right way to do it. Using viewport units should be bad practice. Because not everyone has text just in the viewport container. That's the problem. The size of the container is irrelevant, so it'll be too small or too large in a container depending in the viewport. What if almost identical items had different sized containers? What if the site was responsive and shifts more content to the sides as the viewport width increases to a threshold making the main content container smaller than before. All this would be solved if there was a unit representing the container size but there isn't. Using clamp($, 3vw, $) is bad practice and should only rarely be used (if the text is definitely using the entire viewport as its container which is very uncommon). The solution ive come up with so far is using em units, and then the ResizeObserver js lib to read if the container changed size, read container width, divide by 10, and set it as the inline container font size to influence the text child elements use of em. Its the closest option and its horrible, but at least it actually does its job. Stop using vw as font sizes.

  • @MrAndi1281
    @MrAndi12813 жыл бұрын

    First

  • @AleksandarIvanov69
    @AleksandarIvanov693 жыл бұрын

    I am just wondering, are the people behind CSS just allergic to good, meaningful, appropriate names ? Clamp ? wth...

  • @jamieprescott100

    @jamieprescott100

    3 жыл бұрын

    Clamp describes exactly what the function does so I don't see what the problem is?

  • @titoriano1

    @titoriano1

    3 жыл бұрын

    Clamp is a common term for many languages that have this behavior....

  • @jepriazonda4017
    @jepriazonda4017 Жыл бұрын

    Thanks

  • @alex-suciu
    @alex-suciu3 жыл бұрын

    very cool stuff. if only it had support on that blasted IE.. :|

  • @jamieprescott100

    @jamieprescott100

    3 жыл бұрын

    Microsoft are telling everyone not to use IE so you shouldn't be using it anymore :-)

  • @alex-suciu

    @alex-suciu

    3 жыл бұрын

    @@jamieprescott100 it's not me who is using it. but rather clients of that certain company website. ( 2-3% but they still are )

Келесі