Тёмный

REM or EM - What should I use?? 

DevTips
Подписаться 351 тыс.
Просмотров 50 тыс.
50% 1

Continuing the discussion of the CSS Units, we discuss which is better to use: REMs or EMs. I totally make up the answer. What is your opinion?
Previous Video: • CSS Units (CSS Lengths...
CodePen: codepen.io/devt...
- - -
This video was sponsored by the DevTips Patron Community - / devtips
Listen to Travis' Podcast - www.travandlos....
Get awesomeness emailed to you every thursday - travisneilson.c...
You should follow DevTips on Twitter - / devtipsshow

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

 

30 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 266   
@thenldn
@thenldn 8 лет назад
That moment when you love your code. @9:23
@OfficialDevTips
@OfficialDevTips 8 лет назад
FEELS SOOOO GOOD!!
@yehetgirl8864
@yehetgirl8864 7 лет назад
thenldn hahahaha lol best feeling ever
@lorenzmoya9232
@lorenzmoya9232 7 лет назад
you damn right ahhahahah
@AbhishekKambliDesigner
@AbhishekKambliDesigner 8 лет назад
Very informative...learned a lot... :D
@OfficialDevTips
@OfficialDevTips 8 лет назад
Awesome!
@derHINDU
@derHINDU 8 лет назад
Hey Travis! Nice vid, but why don't you define :root { font-size: 10px; // base value to simplify the maths } body { font-size: 1.6rem; // set default font-size } this would be easier to calculate font-sizes, widths/heights, margins/paddings. Or would this be bad behaviour?
@OfficialDevTips
@OfficialDevTips 8 лет назад
Mostly because most browsers have a default font-size of 16px. It can be important to keep that in mind. Other than that, there is no diff.
@AlexBoffey
@AlexBoffey 8 лет назад
This is literally the best video on youtube 👍👍
@threeone6012
@threeone6012 7 лет назад
How do I give this video 10 thumbs up? That visual explanation of EM vs REM helped a ton. Now I get it!
@abdelkaderguellati5164
@abdelkaderguellati5164 7 лет назад
I am watching this in dec 14th, 2016 I am one year late ;(
@davlmt
@davlmt 6 лет назад
Abdelkader guellati Bruh it's 2018 over here and it's still relevant
@JasonCtutorials
@JasonCtutorials 8 лет назад
oh wow my mind is blown. Now I have refactor all my css. This has made my file so much smaller. LOLs.
@OfficialDevTips
@OfficialDevTips 8 лет назад
That's a good thing! good luck!!
@maujmishra4098
@maujmishra4098 3 года назад
Lol mine too
@greatlucifer4298
@greatlucifer4298 5 лет назад
The best thing I could find near this topic. Thanks *thump up*
@d4w4ll31
@d4w4ll31 7 лет назад
real world examples, thanks travis :)
@groovebird812
@groovebird812 8 лет назад
Very good explanation, thank you.
@sendashish
@sendashish 8 лет назад
hey Travis, I like the way you express and just chill out the learning process. Thanks. I have two questions for you. CSS transitions and SVG are two areas which we can use to make cool animations and drawings. would you mind to cover them these separately in upcoming episodes?? what level of animation can we achieve using them. Also there is another element Canvas. how can we utilize it too?? for eg. Google maps is using canvas a lot. Thanks!!
@cagriozarpaci1673
@cagriozarpaci1673 7 лет назад
Why we using :root we can use also html,body {} i never see :root we can do like that html, body{ font-size: 20px; } h1 { font-size: 2rem or 200% }
@GroudFrank
@GroudFrank 7 лет назад
Meh, I'm still going to use px instead of rems and ems. You have much more control, there is much less math and it is much less frustrating for the designer. This is something we often ignore. If I am constantly frustrated then I am less likely to be able to design well. I can visualize what a div 650px wide and tall would look like in my head, not 40.625em. I'd rather have my media queries be 3 times longer than constantly having to first find the right value in px and then convert to ems. I see people doing stuff like font-size:calc(.4rem + .58vw) and I wonder if these people are just show offs, over compensating or just crazy. Besides, px scales just fine with Ctrl +.
@PavelIsp
@PavelIsp 8 лет назад
Does Santa style his lists? And does he used rems or ems on them? I mean...is it even a ol or an ul? naughty or nice is a boolean or a class? P.S: this is so mad helpful. I'm thinking of creating my own jekyll site that's minimal and typography based, and rem/em mix will be a beauty for black and white fancy type site. YES!
@derekmorash
@derekmorash 8 лет назад
Thanks Travis, this helped so much. I had no idea rems and ems were this powerful!
@OfficialDevTips
@OfficialDevTips 8 лет назад
I'm glad it was helpful!! Awesome!
@SvenBudak
@SvenBudak 8 лет назад
Is there any reason for using :root? i everytime see that people place the fontsize in body tag, but you put it in :root... so... Why? ;D If you dont make any :root rules then is body the next root ore not? And is :root working on IE8 to? caniuse.com/#search=%3Aroot
@GordonWarvi
@GordonWarvi 8 лет назад
I noticed when you move forward/back a few centimetres you quickly blur out. Have you considered increasing the aperture on your camera so that you can move however your want and still appear in-focus?
@Bogusky67
@Bogusky67 7 лет назад
Excellent video. I immediately got the idea of how to use rems and ems. We miss you on DevTips Trevis!!!
@MrScX
@MrScX 5 лет назад
Do you have anything other than Twitter, where I can follow you? I miss you and your videos a lot :')
@maggiemcroskey6448
@maggiemcroskey6448 8 лет назад
This will make my media inquiries 30 times shorter. O_o wish I was doing this root/rem stuff before!
@OfficialDevTips
@OfficialDevTips 8 лет назад
Glad it's helpful!
@dipeshvadgama6955
@dipeshvadgama6955 6 лет назад
Hi Trav, so if I wanted to add padding and margin to the H1 tag for example, I would add it in ems which will then reflect the font size of that H1 tag? What about if we have a main container that has a font size and we want to add the padding in ems for the children containers. Will it reflect the font size of the parent container?
@devdynamix
@devdynamix 7 лет назад
@9:23 Weird sex noises while coding just cause you love your code? My kinda guy!
@cinilaknedalm
@cinilaknedalm 7 лет назад
Love the little jokes + rich presentation > subbed
@Balphis
@Balphis 8 лет назад
Awesome video, I should start utilizing rem and em sizes now!
@moonbreathing
@moonbreathing 5 лет назад
Thank you so much, great and helpful video!
@ahmedam77
@ahmedam77 8 лет назад
Amazing thanks for your time and efforts
@ahadulislam8891
@ahadulislam8891 7 лет назад
Thanks man, very well demonstration
@neoedujawa7201
@neoedujawa7201 7 лет назад
Man I love ya ha ha ha. Thank you incredibly much 😊
@walkingdead7115
@walkingdead7115 8 лет назад
the only problem i have is with your sass syntax. y u su sauce -_-
@ziggerwebdesign1704
@ziggerwebdesign1704 7 лет назад
Very cool video. Thanks.
@D4rkLocus
@D4rkLocus 8 лет назад
thanks for that. that was pretty intresting
@playboycity
@playboycity 8 лет назад
This kind of video is my personal favourite, its kinda like a deep dive into CSS in little pieces , please keep them coming, your great at this
@OfficialDevTips
@OfficialDevTips 8 лет назад
I really like doing them. good to know!
@kaisinzinger5521
@kaisinzinger5521 8 лет назад
I love you for these!!!! thanks 😀
@okoiful
@okoiful 7 лет назад
Ha! after years i see this .. awesome!
@kf2w
@kf2w 7 лет назад
Great tutorial! Thanks man!
@caughtkneeh
@caughtkneeh 5 лет назад
He didn’t say opAcity at all in this vid.
@YudiMuchanis
@YudiMuchanis 8 лет назад
WOW... Thanks travis!!! :D
@LosEagle
@LosEagle 8 лет назад
Thanks for the explanation, had to go through the mobile part twice but its pretty clear now.
@OfficialDevTips
@OfficialDevTips 8 лет назад
Fantastic!!!
@ValorousDefined
@ValorousDefined 8 лет назад
Great tutorial! Got to remember this when developing new sites - always end up writing my font-size way too much
@OfficialDevTips
@OfficialDevTips 8 лет назад
Hope it helps!!
@sergiokagiema9658
@sergiokagiema9658 7 лет назад
Excellent example! It helped a lot.
@magica2z
@magica2z 6 лет назад
Superb,,,.. Thanks Travis..
@ewliang
@ewliang 8 лет назад
XD The thumbs up transition. Anyways, great video as always!
@OfficialDevTips
@OfficialDevTips 8 лет назад
Thanks!! haha!
@victorNDSL
@victorNDSL 7 лет назад
mr travis, i just love you so much
@grossolee
@grossolee 7 лет назад
Best teacher in da world.
@SchettiniAndre
@SchettiniAndre 7 лет назад
Is that a GG effect at 9:22? Loved it.
@BippyMiester
@BippyMiester 8 лет назад
Did you really just say yolo? lol oh my. :D
@senhorsulaiman5341
@senhorsulaiman5341 8 лет назад
Great tuts! loved it:)))
@antoinza
@antoinza 8 лет назад
This has been incredibly helpful. Thanks so much!
@OfficialDevTips
@OfficialDevTips 8 лет назад
You are so welcome!
@nitram_nosnibor
@nitram_nosnibor 3 года назад
Ha ha ha ha, miss you Travis!!!
@desi.programmer
@desi.programmer 8 лет назад
Awesome video. Thanx Travis... 😂😂😂😂😄😄😄😊☺😊☺
@OfficialDevTips
@OfficialDevTips 8 лет назад
You are welcome!
@raphaelscartezini7719
@raphaelscartezini7719 8 лет назад
Travis, your tech videos are awesome! But your personal videos are amazing!! (like the ones about google and softskills)
@OfficialDevTips
@OfficialDevTips 8 лет назад
Glad you feel that way, they are my favorites too :)
@erickraschiery1245
@erickraschiery1245 8 лет назад
Gracias mi pana, siempre tuve esa duda!
@dridkasperdz
@dridkasperdz 8 лет назад
hi... i like u man....you make it simple and easy to understand .... and u have good presentation ,
@OfficialDevTips
@OfficialDevTips 8 лет назад
Thanks! Thats nice of you to say :)
@jguz101
@jguz101 8 лет назад
@devtips yoyo hope google is treating you well. can someone or yourself explain the difference in this in css. .classname .anotherclassname vs .classname, .anotherclassname vs .classname>.anotherclassname much help is understanding the differences and when to use what helps. thanks much 😊
@MarcoScannadinari64
@MarcoScannadinari64 8 лет назад
The first selects a child element of any depth, second selects two different elements, third selects a child element that is a direct descendant of the first element (depth is 1)
@jguz101
@jguz101 8 лет назад
+Marco Scannadinari Nice great info and thank for the help!! :)
@BiHsinalco
@BiHsinalco 8 лет назад
Awesome, Thx!!! Mind answering my question on your video "How to make a full screen video background" xD, should be first or second.
@OfficialDevTips
@OfficialDevTips 8 лет назад
+BiHsinalco Done :)
@jamesward6006
@jamesward6006 8 лет назад
Cool video man. that info will go a long way in making RDW's for me, appreciate it keep up the cool videos. KEEP ON HACKING man.
@OfficialDevTips
@OfficialDevTips 8 лет назад
yea!
@vigilancer
@vigilancer 8 лет назад
Okay.. While watching on rems and ems.. Using this style would make me think hard calculating everything, widths, heights, padding all of them! Sooner or later my brain processing capacity will be at masters level! LOL!
@OfficialDevTips
@OfficialDevTips 8 лет назад
Oh yea!
@codewithmudit
@codewithmudit 8 лет назад
Hey Awesome Video !!!! I just love it .. Can i ask you an personal question ? What do you use to grow your beard like that..i love your beard actually ?
@OfficialDevTips
@OfficialDevTips 8 лет назад
it just grows man. It does what it wants.
@holalabellebille
@holalabellebille 8 лет назад
a comment from Paris, France : 3 months i've been watching your channel, i learnt tons of useful incredible tricks you are very clear (and fun to watch), plus your english is so understandable . you're a natural born teacher i'm currently teaching html / CSS to people who plan to change job, and i'm giving them your knowledge, in french ! take care
@OfficialDevTips
@OfficialDevTips 8 лет назад
Awesome! I'm glad you enjoy the show and find it helpful!!
@vigilancer
@vigilancer 8 лет назад
It's been weeks the last time I watched your videos. Well busy with my work life. And nooow! I learned something again from you! Man I'll convert myself into this one, gotta love being the unique guy using this instead of pixels. @_@
@OfficialDevTips
@OfficialDevTips 8 лет назад
Glad to have you back! Thanks for watching again :)
@dmitriyobidin6049
@dmitriyobidin6049 8 лет назад
How to decide whether to use rem or @media querys or different CSS classes in terms of adaptive design(desktop/mobile/iPad)?
@OfficialDevTips
@OfficialDevTips 8 лет назад
Use what ever makes sense. And try new things now and then. It'll work out
@GasolineNl
@GasolineNl 8 лет назад
Another good one. Especially using the em for borders/padding. That was a nice eyeopener.
@OfficialDevTips
@OfficialDevTips 8 лет назад
I'm glad you had that moment. I love that stuff.
@dmays67
@dmays67 8 лет назад
Who woulda thought I'd laugh out loud during a video on [r]ems! Thanks for the chuckles bro..oh, and the useful content. Will file in my 'stuff I should try and remember so one day my web pages don't suck' drawer. >
@OfficialDevTips
@OfficialDevTips 8 лет назад
My drawer with that name is filled tot he brim :)
@david_d-_-b_in
@david_d-_-b_in 8 лет назад
Thanks for the video Travis! Very useful as always. Keep on hacking! ;)
@OfficialDevTips
@OfficialDevTips 8 лет назад
Thanks David, you too :)
@wonderram234
@wonderram234 5 лет назад
beard game strong
@michaelafanasiev2318
@michaelafanasiev2318 8 лет назад
Travis, thank you thank you thank you! By the way, what's that music at the end?! :D
@OfficialDevTips
@OfficialDevTips 8 лет назад
You are welcome! I'm not sure what the music is, it was from a stock website.
@richochet
@richochet Год назад
Dude you rock!
@chasehayes3536
@chasehayes3536 8 лет назад
My mind == absolutely blown! Thanks for the insight Travis!
@stefantosic9584
@stefantosic9584 7 лет назад
Thanks a lot
@manishjain295
@manishjain295 8 лет назад
Thanks a lot, Very helpful information.
@OfficialDevTips
@OfficialDevTips 8 лет назад
You are welcome!
@alexand5143
@alexand5143 8 лет назад
This example made me to read about specific property - :root. Great! Nice lesson!
@OfficialDevTips
@OfficialDevTips 8 лет назад
Awesome, thanks for watching!
@interist32
@interist32 8 лет назад
Hey Travis, thanks for you video. As I understand with this approach I have to write font-size: 1rem for each particular "atomic" block. Am I right?
@maxiequa567
@maxiequa567 8 лет назад
Thank you Travis, another great explanation :)
@OfficialDevTips
@OfficialDevTips 8 лет назад
you are welcome!
@DerNivel
@DerNivel 8 лет назад
Helpful Video :) One question: What's the endcard song? :D
@OfficialDevTips
@OfficialDevTips 8 лет назад
Thanks! I really don't know. I let my editor choose that. I get the music from epidemicsounds.com
@garywalker6216
@garywalker6216 2 года назад
Great video!
@Zealotux
@Zealotux 8 лет назад
Always been too lazy to play around with these units, thinking that it would never be that useful, oh how wrong I was. Thanks for that!
@OfficialDevTips
@OfficialDevTips 8 лет назад
you are welcome! I'm glad this opened you up to some possibilities :)
@erroltiozon
@erroltiozon 8 лет назад
This really helped me with my confusion :) Thanks
@ianbrown1718
@ianbrown1718 7 лет назад
This is great!
@paulca55
@paulca55 7 лет назад
Nice video :) I'm curious to know how you'd deal with spacing of elements (i.e. the heading, paragraphs, buttons, etc) would this be sized in EM or REM?
@sashakastsiushkin2388
@sashakastsiushkin2388 8 лет назад
Great reasoning on the topic! This is way more helpful rather than something like a static list of use cases... Thanks!
@OfficialDevTips
@OfficialDevTips 8 лет назад
I'm glad that this was useful! That's awesome!
@nyfikenheten
@nyfikenheten 7 лет назад
@3:50 Pirates!
@nightchiller
@nightchiller 8 лет назад
Hey Trev, i'd love to see a video about SEO in the view of a web designer (not the back link stuff).
@OfficialDevTips
@OfficialDevTips 8 лет назад
My SEO insights are not great. Pretty simplistic: 1. Make content people want 2. use language someone would use in a searchbox
@AntonKastritskiy
@AntonKastritskiy 8 лет назад
This was really useful and informative, thanks Travis. As usual
@OfficialDevTips
@OfficialDevTips 8 лет назад
Glad you liked it!!
@will31666
@will31666 8 лет назад
Sweet, thanks Travis, always inspiring and all that with fun (at least for us/me?)
@OfficialDevTips
@OfficialDevTips 8 лет назад
Suer glad you liked it! Thanks for your comment!
@heyyy4987
@heyyy4987 8 лет назад
FEELS SOOOO GOOD!!(2) really nice, really powerfull. tnks a lot
@JasonCtutorials
@JasonCtutorials 8 лет назад
codepen is pretty awesome. so is jsfiddle. c9 also.
@OfficialDevTips
@OfficialDevTips 8 лет назад
Totally
@Paretozen
@Paretozen 6 лет назад
Its just a pain to see somebody type out padding: 1rem, Emmet all the way baby. p1r feels so good!!!
@johannjensson6190
@johannjensson6190 4 года назад
Wonderful explanation. I finally understood em & rem, and why to use them. Thank you!
@nikeshsuwal3091
@nikeshsuwal3091 8 лет назад
Very helpful. Thank you so much !!!!!
@OfficialDevTips
@OfficialDevTips 8 лет назад
Yea! You are welcome!
@jcobiddle6374
@jcobiddle6374 8 лет назад
YOLO?! Dude, seriously -.- Thanks for the vid. btw
@mo4mark
@mo4mark 8 лет назад
Thanks Mr Travis for the super handsome video
@OfficialDevTips
@OfficialDevTips 8 лет назад
You are welcome!
@darkthrongrising5470
@darkthrongrising5470 7 лет назад
That was very insightful, and will definitely bring the quality of my work up. Thank you! Im self taught so I do not have the luxury of someone to help me understand these things, you have solved that problem my friend. I love the way you shortened the media query task.
@TomAlderman1978
@TomAlderman1978 8 лет назад
Thanks, This was greatly helpful
@OfficialDevTips
@OfficialDevTips 8 лет назад
You are welcome!!
@sacrome
@sacrome 8 лет назад
Thanks for sharing! Very interesting to know the difference between rem and em.
@OfficialDevTips
@OfficialDevTips 8 лет назад
You are welcome!
@РобертТронов
@РобертТронов 8 лет назад
Hi Travis! Why don't you use emmet?
@OfficialDevTips
@OfficialDevTips 8 лет назад
Never got into it. I use jade. It's easier and permanent.
@nikitas.doroshenko
@nikitas.doroshenko 8 лет назад
Thank you, very informative!
@OfficialDevTips
@OfficialDevTips 8 лет назад
you are welcome!
@joelmik8945
@joelmik8945 8 лет назад
This video was sooooooo helpful ! Thank You !
@OfficialDevTips
@OfficialDevTips 8 лет назад
Awesome! That makes me happy :)
@hansmartinhanken485
@hansmartinhanken485 4 года назад
Excited to do more em and rem stuff! For sure the best explanation I've seen on RU-vid so far on the subject 👏
@normandubois_design
@normandubois_design 8 лет назад
cool and helpful video Travis :)
@OfficialDevTips
@OfficialDevTips 8 лет назад
Thanks :)
@tanaoduy8400
@tanaoduy8400 8 лет назад
great video. can you make video about bem?
@OfficialDevTips
@OfficialDevTips 8 лет назад
There is a video about oocss on the channel. Check that one out. But I can look into a BEM video too. Maybe in 2016!
@TravisHi_YT
@TravisHi_YT 8 лет назад
This is one of those vids that are so good that 10 minutes seems like 30 seconds!
@OfficialDevTips
@OfficialDevTips 8 лет назад
What a compliment!!! Thanks!!
Далее
The Home Server I've Been Wanting
18:14
Просмотров 173 тыс.
Редакция. News: 136-я неделя
45:09
Просмотров 1,5 млн
Goodbye, TAM
12:01
Просмотров 46 тыс.
Radxa X4: An N100 Pi
20:48
Просмотров 51 тыс.
CSS Filters!
13:01
Просмотров 53 тыс.
Why Signals Are Better Than React Hooks
16:30
Просмотров 478 тыс.
Use these instead of vh
6:06
Просмотров 510 тыс.
5 JavaScript Concepts You HAVE TO KNOW
9:38
Просмотров 1,4 млн
Редакция. News: 136-я неделя
45:09
Просмотров 1,5 млн