CSS Units & Sizes Tutorial for Beginners

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

КОМЕНТАРІ • 66

  • @DaveGrayTeachesCode
    @DaveGrayTeachesCode  2 роки тому +6

    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: ua-cam.com/play/PL0Zuz27SZ-6Mx9fd9elt80G1bPcySmWit.html

  • @9nikolov
    @9nikolov 7 місяців тому +2

    (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.

  • @tylerengland2906
    @tylerengland2906 2 роки тому +5

    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 роки тому +4

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

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

    You are the best teacher I have ever seen man! Keep up with the good work

  • @Grihlo
    @Grihlo 2 роки тому +5

    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!

  • @hadibq
    @hadibq 2 місяці тому

    Dave, your teaching skills are outstanding! TY for your sharing!

  • @godsgracedigital
    @godsgracedigital 2 роки тому +3

    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

  • @darkraven4207
    @darkraven4207 2 роки тому +4

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

  • @GabrielSouza-yy2rq
    @GabrielSouza-yy2rq Рік тому +2

    I always enjoy your classes. Top quality!

  • @prayashansa4957
    @prayashansa4957 Рік тому +1

    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.

  • @fairytail6896
    @fairytail6896 7 місяців тому

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

  • @elvispontes4165
    @elvispontes4165 Рік тому +1

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

  • @ChristiaanKoppelaar
    @ChristiaanKoppelaar Рік тому

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

  • @videopresentation1469
    @videopresentation1469 2 місяці тому

    thank you Dave Gray❤❤

  • @mailsiraj
    @mailsiraj Рік тому

    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.

  • @destinybarber7920
    @destinybarber7920 Рік тому

    Your tutorials are so helpful, thank you!!!

  • @sumedhux
    @sumedhux 9 місяців тому

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

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

    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!

  • @samirsamir7779
    @samirsamir7779 Рік тому

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

  • @sonamohialdin3376
    @sonamohialdin3376 2 роки тому

    Very useful CSS series clear explanation thank you

  • @Khansaheb6969
    @Khansaheb6969 Рік тому

    Thanks Dave ! Amazing video.

  • @TravinskiyVladislav
    @TravinskiyVladislav Рік тому

    Thank you, Dave

  • @CTILET
    @CTILET 2 роки тому +2

    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😁👍👍

  • @emirr_yilmazz
    @emirr_yilmazz 7 місяців тому

    Hello, thanks for this amazing video!

  • @hanafa01
    @hanafa01 7 місяців тому

    thank you

  • @ahmad-murery
    @ahmad-murery 2 роки тому

    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,

  • @andromilk2634
    @andromilk2634 2 місяці тому

    Just to make sure I understood the reason for the horizontal scrollbar : width: 100vw; does not take into account the extra vertical scrollbar which added itself after the full width of the viewport (100vw) and so, to be able to "see it", it creates a horicontal scrollbar, like if there was an overflow of text? And the reason the width: 100% does not create the horizontal scrollbar is because it takes into account as part of the 100% the extra content/vertical scrollbar and hence it does not consider there is actually an overflow in this case? Thanks

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 місяці тому +2

      It's been over a year, so I don't remember my exact examples without watching myself. That said, if you remove everything inside your HTML body tag - an empty page - the body element still has browser applied margins. In Chrome, it is 8px on all sides. You can follow along with this example. Applying width: 100% or 100vw by itself will NOT create a horizontal scrollbar on the page. However, as soon as you apply a height of 100vh, you trigger a vertical scrollbar. The addition of the vertical scrollbar now makes the width apply a scrollbar because the full width is larger than what is displayed thanks to the vertical scrollbar. I have a video that is dedicated to all of this as well: ua-cam.com/video/dpuKVjX6BJ8/v-deo.html

  • @ultimatelearn
    @ultimatelearn Рік тому

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

  • @webb-developer
    @webb-developer Рік тому

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

  • @muharremtozan3635
    @muharremtozan3635 2 роки тому

    Awesome teacher!

  • @sha8888
    @sha8888 Рік тому

    UNBELIEVABLY ENLIGHTENING

  • @iambrijeshtoo
    @iambrijeshtoo Рік тому

    Thank you!

  • @khalilbenmeziane8836
    @khalilbenmeziane8836 Рік тому

    great tutorial keep going

  • @nomer9998
    @nomer9998 2 роки тому

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

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 роки тому +1

      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. 🚀

  • @developerashed610
    @developerashed610 2 роки тому

    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

  • @frostyfreezemovies
    @frostyfreezemovies 2 роки тому

    Thnks sir ❤️

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 роки тому +1

      Welcome! 💯

    • @frostyfreezemovies
      @frostyfreezemovies 2 роки тому

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

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 роки тому +1

      @@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 ??

  • @ecomadvisor.
    @ecomadvisor. 24 дні тому

    Set Seed on 1.25x

  • @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;
    }