How To Use Variables in CSS without SASS or LESS in 10 Minutes or Less

2024 ж. 28 Қаң.
4 377 Рет қаралды

CSS has changed dramatically in recent years, and most people don't seem to be aware of those changes. One of the changes in CSS3 is the ability to use variables in CSS. We used to need SCSS, SASS, or LESS to get CSS variables. Now we can do so natively in CSS.
Full Training Courses: IAmTimCorey.com
Source Code: leadmagnets.app/?Resource=Css...
Mailing List: signup.iamtimcorey.com/

Пікірлер
  • Thank you Tim. I always learn something new from your videos.

    @jesusdelarua5995@jesusdelarua59953 ай бұрын
    • Glad to hear it.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • Great Tim. Learn something new, Thanks you!

    @jayvyas1342@jayvyas13423 ай бұрын
    • You are welcome.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • This is awesome Im glad they added this

    @RioTheHitman@RioTheHitman3 ай бұрын
    • I’m glad you like them.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • Thanks Master, your way of teaching is the best

    @andergarcia1115@andergarcia11153 ай бұрын
    • You are welcome.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • Excellent info. Nice to see you using VS Code.

    @richardnesh5919@richardnesh59193 ай бұрын
    • Thanks!

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • It wasn't directly mentioned, but I am guessing you can put all kinds of variable values, let that be a color, font, size, or other var(--variable)?

    @webluke@webluke3 ай бұрын
    • Yep.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • Awesome!

    @AabirKashif@AabirKashif3 ай бұрын
    • Thanks!

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • Thank you Tim. Tim how to start CRM systems.

    @vikikroft7228@vikikroft72283 ай бұрын
    • The place you start is by building LOTS of smaller applications. Trying to build a CRM system is like saying "I want to fly a rocket to the moon" as your first flight ever. It is really complicated.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • Great video, how did you get VScode and your web browswer to work in sync?

    @nickysmusic4592@nickysmusic45923 ай бұрын
    • I use a plug-in called Live Server.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • Nice!

    @davidschinsing8789@davidschinsing87893 ай бұрын
    • Thanks!

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • Nice. What about storing in a C# string and change at run time in a Blazor Razor page. Can we do this?

    @waynehawkins654@waynehawkins6543 ай бұрын
    • I don't know that you could do this. However, you could apply classes that would essentially do the same thing if you want.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • Is it possible to change the variable dynamically using JavaScript? I’m thinking like what if you provided a control on your website to change the color and the user change the color and you wanted it to go in your style variable so it could affect the whole site.

    @TheProfessionalGamerSS4444@TheProfessionalGamerSS44443 ай бұрын
    • Yes, you can do that.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • I'm wondering if there's a tool that would convert SASS/SCSS variables into CSS ones for me, so that I could leverage static analysis on SASS variables yet have the flexibility of dynamically modifying CSS variables using JavaScript.

    @VeaceslavBARBARII@VeaceslavBARBARII3 ай бұрын
    • What can you do with an SCSS variable that CSS variables don’t provide? You could even mix the two if needed but I’ve never seen the use case for that.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • ":root" is a css keyword? Can I have other css variable sections? maybe per page or something?

    @shaiarocks@shaiarocks3 ай бұрын
    • Yep, root is a pseudo-class, which means it effectively makes the variables into global variables. And yes, they can cascade like anything else in CSS, so you can define them at any level or re-define them at any level. There are a lot of things like this in CSS3 that people aren't aware of. Same with HTML5. That's why I spent so much time in the Web Development Mastercourse covering topics like this. HTML and CSS have changed a lot in the past few years.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • Is there any loops available?

    @RioTheHitman@RioTheHitman3 ай бұрын
    • I would encourage you not to treat CSS like a programming language. It is a styling language.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • Please use less sass in video titles. Thanks for the video, a nifty trick i will use.

    @user-bb3um9kr5i@user-bb3um9kr5i3 ай бұрын
    • You are welcome. And I’m assuming the SASS comment is a joke.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
  • hmm you are doing css now 😶

    @nested9301@nested93013 ай бұрын
    • Yep. I cover the supporting technologies around C# and the web is a big one.

      @IAmTimCorey@IAmTimCorey3 ай бұрын
    • He does it all 😁

      @mikebreeden6071@mikebreeden60713 ай бұрын
    • First time I heard of variables in CSS

      @jeffsherman9638@jeffsherman96383 ай бұрын
KZhead