HTML & CSS for Absolute Beginners: CSS color basics

Kevin Powell · Beginner ·🌐 Frontend Engineering ·1y ago
Skills: HTML & CSS90%

Key Takeaways

This video covers the basics of CSS colors, including the use of hex codes, RGB values, and color keywords, and provides a hands-on tutorial on how to apply these concepts to a web page design.

Full Transcript

colors are a huge Topic in CSS and we're just going to scratch the surface of it a little bit uh one of the things that I want you to avoid is actually what I've done so far which is using Color keywords as you can see I've said orange I've said red but like orange like what's the Orange is it you know in this case it's sort of a a brightish orange but we have dark oranges and and all the you know there's lots of different types of oranges out there right and same with red like you could have a deep red and other versions of red and so like when we use a keyword we don't really know what version of the color we're getting we just see that we have a color coming in and just to hammer home why this could be a little bit problematic is I'm going to uh we'll keep both of those for now but I'm going to choose my body again so we'll say body and I'm going to say background color and just really fast those are sort of the two main areas there's a few other things we'll see as we keep going where there's colors that we can use but color is the color of your text and background color is the color of your background and so I'm going to say background color and I'm Gray and we're going to go take a look at what that looks like it's gray it's what you'd expect right uh I'm going to update this now I'm going to write dark gray and watch what happens when I refresh this it gets lighter slightly but it's a little bit lighter and just in case you didn't see that let's go back to regular gray I'm going to hit refresh and you can see it gets a bit darker why is dark gray lighter than gray it's a little bit strange right and that's why I would suggest not using the color keywords cuz you really don't know what you're going to be getting so instead of that you can either be using hex codes hsl values RGB values and there's some others that you can use as well but we're not going to worry too much about that the main one that I would actually suggest using for now is hex which looks really strange but it's generally what you get out of design software and other things and it's probably the most common one you'll see uh even if it's the hardest one to look at and know exactly what color you're getting but just like we get these little color swatches that come up in vs code that also happens with hex codes as well and to highlight this let's delete our are these ones here and just focus on our background color on the body and I'm going to come in with a hex code and a hex code will always start with a hashtag and then it's generally followed by six characters so let's just do 6 a 3B FF and you can see that comes in and VSS code is showing me what that color looks like I'm going to save that refresh and you can see that color coming in uh it looks a little bit weird it just looks like this random string of numbers and letters and it sort of is uh but this is actually an RGB value so the first two are the red value the second two are the green value and the FF here at the end the last two characters are the blue value and the way the scale works is actually you have all the numbers from 0 to 9 and then the letters go from a all the way up to F and let's just to do a really quick example if we did all zeros and I hit save it's pure black so that means we have nothing of any of the colors we have zero of any of everything and then if we did the opposite FF FF FF it means we have full of everything so that's going to give us white instead uh and then so that means if I wanted just red remember the first two values are red ff0000 0 would mean I have full red and then nothing of the other ones and we can come in refresh and we see it there it's a bit harsh on the eyes and I want to put it back to White so white was FF FF FF and I think another one there we go and we bring it back now sometimes you might see it where you only have three letters or numbers used instead of six like this so if I bring this down to just FFF and I hit save it's actually still going to stay White and the reason for that is if you put only three it's sort of like a shorthand so just as an example here I could write a BC and hit save and it gives me sort of this light grayish blue color that would be the same as having a a BB CC so if ever you're repeating the value twice for red for the blue or for the green you can actually skip doing that so we can say an A B C like that so it's either three or six now I don't want to dive too deep into how hex works because in general I don't write my own hex codes um we're going to be using Color Pickers often to get them or you just get them directly from the design so don't worry too much about it I just want to give a quick rundown if you are interested down below there is a link to a free code Camp article that does dive more into hex and how it all works so yeah if you if you're into this type of thing definitely go check it out but if not don't worry about it too much now in this case we actually have a design that we're trying to create and there's specific colors that are being used so once again those colors are down below so you can get them uh underneath this video and I'm going to do the first one here just for the title so you you know you can follow along with me on that one and then I'm going to encourage you to change this one and the footer on your own uh before I go and do it so I'm going to remove this body one cuz without any body Declaration on there it will keep that white background that we have there and the first thing I want to do is the H1 so as a reminder we want to select the element so H1 is the element open and close braces go on a new line and then I don't want to change the background I just want to change the color itself and the color I want for this one is a 46 76 A9 H I'm putting them all as uppercase it's tends to be how you see hex codes but it is okay if you write them in lowercase as well it doesn't change anything so if I refresh that you can see the color has switched over now we need to make it bigger and do other stuff with it if you know how to do that or you remember from when I was playing around before by all means you can do that but we'll cover those in other lessons as well but I'd encourage you to pause the video right now and add the correct colors to the H2 and add the background color and the text color on the footer now for the footer we are able to do it by selecting the entire footer and not selecting the paragraph inside of the footer so set both the background color and the color on the footer and not on the paragraph just to let you know and we'll talk more about how that works in a future lesson so I'm going to assume that you've done both of those so I'll walk through doing it as well and so we'll do my H2 open and close curly brace color and in this time the color is a CB 731 C and you can see here I did it as lowercase and it works perfectly fine and then the footer so for the footer as I mentioned we could do this directly on the paragraph but uh we're going to put it on the footer itself and talk more about that later so then on this one I'm going to do the background color is the uh 22466 C and then my color itself is white so FFF FFF and if you just put three FS that's perfectly fine that will also work and hit refresh and all the way down there at the bottom we can see that that's changed on over now if you do want to play around with changing the color of the body's background color change your paragraphs other things here by all means play around with it a little bit and once you're happy with how things are looking you can head off over on into the next lesson

