CSS Units & Sizes Tutorial for Beginners

Web Dev Roadmap for Beginners (Free!): bit.ly/DaveGrayWebDevRoadmap
In this CSS units and sizes tutorial for beginners, you will learn about the common units of measurement used in CSS including px, rem, em, ch, vw, vh and % for setting sizes in your web pages.
🚩 Subscribe ➜ bit.ly/3nGHmNn
🚀 This lesson is part of a CSS for Beginners tutorial series playlist:
• CSS Tutorials for Begi...
🔗 All Resources for this CSS Tutorial Series: github.com/gitdagray/css_course
📬 Course Updates ➜ courses.davegray.codes/
CSS Units & Sizes Tutorial for Beginners
(00:00) Intro
(00:05) Welcome
(00:25) Setup
(00:51) Many CSS units to choose from
(01:27) Absolute units - pixels
(02:26) Where NOT to use an absolute value
(03:49) Where you can use an absolute value
(04:28) Relative units - percent
(07:16) rem units
(09:34) rem vs em units
(10:50) When to use em units
(12:43) ch units
(13:44) Default browser styles
(15:37) CSS Reset
(16:21) Viewport units - vw and vh
(17:35) When vw units can cause a problem
(19:52) A good use case for vh units
⚙ Web Dev Tools:
🔗 Chrome Browser: www.google.com/chrome/
🔗 Visual Studio Code (VS Code): code.visualstudio.com/
🔗 Live Server VS Code Extension: marketplace.visualstudio.com/...
🔗 vscode-icons VS Code Extension: marketplace.visualstudio.com/...
🔗 Github Themes VS Code Extension: marketplace.visualstudio.com/...
🔗 W3C CSS Validator: jigsaw.w3.org/css-validator/
🔗 Specificity Calculator: specificity.keegan.st/
📚 References:
🔗 MDN CSS: developer.mozilla.org/en-US/d...
🔗 MDN CSS Basics: developer.mozilla.org/en-US/d...
🔗 MDN CSS Selectors: developer.mozilla.org/en-US/d...
🔗 MDN - How to Apply Colors to HTML Elements with CSS: developer.mozilla.org/en-US/d...
🔗 MDN - CSS Values and Units: developer.mozilla.org/en-US/d...
📚 Color Resources:
🔗 Coolors Contrast Checker: coolors.co/contrast-checker/1...
🔗 WebAIM Contrast Checker: webaim.org/resources/contrast...
🔗 Coolors Palette Generator: coolors.co/
🔗 HTML Color Codes: htmlcolorcodes.com/
✅ Follow Me:
Github: github.com/gitdagray
Twitter: / yesdavidgray
LinkedIn: / davidagray
Blog: yesdavidgray.com
Reddit: / daveoneleven
Was this tutorial about CSS Units and Sizes for beginners helpful? If so, please share. Let me know your thoughts in the comments.
#css #units #tutorial

