CSS Variables Tutorial (CSS Custom Properties)

  Рет қаралды 125,829

Traversy Media

Traversy Media

6 жыл бұрын

In this video we will dive into CSS variables, also called CSS custom properties. We can now have dynamic values in our CSS without the use of a CSS pre-processor like Sass or Less
SPONSOR:
Check out Coding Dojo - www.codingdojo.com/l/yt/tr
CODE: Codepen for this video
codepen.io/bradtraversy/pen/V...
💖 BECOME A PATRON: Show support & get perks!
/ traversymedia
VISIT MY WEBISTE: Check Out My Udemy Courses
www.traversymedia.com
FOLLOW TRAVERSY MEDIA:
/ traversymedia
/ traversymedia
/ traversymedia
/ discord

Пікірлер: 167
@vt_near
@vt_near 5 жыл бұрын
I feel like i've learned more in the 2 weeks i've known about your channel than I did in the past 2 years without it. You build my motivation, confidence and my skills. Thank you Traversy Media-- Thanks to you, and your courses, I might actually become a programmer!
@2breborn247
@2breborn247 3 жыл бұрын
How's it going so far?
@jimothyus
@jimothyus 6 жыл бұрын
i watch alot of youtube and youre hands down my favorite youtuber. that says something about the quality of these videos.
@TraversyMedia
@TraversyMedia 6 жыл бұрын
Thank you man, that really means a lot :)
@jimothyus
@jimothyus 6 жыл бұрын
Traversy Media you 100% earned it. Its like you can read my mind just as i think of a question you instantly answer it in the video. I seriously appreciate you brad. Youre a wonderful human being not just for sharing coding tutorials but because you care about others and that is the greatest virtue anyone can have. Much love to you man and god bless you with the same amount of love and compassion you share with us.
@Nikki-os2df
@Nikki-os2df 6 жыл бұрын
Traversy Media is the best I've ever seen. He goes straight to the point. I love it! He deserves our support guys, always.
@michaelandreuzza
@michaelandreuzza 5 жыл бұрын
@@TraversyMedia I agree, I click on many but then I always come back here. There are many unnecessary channels that mislead incredibly. Long life to Traversy Media. You incredible teaching Brad. Have a good one. /Michael
@cacoca79
@cacoca79 3 жыл бұрын
@@TraversyMedia where you from man?
@romaniaplus
@romaniaplus 6 жыл бұрын
Thank you, Brad! As usual, you did an amazing job! Happy New Year to you and your family!
@xshadyz
@xshadyz 6 жыл бұрын
I'm a subscriber but haven't watched your videos in a while. Everytime I come back to your channel I always learn something new with great examples that are easy to follow! You're awesome explaining things in a way that always makes sense! And I always learn new things!
@BlueIceAce2015
@BlueIceAce2015 5 жыл бұрын
These tutorials are simply the best, I have binged through probably 20 hours of your tutorials already. You are one of a kind. Thank you.
@IRgEEK
@IRgEEK 5 жыл бұрын
Thanks so much for going in-depth and showing how CSS variables can actually be used from JavaScript. I see great possibilities with this! Thanks for the post!
@mathankumar7995
@mathankumar7995 Жыл бұрын
What a great quality content from you mate ❤️. I'm following you for last couple of weeks and find myself motivated to learn. It's just amazing and lost of words. Keep it going and will support your work in all possible ways 🙏
@westfield90
@westfield90 5 жыл бұрын
I seriously learnt more from this one video than reading a whole chapter
@ErikNonIdle
@ErikNonIdle 4 жыл бұрын
These videos are great, Brad! They are so helpful, man. I really appreciate the depth think the presentation and pace is spot-on. Thanks!
@jasonwelsh417
@jasonwelsh417 6 жыл бұрын
As always, amazing tutorial! Thank you. I bought your new JS course and I can't wait to dig into it. Thanks for all the great content!
@thomasweber1397
@thomasweber1397 6 жыл бұрын
Thanks Brad. Another great video. Many other youtubers would have ended their videos after 2 minutes and say “that’s it”. Just because you don’t but continue and give examples and show the advantages is the reason why your videos are as great as they are. I’ve learned a lot from your videos. Thanks for all the effort you put in your videos.
@AntonioRibeiro-qs3fy
@AntonioRibeiro-qs3fy 4 жыл бұрын
A thorough explaination is exactly what we developers need...thanks Traversy Media
@ga7853
@ga7853 6 жыл бұрын
Thank you so much, for all these great tutorial you have been making to help people out, I enjoyed this one and understood the diff between this and the sass thanks to you.
@johnbritolima
@johnbritolima 3 жыл бұрын
Great job. The little tips and workarounds makes all the difference. Thank you for you lesson.
@cub8083
@cub8083 2 жыл бұрын
Your tuts are awesome Trav
@ipokkel
@ipokkel 6 жыл бұрын
Thanks (Again) Brad. The information you continually share is priceless.
@aleksejpetricig2500
@aleksejpetricig2500 5 жыл бұрын
A very well explained video to have an idea and a practical view about CSS variables. I really apreciated it!
@hirephpdevelopers3840
@hirephpdevelopers3840 6 жыл бұрын
Brad you are amazing. I have learned a lot from this tutorial.
@clewismessina6630
@clewismessina6630 6 жыл бұрын
Very useful video with good examples. Thank you, Brad!
@MartyBallard
@MartyBallard 6 жыл бұрын
Great job Brad! Your videos are awesome.
@DJGroff
@DJGroff 5 жыл бұрын
Nice work, man. Very helpful. Subscribed!
@noelgrisham
@noelgrisham 6 жыл бұрын
I didn't know about css varialbles (I thought only css preprocessors can do this) until this video. Your Udemy Angular 4 Front to Back is amazing. I found the right video tutorial for me. Keep it up brad! Thanks a lot!
@karlchan2556
@karlchan2556 6 жыл бұрын
Happy new year! Nice video!
@karendoran3692
@karendoran3692 5 жыл бұрын
Another world class awesome video Brad!!
@user-bl1lh1xv1s
@user-bl1lh1xv1s 6 жыл бұрын
Superbly done, thanks.
@mohsanabbas6835
@mohsanabbas6835 6 жыл бұрын
Thanks Brad. You are awesome
@andrewrico8321
@andrewrico8321 6 жыл бұрын
great video brad, well im currently writing a css framework for personal use, with the help of css variables, and i can tell you that what you just show up in this videos isn't half of what css variable can do. they are even more powerful that what we just saw in this video.
@hindhydraulics4820
@hindhydraulics4820 6 жыл бұрын
Your dedication inspires me. Thanks a lot..
@mannelynburgos5560
@mannelynburgos5560 2 жыл бұрын
From my curriculum, I didn't grasp the concept of using the :root selector right away, but this video explained it perfectly! Thanks
@RockstahRolln
@RockstahRolln 6 жыл бұрын
YOU are the BEST, Brad! Many Thanks!
@negeek7
@negeek7 3 жыл бұрын
Superb explanation my friend. Thank You! :D
@martinschackjensen1385
@martinschackjensen1385 6 жыл бұрын
Nice! Can't wait for this to become standard in all browsers!! 😊
@HostDotPromo
@HostDotPromo 5 жыл бұрын
Wow this is amazing, no longer need sass for small projects then! Cheers! 🍻😀
@garretbever
@garretbever 6 жыл бұрын
Thank you Brad, great explaination.
@kevinpratama1789
@kevinpratama1789 5 жыл бұрын
Just subscribed! Great video, Nice explanations! Thanks a lot sir!
@nethmiwelgamvila
@nethmiwelgamvila 3 жыл бұрын
❤️Really advantageous tutorial
@khamphone86
@khamphone86 6 жыл бұрын
this is a good video that taught me to have a new way to use the CSS coding. you're doing well :) happy holiday and happy new year.
@GamingBlake2002
@GamingBlake2002 5 жыл бұрын
Literally had no idea this existed. Great video
@milosh996
@milosh996 6 жыл бұрын
You make great tutorials. I'm getting email notifications about the new videos. Thank you.
@RageBasterd
@RageBasterd 6 жыл бұрын
i was waiting for this. last time you made a css\html video i was thinking of when youll do this.
@davidasiamah2898
@davidasiamah2898 6 жыл бұрын
Your intro video is so exciting, Long Live Traversy Media!!!
@priyaranjan1733
@priyaranjan1733 6 жыл бұрын
You're really freaking awesome! 😍
@harshdevmurari007
@harshdevmurari007 4 жыл бұрын
Excellent work...... 💚💛💙🧡💜❤️🖤 Your video explaination was in depth with full description You gained one subscriber form heart....
@seanghay_yath
@seanghay_yath 6 жыл бұрын
That's great Brad!
@JEBJOSH
@JEBJOSH 4 жыл бұрын
Really useful and helpful. Thank you!!!
@davidshimbi
@davidshimbi 6 жыл бұрын
Thank You so much! Happy new to You!
@candacejune416
@candacejune416 3 жыл бұрын
thanks, this really helped!!
@herbertk9266
@herbertk9266 6 жыл бұрын
Awesome as always
@phildavies3095
@phildavies3095 6 жыл бұрын
Hi Brad, Thanks for a awesome video!! Keep them coming man. Phil
@MenAtWorkMedia22
@MenAtWorkMedia22 6 жыл бұрын
Thanks, Brad!
@Owenizedd
@Owenizedd 6 жыл бұрын
Just a quick question, the setProperty syntax, is that changing the css variable value? Or make it inline style?
@nohael-hindy8972
@nohael-hindy8972 3 жыл бұрын
Very useful, thank you
@HasithaSameeraNova
@HasithaSameeraNova 6 жыл бұрын
Very helpful thanks for sharing.. cheers!!!!
@vadhub
@vadhub 6 жыл бұрын
Wow, css vars are totally going to change my workflow (for the better).
@andreitanasa3106
@andreitanasa3106 6 жыл бұрын
You're the best. Thank you for everything....
@TraversyMedia
@TraversyMedia 6 жыл бұрын
You are very welcome, thanks for watching :)
@BucurIonNiculae
@BucurIonNiculae 6 жыл бұрын
True, the best youtuber for me to...
@iamreg1965
@iamreg1965 4 жыл бұрын
Sweet stuff Brad. In my view the future tastes VANILLA.
@naruto58136
@naruto58136 2 жыл бұрын
this is awesome thanks
@retiar2111
@retiar2111 6 жыл бұрын
HQ content as always! didnt know this was possible o.o TY BRADD
@__greg__
@__greg__ 3 жыл бұрын
This is great!
@shekharaakula6233
@shekharaakula6233 5 жыл бұрын
Wonderful video!!
@metroid557
@metroid557 6 жыл бұрын
CSS just got a whole lot more fun!
@alial-shaikhly873
@alial-shaikhly873 4 жыл бұрын
Thank you very much for this information.... problem though... I use MS expression web 4 as it is free and it does not appear to recognise the var() for some reason. It does, however, recognise the :root{} part... Any idea why and how to rectify the problem? Many thanks
@SoberStones
@SoberStones 3 жыл бұрын
Thank you so much - I am following along to another video who is is using scss files - mine doesn't seem to want to work, so I am using CSSS. thank you so much - I could not figure it out on my own!!!
@kennyakins3536
@kennyakins3536 4 жыл бұрын
Nice tutorial, on VS code, the fastest way is to type - - when assigning the variable and it would show all your variables and and just enter to select the variable and it would automatically add the var (variable), instead of var().then select variable.
@user-vj3cu3wv9l
@user-vj3cu3wv9l 2 жыл бұрын
the best teacher
@JohnEthan777
@JohnEthan777 5 жыл бұрын
Can the fallbacks used in 18:16 be used for older browsers that don't support CSS variables? They do take away from the maintainability convenience so wondering what their purpose is otherwise.
@Tech-hm7vr
@Tech-hm7vr Жыл бұрын
Thanks so much sir ji 😍
@ivoalvieira
@ivoalvieira 6 жыл бұрын
Hi Brad, thank you for the video! Just a wee doubt, regarding your playlists. Do you place the videos in each playlist in the order that you think someone should follow, in a sort of logical progress level or order, or the most recent video is just added to the bottom of the playlist and you didn't planned its order?
@rahulvanmali1406
@rahulvanmali1406 6 жыл бұрын
Thank you for educating us.. Please make a video on animation with angular
@shozdott
@shozdott 6 жыл бұрын
what did you use to make intro logo etc?
@MarkoMelko
@MarkoMelko 6 жыл бұрын
This is super clean :) Brad, could you build video set about Timed events like Node Schedule & Cron like jobs. In cases i.e. where you need to get data (by time/date) from third party API and but it to app's db.
@hiteshchoudhary3412
@hiteshchoudhary3412 6 жыл бұрын
Thanks Brad
@pesiok
@pesiok 6 жыл бұрын
Great tutorial! Were you thinking about doing docker crash course with node.js examples?
@muthuhari8875
@muthuhari8875 6 жыл бұрын
Hi Brad , please do symfony4
@richardmonne7212
@richardmonne7212 2 жыл бұрын
cool video !
@MrVoidfull
@MrVoidfull 6 жыл бұрын
Thank you! Nothing similar to mixins in CSS3 yet? I would assume we will see those at some point into the future as well. I know you can just enumerate the classes in css and apply a certain set of styles to a bunch of classes at once, then apply other styles separately further down, but SASS - like mixins would give us a bit more freedom.
@jamesequanimity9963
@jamesequanimity9963 4 жыл бұрын
Hi I've watch this just today as of 2019 and the grid-gap already works even without the calc. Just a heads up.
@Albshr77
@Albshr77 6 жыл бұрын
Great video
@rainerschaa269
@rainerschaa269 6 жыл бұрын
thank you for this video. is there a way to read (and also modify) the variable directly per script?
@rainerschaa269
@rainerschaa269 6 жыл бұрын
here is the answer: read the initial style (my value is '--c1'): getComputedStyle(document.body).getPropertyValue('--c1') you can set the value dynamic: document.documentElement.style.setProperty('--c1', '#0000ff') then you can read the value with: getComputedStyle(document.body).getPropertyValue('--c1') or with: document.documentElement.style.getPropertyValue('--c1')
@visitviewnepal3851
@visitviewnepal3851 6 жыл бұрын
Hey there, my these two vars doesn't get work out. [ background-color: var(--main--bg-color); color: var(--main-txt-color); ]. Waiting for you suggestions.
@jaganPuram
@jaganPuram 6 жыл бұрын
Hi..Brad...Thanks for doing this job....Could you tell us ..What's major advantage of using CSS variables...?
@yutao1982
@yutao1982 3 жыл бұрын
great! thanks!
@mrdoner3451
@mrdoner3451 6 жыл бұрын
I've been using this for months without realizing it's native to css3. Has browser support only recently become good enough so that we can start using this?
@nguyenluongtrungk17dn71
@nguyenluongtrungk17dn71 Жыл бұрын
thank you so much
@Oswee
@Oswee 6 жыл бұрын
Can i use calc() with variables? Lets say... i have variable ---size: 40px. And i want to set it for some element to be 2px less without creating new variable. something like - height: calc(var(--size) - 2px);
@SuryakantUbhe
@SuryakantUbhe 5 жыл бұрын
Thank you.. its amazing..but i tried using class.. only apply 1st class not same another class.. what i do ?
@sirmonke
@sirmonke 2 жыл бұрын
is it possible to put these variables in to a seperate file? thx
@RafaelaSilva-ww6ct
@RafaelaSilva-ww6ct 2 жыл бұрын
I am just off downloading VS Code now, cause brackets doesn’t work with costom properties. Should I change browser as well? does anyone know what browser is best please?
@studstud5498
@studstud5498 5 жыл бұрын
can I use css variables with @import and @font-face
@TheRiyam-y23
@TheRiyam-y23 6 жыл бұрын
thanx
@angelasavino5244
@angelasavino5244 4 жыл бұрын
I have a question: if you change the color of the header background through javascript, there is no way I can catch this change and fix it again through css? Another thing: If you make changes through javascript, which document prevailes then as for changes and modifications, css javascript, html?? Thanks and congrats for contents
@leslieaikpe7762
@leslieaikpe7762 6 жыл бұрын
Hello!! Traversy I'm 19 years old and new in programming. I appreciate everything you do I am love soo much web development and i want to tell you one things...can you make beautiful count down clock which contain( years,date,weeks,day,hours,minutes and second) in a few tutorials ? please please... RÉPONDRE
@rijalefendi6465
@rijalefendi6465 6 жыл бұрын
hi Brad, you provide your full stack web course on eduonix. why dont you do the same thing on Udemy as well? i can't buy it on eduonix because i dont have paypal/credit card. thanks, brad.
@PraveenKumar-pw9kq
@PraveenKumar-pw9kq 6 жыл бұрын
Hey brad can you please make a video on Three.js using angular 5.
@SuryakantUbhe
@SuryakantUbhe 5 жыл бұрын
querySelector apply only one time ? or one class ?
@christiangyaban9666
@christiangyaban9666 6 жыл бұрын
thank u very much
@ronyahmed320
@ronyahmed320 3 жыл бұрын
coding dojo maybe good, but Traversey Media is best of all... :)
@techtipsuk
@techtipsuk 6 жыл бұрын
For me one of the most value aspects of using a pre processor is the ability to split my files down into separate partials for easy organisation.
@RameenFallschirmjager
@RameenFallschirmjager 4 жыл бұрын
Ok, we have css variable and sass gives us variables too. Which one we should us?
@ThePari7
@ThePari7 2 жыл бұрын
thankyou
Create a Split Landing Page With HTML, CSS & JS
34:13
Traversy Media
Рет қаралды 136 М.
Simple Explanation Of rem & em CSS Units
14:43
Traversy Media
Рет қаралды 118 М.
I Can't Believe We Did This...
00:38
Stokes Twins
Рет қаралды 130 МЛН
THEY made a RAINBOW M&M 🤩😳 LeoNata family #shorts
00:49
LeoNata Family
Рет қаралды 43 МЛН
Mom's Unique Approach to Teaching Kids Hygiene #shorts
00:16
Fabiosa Stories
Рет қаралды 26 МЛН
Flexbox CSS In 20 Minutes
19:59
Traversy Media
Рет қаралды 1,8 МЛН
Social Media Accordion With CSS3 Transitions
37:44
Traversy Media
Рет қаралды 56 М.
Grid CSS Responsive Website Layout - "Mobile First" Design
49:09
Traversy Media
Рет қаралды 414 М.
CSS Text Background Animation
11:15
Traversy Media
Рет қаралды 66 М.
Sliding Sign In & Sign Up Form
32:14
Traversy Media
Рет қаралды 248 М.
Basic Parallax Website With HTML & CSS
20:48
Traversy Media
Рет қаралды 438 М.
Build An HTML5 Website With A Responsive Layout
1:01:15
Traversy Media
Рет қаралды 3,1 МЛН
HTMX Crash Course | Dynamic Pages Without Writing Any JavaScript
56:47
Traversy Media
Рет қаралды 141 М.
CSS Crash Course For Absolute Beginners
1:25:11
Traversy Media
Рет қаралды 4,4 МЛН
20 Essential VS Code Extensions In 2024
14:26
Traversy Media
Рет қаралды 148 М.
Battery  low 🔋 🪫
0:10
dednahype
Рет қаралды 13 МЛН
Смартфон УЛУЧШАЕТ ЗРЕНИЕ!?
0:41
ÉЖИ АКСЁНОВ
Рет қаралды 1,2 МЛН
Rate This Smartphone Cooler Set-up ⭐
0:10
Shakeuptech
Рет қаралды 2,2 МЛН
Это Xiaomi Su7 Max 🤯 #xiaomi #su7max
1:01
Tynalieff Shorts
Рет қаралды 1,9 МЛН
Xiaomi SU-7 Max 2024 - Самый быстрый мобильник
32:11
Клубный сервис
Рет қаралды 356 М.