calc() lets you do some real CSS magic

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

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

  • @biomcanx1
    @biomcanx1 5 лет назад +158

    Awesome thanks! The only thing I would add is how important the spaces around the ' + ' are in the calc. It will not perform a calculation if they are not there. Everyone else may know this already, but it bit me for a little bit trying to figure it out.

    • @KevinPowell
      @KevinPowell  5 лет назад +10

      Good point Gene, I probably should have talked a bit more about the very basics of it right off the top before diving in deeper.

    • @franktielemans6624
      @franktielemans6624 5 лет назад

      @Gene Price that's right, you can't also have a space between the calc function and first opening bracket.
      @@KevinPowell Did you ever experiment with calc and CSS variables?
      I tried to and it seems that you can define variables to a calculation but you can't calc with the variables. At least I don't know how.

    • @kolklik
      @kolklik 5 лет назад +1

      @@franktielemans6624 Sure you can calc with variables/custom properties.
      jsfiddle.net/aLs8zv5h/

    • @donyaafshar-j1q
      @donyaafshar-j1q 29 дней назад

      you literally saved my life. i was struggling for 2 days . huge thanks

  • @ynnoz4452
    @ynnoz4452 5 лет назад +67

    My favorite calc() trick is this one : html{ margin-left: calc(100vw - 100%); }
    It removes the "windows jumping" when a scrollbar on the right pops in or out. Perfect for variable/interactive layouts.

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

      How could I use Calc, to preserve the height and width of a image. I am making an ePub, and the picture pass to another Page and it show clipped.

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

      @@kuranam 2 years late but you don't need calc - you can use `aspect-ratio` (or `object-fit: contain`, though that won't change the height/width, it'll only keep the image undistorted)

  • @jenstornell
    @jenstornell 5 лет назад +20

    That's an awesome trick. I tested it today and even made it fluid. It may look hackish but it works as expected now.
    `--wrap-padding: calc(
    32px + (128 - 32) * (100vw - (var(--min-width) * 1px)) / (var(--max-width) - var(--min-width))
    );
    width: calc(100vw - var(--wrap-padding) - 17px);
    max-width: 1200px;
    margin: 0 auto;
    @media screen and (max-width: 320px) {
    width: calc(100vw - 2rem - 17px);
    }
    @media screen and (min-width: 1200px) {
    width: calc(100vw - 8rem);
    }`

  • @jmerino06
    @jmerino06 4 года назад +3

    I have been coding websites for almost 20 years. watching your videos reminds me i have a lot to learn. thank you for the time, skills and know how you share on every video.

  • @thehigherman9918
    @thehigherman9918 5 лет назад +72

    The video is about calc(), But I also learned about viewport and vh and vw. This really saved a website I had to restore.

    • @YungSchmutz
      @YungSchmutz 5 лет назад +2

      Samesies

    • @badihbarakat5832
      @badihbarakat5832 5 лет назад +1

      I learned a couple of new css attributes I didn't know about. I didn't even know I can hide the scroll bars without affecting the flow of the contents...

  • @milleniummoses
    @milleniummoses 5 лет назад +9

    Not only do I have a better understanding of how calc works, but you also answered my (unasked) question about making headline text responsive without so media queries.

  • @crooker2
    @crooker2 5 лет назад +4

    That breakout div is great for creating dynamic content. I build cms sites for clients, but the content they enter is always contained in a bootstrap container.
    This gives me the option of allowing clients to build their own wide block WITHOUT having to break out of the container and re-instating it.
    Great tip! Thanks, Kev!

  • @sonydroid2253
    @sonydroid2253 4 года назад +1

    Kevin, I want to take this time and opportunity to say a genuine heartfelt thank. Sharing your passion on RUclips is helping me understand how the modern web is built. My sites are responsive with a modern stylish feel now. I even have confidence to secure paid work now. X

  • @MoeBass
    @MoeBass 5 лет назад +40

    I was introduced to object-fit with this video, and the break out of container technique was clever!

    • @GnomePuntTrainerYT
      @GnomePuntTrainerYT 5 лет назад +1

      The break out container technique is mindblowing to me. I won't have to wrap a div or section or something around the text that I'd like to give a background for.

    • @120tonns
      @120tonns 5 лет назад +1

      developer.mozilla.org/en-US/docs/Web/CSS/object-fit

    • @violet-trash
      @violet-trash 3 года назад

      Object-fix is amazing, I can't believe I spent so long making divs with image backgrounds like a sucker.

  • @alextheblockchaindev
    @alextheblockchaindev 5 лет назад +36

    The calc() function is really awesome indeed! Great tutorial Kevin! 👍👍👍👍👍👍👍👍👍👍

  • @Tryanide
    @Tryanide 5 лет назад +12

    Calc is great in many places, but sometimes there's simpler solutions. In the case of the big-image, instead of using a "complicated" calc(-50vw + 50%) (which is, arguably, difficult to understand, especially for newcomers), simply use margin: 0 -3em instead. This will also pull the image 3em to the left and 3em to the right (the combined 6em you subtract from your container). One thing to keep in mind when using techniques like these or when working with EM units in general: local font-size changes on an element will override the EM size inherited from parents. If possible, try to make your lives easier by using REM whenever you can.

    • @laht93
      @laht93 5 лет назад +3

      Using calc(-50vw + 50%) does have the advantage of working within any parent container, no matter the width. You could make it a class to put on things, (almost) regardless of context.

  • @moy2010
    @moy2010 5 лет назад +40

    To prevent the horizontal scrolling issue, I do the following with css calc:
    calc(100% + calc(100vw - 100%))

    • @KevinPowell
      @KevinPowell  5 лет назад +5

      Hrm, never would have thought of that, cool :)

    • @stepanostapuk4120
      @stepanostapuk4120 5 лет назад +1

      Calc in Calc bad work for IE and Safari

    • @radoslawzielinski9016
      @radoslawzielinski9016 4 года назад

      which rule do you apply that to please?

    • @franktielemans6624
      @franktielemans6624 4 года назад +1

      @@radoslawzielinski9016 to the html element or body element i guess

  • @5tevend
    @5tevend 4 года назад

    I work for an event app / event website company and we have a left-sidenav that displays on desktop by default with a width of 320px, that can collapse to being around 60px wide. sometimes i need to create a square container so i often find myself using calc functions, or wrapping calcs for max-widths, i had a client the other week who didn't like how when the left-sidenav was collapsed things flexed and stretched, so another useful trick there was width:calc(100vw - 320px); and then wrap that calc function in another calc such as width:calc( calc(100vw - 320px) / 2); so if i have a container with specific info/ a cta it doesn't flex at any point, i can then set it's max width as well so i have this fixed point for larger screen sizes, which if you want to save time could also be made into a css-variable for easier use so you can have --widget-width:calc(100vw - 320px); and use it in the realms of width:calc(--widget-width / 2) or 3 or 4 or etc; and a max width of lets say 1200px, although in this example this is only really used in a media query for min-width tablet and onwards i've found some use to it, especially if you need to make scalable square pieces, then you can do @media(orientation:landscape) { div { width:calc(100vh - 2em); } } and for portrait width:calc(100vw - 2em);

  • @techscoville
    @techscoville 5 лет назад +1

    Really awesome, I remember trying the calc( ) function, it was tricky, but it now clear and simple

  • @boombaby1769
    @boombaby1769 5 лет назад +3

    Awesome! I've been working with CSS for quite a while now, but this feature was completely off my radar. This will be VERY useful for me, thank you!

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

    I been looking everywhere for these very examples. Thanks!

  • @erezspeiser4976
    @erezspeiser4976 4 года назад

    Awesome video. I stumbled upon it by accident and it solved a problem I had for a long time and thought it could not be solved. Thanks! Great channel!

  • @bruhcsp
    @bruhcsp 5 лет назад +2

    Perfect!!! I loved what you did with the font-size!

  • @MisterMajister
    @MisterMajister 5 лет назад +1

    THANK YOU! Just made my image gallery so much easier to handle. Now I can simply mix padding in px's to my img-width in percentage: width:calc(50% - 12px); since I have a 6px padding on each side. Looks exactly as I want it to!

  • @novachi09
    @novachi09 5 лет назад +2

    This is sooo helpful, honestly. I didn't even look specifically for this but I'm glad it poped up in my recommended section

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

    Life changing for images and headings!

  • @fluntimes
    @fluntimes 4 года назад +1

    I can definitely see myself using that full width thing. The alternative is to make a whole bunch of divs that are full width with an inner to constrain content when necessary. Calc() rocks!

  • @danielelgressy
    @danielelgressy 5 лет назад

    very calm and accurate explanation :) really like your videos , short ,and professional

  • @klaasvaak4110
    @klaasvaak4110 5 лет назад

    The black & white picture on 0:48 is the HQ of ABN AMRO in Amsterdam.

  • @kolklik
    @kolklik 5 лет назад +1

    About the issue with the vw calculations leaving your item to suck up space behind the scrollbar, it's possible to overcome this.
    If you dont need to worry about IE its fairly simple.
    The general idea is to calculate the width of the scrollbar using a bit of javascript,
    then using css custom properties which can be updated by javascript, and used in the margin calculation.
    Below is a link to a codepen that shows the technique.
    codepen.io/anon/pen/JVJjzX
    For those who doesn't want to go look, this is what the margin expression would look like.
    margin: 0 calc(-50vw + (var(--scrollbar-width) / 2) + 50%);
    In english this would translate to:
    "Move it half of the viewports width out.
    Move it in by whatever the scrollbar-width divided by 2 is.
    Then move it further in by half of its own width"
    In order to calculate the scrollbar width you generate a div, with a width that is greater than whatever the scrollbar could possibly be (say 100px)
    then you get that divs offsetWidth (outer width) and the clientWidth (innerWidth)
    By subtracting those two numbers, you have the width that the scrollbar occupies.
    This can then be used to update the css custom property through document.documentElement.style.setProperty.
    A working example can be seen in the codepen linked above.
    Having the width of the users scrollbar can be quite handy :-)

  • @AdolfoBarreto75
    @AdolfoBarreto75 5 лет назад +1

    Yes! I've been waiting for this one. THANK YOU! Haven't watched it yet but I know it will be good!

  • @busyrand
    @busyrand 5 лет назад +1

    Very nice tutorial. First time I've ever seen a clear practical use for the calc function.

  • @PeggyOConnor1946
    @PeggyOConnor1946 5 лет назад +2

    You are a talented master teacher. Kudos. This tip was useful to me immediately.

  • @jamesrosemary2932
    @jamesrosemary2932 5 лет назад +1

    How could I have been living my life without this?

  • @brunoliveiralcantara
    @brunoliveiralcantara 5 лет назад

    Really good function. Congratulations on your video!

  • @sshuddho
    @sshuddho 4 года назад

    Tried to use vw as font size, but it was horrible on small screen. This "+ rem" will really help. Thanks Kevin!

  • @philmyglass877
    @philmyglass877 5 лет назад

    This is brilliant, another tool in the belt. Thanks so much!

  • @jovaniedelacruz
    @jovaniedelacruz 5 лет назад +1

    Subscribed! That vw and break out container image is super cool

  • @mohan9285
    @mohan9285 4 года назад

    Awesome :)
    I normally use calc() for calculating the height of a container/div and give overflow-y: auto for getting scroll.
    It helps me in calculating dynamically according to the other content on the page.
    In your video, I liked the way how we can get the section out from container and styling those. pretty cool.

  • @lewiekab
    @lewiekab 5 лет назад +1

    I always wanted to know how fittext worked. Very cool.

  • @noelabey
    @noelabey 5 лет назад +2

    5:00 forward the fun starts. I subscribed and hit that bell

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

    Very good Kevin, Thank you!

  • @VovaBlow
    @VovaBlow 5 лет назад +3

    *Dear Kevin, your lessons are awesome! Hello from Ukraine!*

  • @holalabellebille
    @holalabellebille 5 лет назад

    C'est la vie, c'est incroyable ! thanks from france...
    - Getting out of the container is great.
    - Object-fit (i didn't know about !) is huge.
    Merci chef.

    • @KevinPowell
      @KevinPowell  5 лет назад

      De rien! And if it's easier for you to write comments in French, go for it. I can read it no problem, I just can't write it to save my life 😂

    • @stell4you
      @stell4you 5 лет назад

      "Object-fit" is not supported by edge, so you might wait until MS switches to webkit engine.

    • @KevinPowell
      @KevinPowell  5 лет назад +1

      It's supported by Edge for images, just not video

  • @badihbarakat5832
    @badihbarakat5832 5 лет назад

    Ur the best, Kevin... I've learnt a long more from this video than just the calc()... Many thanks... 😁

  • @FrankEBailey
    @FrankEBailey 5 лет назад +3

    The, er, hidden gem here is the 'overflow-x:hidden' to sort out the 100vw issue, which is going to fix some mobile SEO issues on a couple of client's sites for sure. Thanks for this video!

    • @Max_Griswald
      @Max_Griswald 5 лет назад +1

      My god, this was such a lifesaver for me...

  • @soultouchingsongs
    @soultouchingsongs 5 лет назад

    Awesome video.. that container close and open was a bit too much.. now got a solution with this video. Thanks a million!

  • @TheBorsten
    @TheBorsten 5 лет назад +1

    Great Tipps there, Thank you!
    Especially the font-size trick is really handy.
    I want to make a suggestion though: To position stuff it’s far less expensive on the rendering (performance) to use transforms rather than margin. You could litterally See the stuttering when resizing the viewport.
    Margin affects the layout while transforms only touch composite layers.

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

      Yes, i noticed the stuttering too. Can you share the transform code to do the same thing?

  • @yallayeho1238
    @yallayeho1238 5 лет назад +1

    i used it for Containers, which are on the same Level. for example: width: calc(100% / 3) dir Three Containers

  • @JohnMcCormack
    @JohnMcCormack 5 лет назад

    Really nicely explained, Kevin.
    Thank you!

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

    Thank you Kevin!

  • @shohanrahman9392
    @shohanrahman9392 4 года назад

    4:50 when he uses max-width: 100vw, how come it only fills up the right side and not the entirety of the viewport width?
    Is it because some other property (like margin-left) overrides it?

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

    Great info, as usual.

  • @marv92
    @marv92 5 лет назад

    I came here to kill some time watching some nice tips & tricks and that outside the box thing actually solved one of my biggest pains ever. Thank you so much!

  • @mkmalikcom
    @mkmalikcom 5 лет назад +4

    wow.... loved it
    you are great

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

    Cool one :-)
    Thanks @Kevin

  • @lewisrobinson508
    @lewisrobinson508 5 лет назад +1

    I've been playing with calc() and custom properties to generate responsive font sizes while being able to set a min/max font size. Eg.
    :root {
    // font sizes
    --fsMin: 16;
    --fsMax: 26;
    // viewport widths
    --vwMin: 420;
    --vwMax: 1280;
    }
    html {
    font-size: calc((var(--fsMin) * 1px) + (var(--fsMax) - var(--fsMin)) * (100vw - (var(--vwMin) * 1px)) / (var(--vwMax) - var(--vwMin)));
    @media screen and (max-width: 420px) {
    font-size: calc(var(--fsMin) * 1px);
    }
    @media screen and (min-width: 1280px) {
    font-size: calc(var(--fsMax) * 1px);
    }
    }
    ----
    codepen: codepen.io/lewisvrobinson/pen/VWoNLP?editors=0100

    • @KevinPowell
      @KevinPowell  5 лет назад

      Really cool. That initial font-size calculation broke my head a little, lol. Works super well!

  • @Brandonstiles
    @Brandonstiles 5 лет назад

    Great video! I learned a lot!

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

    Thank you for the awesome video Kevin 🙏🏻🙏🏻
    calc() is so complicated though 😵‍💫😵‍💫

  • @leogarza5022
    @leogarza5022 5 лет назад

    This was very informative! Thank you for sharing!

  • @StefanIvanov188
    @StefanIvanov188 4 года назад

    Hey Im trying to find out how Facebook new design calcs the widh of images containers on their Newsfeed. If you inspect the photo you will see parent div who haves for example if the original width of image is 500x321 then the calc is width: calc(-506.231px + 155.763vh); I can't find out where the "-506.231px" and 155.763vh; are coming from....

  • @VideoNOLA
    @VideoNOLA Месяц назад

    I'm about to take a deep dive into the math functions that are available inside calc(), and wonder if you've already done a tutorial on those?

  • @harag9
    @harag9 5 лет назад +1

    Having been out of web development for over 10 years, calc is something I wished for back in the day and the vw/vh values. Now having to relearn css again with new updated tricks like this it would be nice to know what browsers support this? I don't want to be using features like this if e.g IE / Edge don't support it.

    • @KevinPowell
      @KevinPowell  5 лет назад

      caniuse.com is awesome, gives the browsers, as well as relative usage. Nice thing with this is, even if it doesn't work in IE, it won't break your site, unlike some other properties

    • @harag9
      @harag9 5 лет назад

      @@KevinPowell Excellent, thanks for the link to the site - never heard of it before :)

  • @OutOfNameIdeas2
    @OutOfNameIdeas2 5 лет назад

    Shared and liked! Thank you for sharing this!!!

  • @michaeloosthuizen2383
    @michaeloosthuizen2383 5 лет назад +6

    I always learn at least one useful thing when watching your videos.

  • @RockstahRolln
    @RockstahRolln 5 лет назад

    This is Terrific!! Thank You!

  • @dean6046
    @dean6046 5 лет назад

    Thank you Ross! Good video

  • @annagulaev
    @annagulaev 5 лет назад

    Is there a way to cap the font size? It'd be easy if max() was still available. Without that, how do you prevent a huge font on an 8K monitor? :) I use a resize function to re-calculate font sizes, and if not for the maximum font size issue I'd be able to replace the resize function with calc.

    • @KevinPowell
      @KevinPowell  5 лет назад

      I really wish we had that! And maybe one day, I've heard talk, but for now a media query gets the job done

  • @drewbird87
    @drewbird87 5 лет назад

    Thank you for giving me something new to love!

  • @Griesinho
    @Griesinho 5 лет назад +1

    Thx so much for this tutorial... and your other ones as well 🤘

  • @billaddison82
    @billaddison82 5 лет назад +1

    Object fit, unreal!

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

    Thank you kevin,I learnt a new trick today.
    can we use CSS variables in Calc() like below?
    ex: font-size: calc( var(--title-fontSize) - 8px);
    I tried but not working for me.
    thanks.

  • @nonchalant8473
    @nonchalant8473 5 лет назад

    Great tutorial. Thanks!

  • @ahsath
    @ahsath 5 лет назад +2

    Almost didn't click on this video, I'm glad i did.

  • @czawiel
    @czawiel 5 лет назад

    awsome mate! thanks a lot!

  • @moizkhalid2714
    @moizkhalid2714 5 лет назад +1

    Could you tell us how to start html and css for website templates in psd.. How to aprouch

    • @KevinPowell
      @KevinPowell  5 лет назад

      I have a few series where I do that! Look for my 'building a responsive page' type series.

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

    Can calc use the existing value of an element property?

  • @franktielemans6624
    @franktielemans6624 5 лет назад

    Awesome stuff!

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

    Is it possible to use calc() to calculate height based on width? I mean, I'd like to set height = width or height = 40% of width. Is it even possible in pure CSS or SASS?

  • @himanshuverma3764
    @himanshuverma3764 4 года назад

    Sir You have to make new layout on topics calc() thanks
    when i declare width: clac() its is necessary to declare width or not i am confuse sir

  • @rushikeshmore21
    @rushikeshmore21 4 года назад

    Hi Kevin, please make video on RFS how it works? And how to use it ?

  • @ShaunGreiner
    @ShaunGreiner 5 лет назад

    Calc is really useful, but if you're looking to make grid systems CSS Grid is super useful and easy to pick up. You can also easily reflow content with media queries for mobile.

  • @mo3ad96
    @mo3ad96 5 лет назад +1

    margin: 0 calc(-50vw + 50%)
    is 50% mean 50% of its width wich is equal to 100vw?
    so 50% - 50% = 0?

    • @mo3ad96
      @mo3ad96 5 лет назад

      is 50% mean 50% of the width of its container?

    • @KevinPowell
      @KevinPowell  5 лет назад +2

      50% is 50% of it's width before the calculation is done. Basically, it's moving the margin to 50%, so right dead in the middle of the parent, and then it's pulling it back the other way 50vw, so both sides get pulled out to the edge of the screen.

  • @markjordan7800
    @markjordan7800 5 лет назад

    using calc with big fonts is super useful ;)

  • @farhanawan9956
    @farhanawan9956 5 лет назад

    Will you please help me out i have created a product webpage every product has share button so when i click on one product share button so all the product expand there social link this the problem

    • @KevinPowell
      @KevinPowell  5 лет назад +1

      Sounds like they are all being targeted, instead of the individual ones. Head over the community (link in description), it'll probably be a lot easier to trouble shoot.

    • @farhanawan9956
      @farhanawan9956 5 лет назад

      @@KevinPowell there is an app which is installing right

    • @farhanawan9956
      @farhanawan9956 5 лет назад

      @@KevinPowell i have join that now

  • @Valky1954
    @Valky1954 5 лет назад

    Thanks for this, learned something new :)

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

    Hi Kevin, I was researching on calc() and I realized that calculation can still work with or without the word calc() in the css. And I see from the start of your video, you also omitted it from the width. So I am wondering if you can tell me what is the implications if we omitted it as I couldn't find any website that talks about that. Thanks

  • @vjvizar
    @vjvizar 5 лет назад

    Cool tricks, thanks! :)

  • @0the0ambient0
    @0the0ambient0 4 года назад

    As a calc believed, thank you!

  • @xmelsky
    @xmelsky 5 лет назад +2

    Very useful function

  • @Alessandro-nq3tm
    @Alessandro-nq3tm 5 лет назад +1

    Amazing, best web tutorials on yt!! Please Kevin can you do a pro video about the scss mixins?

  • @moza260
    @moza260 4 года назад

    this one is awesome...!!

  • @TheElkster
    @TheElkster 5 лет назад

    really interesting!!!! will be having a play! :)

  • @aaronaaronaaron5922
    @aaronaaronaaron5922 5 лет назад +2

    o_o dude, you really know about tracks. Thanks ;)

  • @farhanawan9956
    @farhanawan9956 5 лет назад

    Awesome thank you so much!

  • @rahultirkey7950
    @rahultirkey7950 4 года назад

    How to cut the image diagonally?

    • @KevinPowell
      @KevinPowell  4 года назад

      clip-path is probably the easiest :)

  • @mo3ad96
    @mo3ad96 5 лет назад

    when i set max-width: 100vw; it doesn't take 100vw ?
    it takes 100% of the container not document width
    can someone tell me why

    • @KevinPowell
      @KevinPowell  5 лет назад

      What's the width? Max width is the biggest it can get, it can be smaller. Min-width would be the smallest it's allowed to be

    • @mo3ad96
      @mo3ad96 5 лет назад

      but it worked with div

    • @mo3ad96
      @mo3ad96 5 лет назад

      ​@@KevinPowell hi thank you and now when i set the min-width to 100vw it takes 100vw and not 100% of its container

  • @crunckNATIon
    @crunckNATIon 5 лет назад +2

    awesome....i had no choice but to subscribe...great content

    • @KevinPowell
      @KevinPowell  5 лет назад +1

      Thanks for the sub, glad you liked it :)

  • @FER_R
    @FER_R 5 лет назад

    Just came across this video and subscribed t0 your channel. Really cool content! I will have to play around with it. As a few people here said in the comments, I came for one thing and learned a bunch in the process. Do you know how supported this would be in HTML emails? Most of the CSS I write is tailored to that and I was curious if you had tried it. Thanks.

  • @technophile7024
    @technophile7024 5 лет назад

    Thanks for your hard work and dedication for us! Nice tutorials! May I know which keyboard are you using?

    • @KevinPowell
      @KevinPowell  5 лет назад +1

      It's an old Dell mechanical keyboard. I don't know the model and I'm not on my computer right now, but if I don't answer this now I probably won't see your comment again :\. I did a quick google search, found some that look similar, but I didn't see my exact model

    • @technophile7024
      @technophile7024 5 лет назад

      @@KevinPowell Thanks for your swift response! Don't worry! I loved your tutorials!

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

    awesome vid :)

  • @lucastavares206
    @lucastavares206 5 лет назад +5

    I didnt know css had function
    It seems that i have a lot of ground to cover, since none of the courses i've taken mentioned that

  • @alinisar87
    @alinisar87 5 лет назад

    Hey Kevin, great video. I have a question (not related to calc though), what do you think of using % units (e.g. font-size: 140%; ) for setting fonts of different elements, after setting main font in html selector as font-size: 16px?

  • @chrisclinejax
    @chrisclinejax 5 лет назад +1

    here is another nice use. goes along with some of what was done here
    css-tricks.com/snippets/css/fluid-typography/

  • @a.joshatt7518
    @a.joshatt7518 5 лет назад

    Thanks for great tuts. I just begin to learn css, could anybody please tell me why that margin:0 calc(-50vw) will move image out of left, instead of out of BOTH of left and right? - I think margin:0 calc(-50vw)=margin:0 calc(-50vw) 0 calc(-50vw).

    • @KevinPowell
      @KevinPowell  5 лет назад

      The margins are getting pulled in both directions (if you did it with a div with background color on it, it would make more sense). You just don't see it on the right side because it isn't stretching the image out :)

    • @a.joshatt7518
      @a.joshatt7518 5 лет назад

      Thanks for your help! I need some time, setting up a snippet to test this.