Пікірлер: 60

  • @DaveGrayTeachesCode
    @DaveGrayTeachesCode2 жыл бұрын

    There are many CSS units available - so many that it can get confusing! In this tutorial, we will cover the frequently used CSS units and look at examples of how they are applied to size different HTML elements on your page. We'll also look at some situations where applying a certain size or unit is not a good choice. If you are just getting started with CSS, I suggest going to the start of this CSS for Beginners playlist here: kzread.info/head/PL0Zuz27SZ-6Mx9fd9elt80G1bPcySmWit

  • @tylerengland2906
    @tylerengland29062 жыл бұрын

    Thanks Dave! As you suggested in your introduction video I started Free Code Camp recently and I'm currently in the CSS section. Your CSS videos and examples are definitely making things easier for me to understand. Your examples help bring the skills to life. I'm looking forward to the next one!

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    2 жыл бұрын

    That's great to hear! Thank you for letting me know, Tyler! 💯

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

    Thanks again for your lessons Dave! I'm trying to learn something new about coding everyday and it's a pleasure with your tutorials. Also I'd like to encourage everybody to write more comments and leave more likes for this amazing content!

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    Жыл бұрын

    Great to hear, Grigory! 💯 I'm glad I could help!

  • @godsgracedigital
    @godsgracedigital2 жыл бұрын

    Great work Dave am happy to jave come across your tutorial on this platform. Its just exactly what I wanted as i want to learn programming

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    2 жыл бұрын

    Glad to help! 🚀

  • @GabrielSouza-yy2rq
    @GabrielSouza-yy2rq Жыл бұрын

    I always enjoy your classes. Top quality!

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    Жыл бұрын

    Happy to hear that!

  • @sumedhux
    @sumedhux6 ай бұрын

    this really great tutorial, you have great teaching skills, love your videos🙏

  • @fairytail6896
    @fairytail68965 ай бұрын

    Sir, you are a wonderful teacher. I salute you.

  • @samirsamir7779
    @samirsamir777910 ай бұрын

    WAW ! Top quality Content ! Thank you for such great channel !

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

    Thanks a lot for sharing a great content!!!!! You are a great teacher!

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    Жыл бұрын

    You're very welcome!

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

    Your tutorials are so helpful, thank you!!!

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    Жыл бұрын

    Glad you like them!

  • @videopresentation1469
    @videopresentation14693 күн бұрын

    thank you Dave Gray❤❤

  • @emirr_yilmazz
    @emirr_yilmazz4 ай бұрын

    Hello, thanks for this amazing video!

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

    Thank you so much for this brilliant course. Every day I learn something new.

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    Жыл бұрын

    Great to hear!

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

    Thanks Dave ! Amazing video.

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    Жыл бұрын

    You're welcome!

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

    Thank you, Dave

  • @darkraven4207
    @darkraven42072 жыл бұрын

    Such a technical Teacher ♥️ Hope your Channel grow at a high speed.

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    2 жыл бұрын

    Thank you! 🚀

  • @darkraven4207

    @darkraven4207

    2 жыл бұрын

    @@DaveGrayTeachesCode My pleasure 🚀

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

    Very useful CSS series clear explanation thank you

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    Жыл бұрын

    You're welcome, Sona!

  • @hanafa01
    @hanafa015 ай бұрын

    thank you

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

    Awesome teacher!

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    Жыл бұрын

    Thank you! 😃

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

    I have been doing front-end development for quite some time and the most annoying thing for me is always that horizontal scroll bar when the content exceeds the view height as I usually set some value to 100vw and to solve that I have to set overflow-x to hidden in the body. Now I know what is happening. Learn something new today. Thanks, you are doing a great job.

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    Жыл бұрын

    Glad to hear that!

  • @mailsiraj
    @mailsiraj11 ай бұрын

    Dave, thanks for this great lesson - I liked your tips on when to use what very beneficial. Just an info for you, in case you have not heard it before - `em` represents the size of the letter m in print - this was mentioned in the HTML & CSS book by Jon Duckett. Not sure whether it is still true as you also explained that we have `ch` which also represents the width of a character.

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

    great tutorial keep going

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    Жыл бұрын

    Thanks, will do!

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

    Thank you!

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    Жыл бұрын

    You're welcome!

  • @9nikolov
    @9nikolov5 ай бұрын

    (02:26) Where NOT to use an absolute value Additional tip: Use `rem` units for font sizes in your CSS. When adjusting font sizes based on viewport width, modify the base font size in media queries instead of adjusting each element individually. This ensures consistent and proportional scaling throughout the design.

  • @hayksargsyan5494
    @hayksargsyan54943 ай бұрын

    Dave, when you get to padding, margin, border, box sizing, everthing gets really confusing. Maybe you could take an image to simplify what each of them is before going further. REM and EM's explanation I found very clear. Just sharing some feedback!

  • @ultimatelearn
    @ultimatelearn9 ай бұрын

    Please what material icon do you use for your vs code?

  • @CTILET
    @CTILET2 жыл бұрын

    Dave always read all comments and react to them. So don t forget to subscribe, push the like btn and write something uplifting because he deverse it😁👍👍

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    2 жыл бұрын

    Thank you - I always appreciate your support! 💯🚀

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

    UNBELIEVABLY ENLIGHTENING

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    Жыл бұрын

    Glad to hear that!

  • @ahmad-murery
    @ahmad-murery2 жыл бұрын

    Nice and quick, Another use case for absolute units could be for printing purposes when a specific measurements are required in cm, mm or in, Maybe in the future we can print directly from a web browser to a Vinyl cutter / CNC machines so that using absolute units is important I think :) Thanks Dave,

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    2 жыл бұрын

    Thanks Ahmad! I always enjoy your feedback my friend 🙏💯

  • @ahmad-murery

    @ahmad-murery

    2 жыл бұрын

    @@DaveGrayTeachesCode And I always enjoy you videos, you have such a unique teaching style and your contents are structured very well, So thank you and have a nice Day/Evening my good friend,

  • @nomer9998
    @nomer99982 жыл бұрын

    Thanks! If the site layout is in pixels, how do you convert pixels to em, rem? Can it be automated?

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    2 жыл бұрын

    You need to know the root font-size value. If it is not set, the root value is 16px in most browsers. From there, 1rem = root size. 1em is relative to the parent value. I go over all of this in the tutorial, too. 🚀

  • @frostyfreezemovies
    @frostyfreezemovies2 жыл бұрын

    Thnks sir ❤️

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    2 жыл бұрын

    Welcome! 💯

  • @frostyfreezemovies

    @frostyfreezemovies

    2 жыл бұрын

    @@DaveGrayTeachesCode sir plz upload all css videos... And thank you so much..you are osm...!! ❤️

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    2 жыл бұрын

    @@frostyfreezemovies thank you. I am still creating them. One or two per week until the series is completed.

  • @frostyfreezemovies

    @frostyfreezemovies

    2 жыл бұрын

    @@DaveGrayTeachesCode sir i want to ask something can i ??

  • @webb-developer
    @webb-developer9 ай бұрын

    done revise when vm units can cause problems + default browser styles + good use case for vh☑✅

  • @developerashed610
    @developerashed6102 жыл бұрын

    What up Dave gray Do You upload the Bootstrap tutorial ধন্যবাদ

  • @DaveGrayTeachesCode

    @DaveGrayTeachesCode

    2 жыл бұрын

    No bootstrap yet. I want to cover the foundations of CSS in this series before covering a library like Bootstrap or a framework like Tailwind.

  • @developerashed610

    @developerashed610

    2 жыл бұрын

    @@DaveGrayTeachesCode ok Thank you

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

    my reset *, *::before, *::after, :where(:not(, canvas, img, svg, video):not(svg *)) { box-sizing: border-box; margin: 0; padding: 0; display: revert; text-decoration: none; outline: none; border: none; } my font settings html, body { font-size: 62.5%; min-height: -webkit-fill-available; }