Тёмный

Simple Explanation Of rem & em CSS Units 

Traversy Media
Подписаться 2,3 млн
Просмотров 119 тыс.
50% 1

In this video I give a simple explanation of the rem & em CSS units of measurement. We also talk a little bit about vh (viewport heights) and vw (viewport widths).
BECOME A PATRON: Show support & get perks!
/ traversymedia
ONE TIME DONATIONS:
www.paypal.me/t...
VISIT MY WEBISTE:
www.traversymed...
$15 COUPON LINKS FOR ALL MY UDEMY COURSES:
www.udemy.com/...
www.udemy.com/...
www.udemy.com/...
FOLLOW TRAVERSY MEDIA:
/ traversymedia
/ traversymedia
/ traversymedia
/ discord

Опубликовано:

 

30 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 281   
@TraversyMedia
@TraversyMedia 7 лет назад
Had a little time this morning and I have had a lot of questions from people asking about the rem unit in my last video. Hopefully this clears things up. Have a great Sunday everyone!
@josefinagonzalez3527
@josefinagonzalez3527 7 лет назад
You are the greatest man! i'm taking my time doing the Angular4 Udemy course! but this little gems (videos) are equally great! thanks again man! Greeting from south america :D
@propeller
@propeller 7 лет назад
thabnks for this tutorial! but i can't see a practical use-case for using rem. what's the benefit besides of changing html font-size in chrome.
@tdg710
@tdg710 7 лет назад
I'm not Traversy Media, but I think I can answer this for you. The whole point of using rem and em is to make the website responsive. It's so someone on a tablet or phone can view the webpage in all its glory, just as someone on a computer could.
@propeller
@propeller 7 лет назад
but responsiveness is in simple means defined by the viewport (width/height of the browserwindow). and rem only relates to the font-size of the html elment. then ok, you can give different font-sizes on different viewport sizes, but how does it make the responsive game easier? I can't see a use case whereI should base all my sizings on one base-setting
@hamzajirah
@hamzajirah 6 лет назад
What more can I say; that each time I need clarification on a subject, I have but one place to go; Traversy Media. Five star to you, Mr. Brad.
@AidanaDreamer
@AidanaDreamer 5 лет назад
Was following a paid tutorial... they made it seem soo complicated. Thank you so much for all your work
@miramax1995
@miramax1995 4 года назад
Kazakhs everywhere. Привет с Астаны))
@arindam1249
@arindam1249 4 года назад
I'm not even taking any paid course. Brad's videos along with MDN Web Docs..and some time Academind, Ninja etc. Channels are enough
@arindam1249
@arindam1249 3 года назад
@Abishek Raju Haha, I almost forgot about this comment
@blackamus
@blackamus 3 года назад
For real though. I'm over here trying to carry the 1 and ish lol. This is spoken in real life language, not Gandolf spoken word riddles. Great job.
@sai_charan
@sai_charan 7 лет назад
Some ideas for next videos: * Stripe API project * Building extension/theme for VS Code/Chrome * HTML newsletter design, MailChimp crash course, MJML crash course. * Jekyll crash course
@KjeKji
@KjeKji 7 лет назад
Jekyll templating
@cacianobeast
@cacianobeast 7 лет назад
Testing!!! both unit testing and integragion testing
@SunilSkanda
@SunilSkanda 4 года назад
Hey, when em is used on padding and margin, it's gonna be relative to that element's font-size. Not to its parent. You didn't mention that.
@omuriloribeiro
@omuriloribeiro Год назад
This is the best explanation I could find about this topic, really clear to understand. Thank you!
@HasanTezcan
@HasanTezcan 5 лет назад
### `What is the EM and REM css scale unit` Those are browser scale units. The browser set the px for the user. If you are defalut user your pixel size is 16px. Otherwise if you change the pixel setting in browser for example set the "LARGE" now your default px is 24px. `So, REM base on browser pixel size.` if you are a normal user. 1rem = 16px 2rem = 32px 0.5rem = 8px otherwise if you change the font size settting to large 1rem = 24px 2rem = 48px 0.5rem = 12px So what is the EM also? The EM not base on browser font size. `EM base on parent elements size` for example body{ font-size: 20px; } now 1em = 20px even the browser defalut font size settings equals 16px. at the same time 1rem = 16px.
@gbubemia
@gbubemia 4 года назад
Simple explanation and demonstrations. I will never forget how to use rem, em, vh, and vw! Thanks a mill!!!
@aditsapkota7862
@aditsapkota7862 3 года назад
So technically, rem can be used to size up, make sites smaller, responsive gapping, font-sizing across multiple screen sizes with a single update to the html tag?!
@ajazmiah
@ajazmiah 6 лет назад
Hey Brad, do you think you can make a video on how to deploy a simple website?? Explaining the things we need to know and understand when putting our site online ?Would be much appreciated
@AdrienneBing
@AdrienneBing 7 лет назад
Thank you for this simplified explanation I finally got an understanding of this.
@TomCashTV
@TomCashTV 5 лет назад
Perfectly explained 👌Thank you.
@MAli-o4r1j
@MAli-o4r1j Год назад
Beautifully explain sir love from Pakistan
@HershanPremarathna
@HershanPremarathna 3 года назад
I don't have words to explain how much this is valuable. Initially when video startup, due to lower voice I heard, I thought this will be boring one. Basically no energy. But it was just a matter of a second. This is awesome and very clear explanation with a directly to subject video. So as a summary, I guess this is a only video you need to check to understand the difference between those. So really appreciated.
@RameenFallschirmjager
@RameenFallschirmjager 4 года назад
I'm here because I enrolled for udemy course on bootstrap 4. Thanks Brad for excellent content!
@wilsongaturu134
@wilsongaturu134 7 лет назад
The next video suggestion for me is REM - losing my religion. lol. Thanks for explaining this for us by the way. Great vid.
@TraversyMedia
@TraversyMedia 7 лет назад
LOL Good song
@aneeshsagiraju3985
@aneeshsagiraju3985 4 года назад
What I couldn’t understand after listening 1 hour class in my college , u Made me understand in 15 min . Thank you for this free content
@MAli-o4r1j
@MAli-o4r1j Год назад
Threre will be no need to watch an other video for rem em Thanks sir
@tylerbenton4495
@tylerbenton4495 7 лет назад
I get so confused on this stuff. Ty
@erifetim
@erifetim 7 лет назад
rem&em? Isn't that a rapper or some chocolate covered peanuts or something?
@hiteshchoudhary3412
@hiteshchoudhary3412 7 лет назад
Hi Brad, when is going to coming cpanel series? Eagerly waiting?
@emiudisi3774
@emiudisi3774 3 года назад
Finally got the hang of this , thank you brad
@ozzyfromspace
@ozzyfromspace 5 лет назад
Now I'm a pro. Watch me make a solid blue landing page 😂 jk. You're awesome dude! I'm learning a lot from you :)
@thenerd4308
@thenerd4308 7 лет назад
Well appreciated Brad, you are so great trainer and person...
@TraversyMedia
@TraversyMedia 7 лет назад
Thank you
@AbhishekKumar-mq1tt
@AbhishekKumar-mq1tt 7 лет назад
Thanks Brad u r awesome .Can you make project video on newsletter website with back end.
@doingsneakypeakylike
@doingsneakypeakylike 7 лет назад
Thanks Brad. You really cleared it up with rem and em. I am looking forward to advanced css series if you're planning to make one.
@petecapecod
@petecapecod 7 лет назад
Thanks Brad this was a great video, and it definitely cleared up some of my questions about the difference between rem/em and pixels. Nice video length too, I thought it wasn't too short or didn't drag on.
@popi0370
@popi0370 7 лет назад
Hi Brad, I want to thank you for all your great work, it's very inspiring and it's making me wanna do the same but in my language, if I get to be half as good as you doing this I'll be more than happy. Thanks again and have a nice day!!
@mikedank301
@mikedank301 7 лет назад
Thank you Brad for sharing. Your tutorials are very helpfull and easy to understand.
@real-ethan
@real-ethan 7 лет назад
Thanks Brad ! All of ur tutorial are awesome. At your convenience, would you make a tabris.js tutorial as it can build hybrid app in javascript without using any framework such as react, vue and angular? Look forward to it!
@codehardr1209
@codehardr1209 3 года назад
When using ems, border and padding are relative to the font-size and not to the parent element, only the font-size is linked to the parent element. Border and padding are calculated based on font-size. So if parent is 12px, and child's font-size is 2em(=24px), 1em padding will be 24px, not 12! Correct me if I'm wrong though...
@kasso1233
@kasso1233 7 лет назад
WordPress is making web developement really easy.I am just a beginner and don't know the difference between the website developed by WordPress & a website developed by HTML,CSS .can u please explain the difference.is learning all these complex coding worth it?
@jenjen3
@jenjen3 5 лет назад
Thanks for yet another great, well-explained video!
@raviverma8904
@raviverma8904 7 лет назад
thanks brad , again a great video 😊😊 god bless
@crocodilecrox3758
@crocodilecrox3758 7 лет назад
Great vid brad! One issue with vh though on full height elements. On mobile view theres a bar on the bottom of the default browser(samsung). When u start scrolling down it disappears, when u scroll up it appears again - which makes the element constantly change size and it pulls all other elements up/down which is really a bad user experience. Anyone know the solution?
@VelezBiH
@VelezBiH 5 лет назад
Thank you for explaining this. I am definitly switching to rem and vh units instead of pixels. I think this is no brainer if we want to build sites that are responsive and also accessible to end user.
@habib077
@habib077 4 года назад
Wednesday 22nd April 2020 Learning Class: Simple Explanation Of rem & em CSS Units Thank you very much for the explanation about rem and em Mr Brad Traversy.
@harrypotter22347
@harrypotter22347 Год назад
This video is better than my bootcamp tutorial on how to use rem and em units. Best and simple explanation I've come across. Thanks👍👍👍👍
@arunthiyaagarajan
@arunthiyaagarajan 3 года назад
This is the Only Video in RU-vid I Got fully Clarified about CSS Units!! Thank You So Much!! But You Missed out Percentage (%)
@raunakhajela
@raunakhajela 5 лет назад
Thanks, Brad, for this awesome tutorial. Relative units always confused and I didn't find any good tutorial which can explain this better except you. You cleared all my doubts and now I am going to change font sizes for all my websites.
@arshiasaleem5005
@arshiasaleem5005 4 года назад
Very informative. Thank you so much for this :')
@mpilifranck-rudolphe3941
@mpilifranck-rudolphe3941 3 года назад
Rem and Em I got it now. But VW and %, I still looking forward to understand the difference. Can someone help me please
@cyber.valllll
@cyber.valllll 4 года назад
Great explanation as usual, but pixels are still fine in responsive design (check out the source code for this youtube page for example, they don't use rems) where rem is an old no needed thing mindtheshift.wordpress.com/2015/04/02/r-i-p-rem-viva-css-reference-pixel/
@mikesenesie8430
@mikesenesie8430 Год назад
very simple anf straight forward.. i have watched so many videos but this stands out.. kudos!
@animationlegostudio
@animationlegostudio Год назад
wow, after 5 different videos, this was the one i was looking for. Thank you for this clear explanation i was looking for.
@niteshguleria9901
@niteshguleria9901 4 года назад
thankyou for simple explanation. But i have a doubt that, what is the difference between vh,vw and % .As both do same thing
@Aimopotis
@Aimopotis 7 лет назад
Suggestions for next courses plz -RWD - PWA -AMP
@aditsapkota7862
@aditsapkota7862 3 года назад
Hey man jst a small complaint, Ur introl music is ear piercing, care to update or re-equalize it. By the way, a huge fan of your tutorial
@CerkieGaming
@CerkieGaming 7 лет назад
Do you have a vanilla js front to back course?
@mackensonreginaldmichel399
@mackensonreginaldmichel399 4 года назад
Thanks a million. Very helpful. But now how to use css units with responsiveness. vh, vw,em,rem?
@boriskleshch8416
@boriskleshch8416 7 лет назад
Yes, please HTML newsletter design(responsive emails) and integrating them into MailChimp or sending from local server using Gmail.
@sayeedsiddiqui6900
@sayeedsiddiqui6900 2 года назад
video was 4 years ago but really explained very well. I have watched 2 to 4 videos but didn't understand
@filip23128
@filip23128 3 года назад
Thank you veeery much for this video:) You explained the topic perfectly!
@thstudio007
@thstudio007 4 года назад
Thanks Brad for this clear explanation. The only thing I didn't like is the the use of the ugly blue color. Hurt my eyes so bad 😵
@centrumsaiyan7623
@centrumsaiyan7623 2 года назад
You are helping millions of people land and survive their job. Thanks for making our life easier.
@JoeBob79569
@JoeBob79569 6 лет назад
So, you might use em on elements inside a container, and then give the container values in fixed units; so that you could change all the element values that use em's, inside that container at the same time, kind of like a variable? Without affecting the rest of the page? If that makes sense? Is there any other reason to use ems?
@maxiequa567
@maxiequa567 7 лет назад
Finally! A comprehensive, straightforward explanation of this topic. Thanks Brad, exceptional teaching as always.
@irinadelgado876
@irinadelgado876 5 лет назад
This is what I was looking for! Thanks Brad
@IslamandScience2012
@IslamandScience2012 6 лет назад
Why not Creating a facebook group so we can help each other more efficiently and you can easily connect us, helping answer our questions, maybe receive our suggestions and so on?
@jackofjs2243
@jackofjs2243 2 года назад
Wow your video finally gave me a pretty good idea on css units. Thanks man.
@shubhamraja8476
@shubhamraja8476 3 года назад
In the last part of this video after setting 100vh and 100vw why screen width and height increased more than 100% even of the margin and padding were set to 0% ?
@DJizz82
@DJizz82 4 года назад
viewport dope!!! defiantly not used to rem, but I’ll start using it now.
@vikim6954
@vikim6954 2 года назад
Wow, your explanation is simple and clear. Thanks
@perfectwebsolutions
@perfectwebsolutions 7 лет назад
Thank You Brad, now got it clearly about px, rem, em and when they change their behavior .
@StrangeIndeed
@StrangeIndeed 4 года назад
I just wanted to point out that roughly half of the people who commented on this video have put their real photos as a profile picture. It's kinda unusual
@IG7799-c4u
@IG7799-c4u Год назад
One more thing is that if you set a font-size of an element using rem units, and use em units to set things like padding on the same element, that will be relative to the font size of that same element. So if the font-size is set to something like 2rem, then 1em = 2rem units.
@clydemelendres9222
@clydemelendres9222 4 года назад
*We're meant to be BRAD* You fill what others lack
@haroldpepete
@haroldpepete 7 лет назад
take a look to this, www.w3.org/TR/css3-values/#font-relative-lengths , the em is not something about the father element, the same element can override this behavior, the current element got the font size value of your father, by inherited, the em is relative to the same element
@Well_This_Guy_Says
@Well_This_Guy_Says 4 года назад
I finally understand rem and em! One question, when you went a width of 100vw, why did you have a horizontal scrollbar, and how would you get rid of that without hiding the overflow?
@deeptanshushandilya1459
@deeptanshushandilya1459 4 года назад
You are not going to need that ! Use width:100%; instead.
@mpilifranck-rudolphe3941
@mpilifranck-rudolphe3941 3 года назад
@@deeptanshushandilya1459 what's the difference between % and vw?
@saltech2024
@saltech2024 3 года назад
OMG!! You're really a saviour, thank you
@swallowedinthesea11
@swallowedinthesea11 5 лет назад
REM refers to the root HTML and the band... got it!
@prakashbk1603
@prakashbk1603 3 года назад
Thank you so much. You helped me understand easily.
@AbhishekKumar-mq1tt
@AbhishekKumar-mq1tt 7 лет назад
Hi Brad u r awesome and I am sorry for forget your birthday because I watching you're videos and I didn't notice time so I sorry for that . Happy 36th birthday Brad .
@TraversyMedia
@TraversyMedia 7 лет назад
Thanks :)
@bjornarmar2462
@bjornarmar2462 4 года назад
Is there ever a reason to NOT always set the HTML tag's height to 100vh?
@sridharbelide
@sridharbelide 7 лет назад
Pls make a video on how to develop chrome extension from scratch to end...
@sparshgupta8078
@sparshgupta8078 4 года назад
amazing explanation + short video best combination
@AkashSaggar
@AkashSaggar 7 лет назад
Hey Brad, what's the difference between vw and % ? I think it's the same as rem vs em, where vw is relative to the window size, and % is relative to the parent. Can you please clarify.
@drlawrence8246
@drlawrence8246 7 лет назад
yeah, why not use %?
@faosparkNeo
@faosparkNeo 7 лет назад
vw is dependent on the view port width and the initial scale declared vs % is not necessarily dependent on that but it can. also % takes into consideration the box model declared (content box or border box) of the parent element as well as position (static,relative, absolute). unless you know the complexity of the nesting of your elements as much as possible just use % on outer/parent element for layout purpose. it gets pretty tricky as you go deeper in the element tree.
@_KHALIDMOHAMED
@_KHALIDMOHAMED Год назад
keep it up bro, liked your explanation and subscribed.
@21agdmnm
@21agdmnm 4 года назад
good video, but you forgot to mention that with em when it comes to a length declaration it references the current element and not the parent.
@tiparess17
@tiparess17 3 года назад
they make it looks so complicated thanks for making it looks simple
@masudrahman3818
@masudrahman3818 Год назад
your teaching is awesome, today I understood rem and em. thank you so much
@JD-kf2ki
@JD-kf2ki 3 года назад
Fun-fact: VW stands for Volkswagen
@saidurgaharshavardhan3506
@saidurgaharshavardhan3506 2 года назад
Thank you very much, easy explanation
@adeleke5140
@adeleke5140 4 года назад
Thank you so much for this video. It clarified a lot.
@techtipsuk
@techtipsuk 7 лет назад
Do you change the html value to 10px to make calculations easier?
@arlanabo8932
@arlanabo8932 4 года назад
This is the best and simpliest explanation about css units, glad that i found this.
@ozzyfromspace
@ozzyfromspace 3 года назад
Dumb question, but why would you ever wanna use em units?
@ammarhassan_
@ammarhassan_ 4 года назад
Thank u, Brad. Super helpful even in 2020
@adegbemilearibisala5321
@adegbemilearibisala5321 Год назад
Nobody does it better!!!!!! Thank you so much
@argenisaguilar9045
@argenisaguilar9045 3 года назад
Pretty helpful, thank you very much...
@MeenatchiSundaramM
@MeenatchiSundaramM Год назад
as said by everyone this the only video were i can understand this topic
@kohmahendra
@kohmahendra 3 года назад
Thank you, your explanation is simple and very easy to understand
@abhigeek
@abhigeek 5 лет назад
What is the difference between vh and %. Which unit I should use when?
@respectspell2137
@respectspell2137 4 года назад
Thank a lot sir, how can donate you for this clear information.
@julietasargsyan6232
@julietasargsyan6232 2 года назад
Thank you very very very much, that really makes sense.
@Bestate1
@Bestate1 6 лет назад
I dont have any knowledge of CSS and still I got what an em and a rem are. Thank you
@nicbog3043
@nicbog3043 7 лет назад
Thanks for explaining . But how is different from using height:100% ?
@arthurprather6720
@arthurprather6720 7 лет назад
100vh is fixed on responsive, 100% isn't.
@Tara.Sohrabzadeh
@Tara.Sohrabzadeh 2 года назад
Great video. As a beginner now i know the use cases of em and rem.
@scubadiving9668
@scubadiving9668 7 лет назад
Brad i always watch your videos,, that is really amazing for the next videos,, i really hope you can teach us "How to understand javascript with build complex FORM VALIDATION" please,,,please,,,make it happen and HAPPY BIRTHDAY FOR YOUU...!!!! Gracias
@rezakarimi1751
@rezakarimi1751 4 года назад
just Thanks ! it was very helpful .
Далее
CSS3 Animation & Transitions Crash Course
36:20
Просмотров 432 тыс.
Sass Crash Course
48:05
Просмотров 401 тыс.
Ответы Мэил Ру
01:00
Просмотров 1,5 млн
КОТЯТА В ОПАСНОСТИ?#cat
00:36
Просмотров 1,7 млн
The problems with viewport units
13:23
Просмотров 362 тыс.
CSS em and rem explained #CSS #responsive
16:54
Просмотров 386 тыс.
Responsive HTML & CSS Side Menu From Scratch
23:57
Просмотров 397 тыс.
CSS Units & Sizes Tutorial for Beginners
21:25
Просмотров 36 тыс.
Learn CSS Units In 8 Minutes
8:48
Просмотров 231 тыс.
Fullscreen Video Background With HTML & CSS
23:37
Просмотров 274 тыс.
:has() opens up new possibilities with CSS
14:30
Просмотров 287 тыс.
Ответы Мэил Ру
01:00
Просмотров 1,5 млн