Original Description

🎓 Enroll in this course for FREE - get additional lessons, written content, interactive exercises, and more: learn.kevinpowell.co 📂 Get the course files here: https://www.dropbox.com/scl/fo/kusdjekuytcaa3of0vtd4/AChRHcF13pNi93JWusfLW9A?rlkey=tbrbxnabsi52u6onal9rh7fwm&st=iyo2wujq&dl=0 Learn to build websites from scratch - even if you've never written a line of code before. This hands-on course teaches you the fundamentals of HTML and CSS, the building blocks of the web. You'll start with the basics and progress step-by-step to creating your own responsive websites. Perfect for complete beginners who want to start their web development journey. #css -- Come hang out with other dev's in my Discord Community 💬 https://discord.gg/nTYCvrK Keep up to date with everything I'm up to ✉ https://www.kevinpowell.co/newsletter Come hang out with me live every Monday on Twitch! 📺 https://www.twitch.tv/kevinpowellcss --- Help support my channel 👨‍🎓 Get a course: https://www.kevinpowell.co/courses 👕 Buy a shirt: https://teespring.com/stores/making-the-internet-awesome 📽️ Join as a channel member: https://youtube.com/@KevinPowell/join 💖 Support me on Patreon: https://www.patreon.com/kevinpowell or through YT memberships: Join this channel to get access to perks: https://www.youtube.com/channel/UCJZv4d5rbIKd4QHMPkcABCw/join --- My editor: VS Code - https://code.visualstudio.com/ --- I'm on some other places on the internet too! If you'd like a behind the scenes and previews of what's coming up on my YouTube channel, make sure to follow me on Instagram and Twitter. Bluesky: https://bsky.app/profile/kevinpowell.co Codepen: https://codepen.io/kevinpowell/ Github: https://github.com/kevin-powell --- And whatever you do, don't forget to keep on making your corner of the internet just a little bit more awesome!
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Kevin Powell · Kevin Powell · 0 of 60

← Previous Next →
1 How to create an awesome navigation bar with HTML & CSS
How to create an awesome navigation bar with HTML & CSS
Kevin Powell
2 Improve your CSS by Keepin' it DRY
Improve your CSS by Keepin' it DRY
Kevin Powell
3 HTML & CSS for Beginners Part 6: Images
HTML & CSS for Beginners Part 6: Images
Kevin Powell
4 HTML & CSS for Beginners Part 7: File Structure
HTML & CSS for Beginners Part 7: File Structure
Kevin Powell
5 HTML & CSS for Beginners Part 4: Bold and Italic text and HTML comments
HTML & CSS for Beginners Part 4: Bold and Italic text and HTML comments
Kevin Powell
6 HTML & CSS for Beginners Part 5: Links
HTML & CSS for Beginners Part 5: Links
Kevin Powell
7 HTML & CSS for Beginners Part 3: Paragraphs and Headings
HTML & CSS for Beginners Part 3: Paragraphs and Headings
Kevin Powell
8 HTML and CSS for Beginners Part 1: Introduction to HTML
HTML and CSS for Beginners Part 1: Introduction to HTML
Kevin Powell
9 HTML and CSS for Beginners Part 2: Building your first web page!
HTML and CSS for Beginners Part 2: Building your first web page!
Kevin Powell
10 HTML & CSS for Beginner Part 8: Introduction to CSS
HTML & CSS for Beginner Part 8: Introduction to CSS
Kevin Powell
11 HTML & CSS for Beginners Part 9: External CSS
HTML & CSS for Beginners Part 9: External CSS
Kevin Powell
12 HTML & CSS for Beginners Part 10: Divs & Spans
HTML & CSS for Beginners Part 10: Divs & Spans
Kevin Powell
13 HTML & CSS for Beginners Part 11: Classes & IDs
HTML & CSS for Beginners Part 11: Classes & IDs
Kevin Powell
14 HTML & CSS for Beginners Part 12: The CSS Box Model - Margin, Borders & Padding explained
HTML & CSS for Beginners Part 12: The CSS Box Model - Margin, Borders & Padding explained
Kevin Powell
15 HTML & CSS for Beginners Part 13: Background Images
HTML & CSS for Beginners Part 13: Background Images
Kevin Powell
16 HTML & CSS for Beginners Part 14: Style Text with CSS
HTML & CSS for Beginners Part 14: Style Text with CSS
Kevin Powell
17 HTML & CSS for Beginners Part 15: How to style links
HTML & CSS for Beginners Part 15: How to style links
Kevin Powell
18 HTML & CSS for Beginners Part 16: CSS selectors and Specificity
HTML & CSS for Beginners Part 16: CSS selectors and Specificity
Kevin Powell
19 HTML & CSS for Beginners Part 17: How to Create and Style HTML Lists
HTML & CSS for Beginners Part 17: How to Create and Style HTML Lists
Kevin Powell
20 HTML & CSS for Beginners Part 18: How Floats and Clears work
HTML & CSS for Beginners Part 18: How Floats and Clears work
Kevin Powell
21 HTML & CSS for Beginners Part 19: Colors with CSS - hex, rgba, and hsla
HTML & CSS for Beginners Part 19: Colors with CSS - hex, rgba, and hsla
Kevin Powell
22 HTML & CSS for Beginners Part 20: How to center a div
HTML & CSS for Beginners Part 20: How to center a div
Kevin Powell
23 HTML & CSS for Beginners Part 21: How to create a basic website layout - the HTML
HTML & CSS for Beginners Part 21: How to create a basic website layout - the HTML
Kevin Powell
24 HTML & CSS for Beginners Part 22: How to create a basic layout - the CSS
HTML & CSS for Beginners Part 22: How to create a basic layout - the CSS
Kevin Powell
25 How to Create a Responsive Website from Scratch - Part 1: The HTML #Responsive #HTML5
How to Create a Responsive Website from Scratch - Part 1: The HTML #Responsive #HTML5
Kevin Powell
26 How to Create a Responsive Website from Scratch - Part 2: The Header and Hero area #Responsive #CSS3
How to Create a Responsive Website from Scratch - Part 2: The Header and Hero area #Responsive #CSS3
Kevin Powell
27 How to Create a Responsive Website from Scratch - Part 3: The About Section #Responsive #CSS
How to Create a Responsive Website from Scratch - Part 3: The About Section #Responsive #CSS
Kevin Powell
28 How to Create a Responsive Website from Scratch - Part 4: Building a Responsive Portfolio Section
How to Create a Responsive Website from Scratch - Part 4: Building a Responsive Portfolio Section
Kevin Powell
29 How to Create a Responsive Website from Scratch - Part 5: Call To Action and Footer #CSS #Responsive
How to Create a Responsive Website from Scratch - Part 5: Call To Action and Footer #CSS #Responsive
Kevin Powell
30 Tutorial: Learn how to use CSS Media Queries in less than 5 minutes
Tutorial: Learn how to use CSS Media Queries in less than 5 minutes
Kevin Powell
31 End of the year upate and what's coming to my channel to start the new year
End of the year upate and what's coming to my channel to start the new year
Kevin Powell
32 Create a CSS only Mega Dropdown Menu
Create a CSS only Mega Dropdown Menu
Kevin Powell
33 CSS Tutorial: Outline and Outline Offset
CSS Tutorial: Outline and Outline Offset
Kevin Powell
34 CSS Blending Modes
CSS Blending Modes
Kevin Powell
35 Parallax effect | 2 different ways to add it with jQuery
Parallax effect | 2 different ways to add it with jQuery
Kevin Powell
36 CSS Units: vh, vw, vmin, vmax #css #responsive #design
CSS Units: vh, vw, vmin, vmax #css #responsive #design
Kevin Powell
37 How to Create a Website - Complete workflow | Part 01: Intro + Setting things up
How to Create a Website - Complete workflow | Part 01: Intro + Setting things up
Kevin Powell
38 100 Subscribers speed coding bonus video
100 Subscribers speed coding bonus video
Kevin Powell
39 How to Create a Website - Complete workflow | Part 02: The Markup #HTML
How to Create a Website - Complete workflow | Part 02: The Markup #HTML
Kevin Powell
40 How to Create a Website - Complete workflow | Part 03: Sass Variables and a Mixin #Sass
How to Create a Website - Complete workflow | Part 03: Sass Variables and a Mixin #Sass
Kevin Powell
41 How to Create a Website - Complete workflow | Part 04: Setting up the hero and header
How to Create a Website - Complete workflow | Part 04: Setting up the hero and header
Kevin Powell
42 How to Create a Website - Complete workflow | Part 05: Typography & Buttons
How to Create a Website - Complete workflow | Part 05: Typography & Buttons
Kevin Powell
43 How to Create a Website - Complete workflow | Part 06.1: Building the navigation with Flexbox
How to Create a Website - Complete workflow | Part 06.1: Building the navigation with Flexbox
Kevin Powell
44 How to Create a Website - Complete workflow | Part 06.2: Making the nav work with jQuery
How to Create a Website - Complete workflow | Part 06.2: Making the nav work with jQuery
Kevin Powell
45 Redesigning & Coding My Website #CreateICG
Redesigning & Coding My Website #CreateICG
Kevin Powell
46 How to Create a Website - Complete workflow | Part 07: Starting the flexbox grid
How to Create a Website - Complete workflow | Part 07: Starting the flexbox grid
Kevin Powell
47 How to Create a Website - Complete workflow | Part 08: Promo & Problem shooting!
How to Create a Website - Complete workflow | Part 08: Promo & Problem shooting!
Kevin Powell
48 How to Create a Website - Complete workflow | Part 09: The CTA and Footer
How to Create a Website - Complete workflow | Part 09: The CTA and Footer
Kevin Powell
49 How to Create a Website - Complete workflow | Part 10: Making it responsive
How to Create a Website - Complete workflow | Part 10: Making it responsive
Kevin Powell
50 How to Create a Website - Complete workflow | Part 11: Making it responsive con't
How to Create a Website - Complete workflow | Part 11: Making it responsive con't
Kevin Powell
51 How to Create a Website - Complete workflow | Part 12: Putting the site online
How to Create a Website - Complete workflow | Part 12: Putting the site online
Kevin Powell
52 Create a Custom Grid System with CSS Calc() and Sass
Create a Custom Grid System with CSS Calc() and Sass
Kevin Powell
53 CSS em and rem explained #CSS #responsive
CSS em and rem explained #CSS #responsive
Kevin Powell
54 Should you use Bootstrap?
Should you use Bootstrap?
Kevin Powell
55 How to add Smooth Scrolling to your one page website with jQuery
How to add Smooth Scrolling to your one page website with jQuery
Kevin Powell
56 Let's learn Bootstrap 4
Let's learn Bootstrap 4
Kevin Powell
57 How I approach designing a website - my thought process
How I approach designing a website - my thought process
Kevin Powell
58 Build a website with Bootstrap 4 - Part 1: The setup
Build a website with Bootstrap 4 - Part 1: The setup
Kevin Powell
59 Build a website with Bootstrap 4 - Introduction
Build a website with Bootstrap 4 - Introduction
Kevin Powell
60 Build a website with Bootstrap 4 - Part 2:  Customizing Variables
Build a website with Bootstrap 4 - Part 2: Customizing Variables
Kevin Powell

This video teaches the basics of CSS colors, including how to use hex codes and RGB values to customize the colors of a web page, and provides a hands-on tutorial on how to apply these concepts to a design.

Key Takeaways
  1. Open a code editor and create a new HTML file
  2. Add CSS styles to the HTML file to change the background color and text color
  3. Use hex codes or RGB values to specify custom colors
  4. Apply the colors to specific HTML elements, such as headings and paragraphs
  5. Experiment with different color combinations to achieve the desired design
💡 Using hex codes or RGB values provides more precise control over colors than using color keywords, and can help achieve a consistent design across different devices and browsers.

Related Reads

Up next
Elementor Angie Ai Plugin Tutorial
Quick Tips - Web Desiign & Ai Tools
Watch →