HTML & CSS for Absolute Beginners: CSS syntax / formatting CSS
Skills:
HTML & CSS90%
Key Takeaways
The video covers the basics of CSS syntax and formatting, including selectors, properties, and values, as well as best practices for organizing and writing CSS code.
Full Transcript
all right so the syntax of CSS is actually very simple uh even if it looks a little bit weird especially compared to HTML and that is part of the fun of learning HTML CSS and JavaScript is all three languages are completely different from one another but there is a relationship between them and in this case the relationship is uh we're creating rules here to select things that are in our HTML and then style them so this rule that I have right here is selecting my body so this first thing I put there is called the selector that's my body and then this is the property that I'm choosing so I'm choosing my background color property and then I'm setting a value there so CSS is all about that selecting something and then property value Pairs and just for a very quick example of some of the other things we can do here I'm just going to shrink this down so we can see our page at the same time and I'm going to delete this and we're going to hit save on that so we go back to having a white background on our page and I'm going to select something else so if I come and take a look in my HTML over here let's say I want to select the title of my P page well if I look at the title there that's my H1 element so to select the H1 element we want to go back over to the stylesheet and then I would do the H1 now what's really important when you're selecting something in HTML is you're not going to be putting the triangle brackets we don't use those anywhere in CSS so when I look here I ignore the brackets that are on there and I'm just taking this thing that's right in the middle so if I want my H1 I take my H1 then after your selector you put your curly braces and vs codee's automatically going to put the the opening and the closing one for us so opening curly brace closing curly brace and then in here we write all the different things that we want to change and each one of those things is called a declaration as well uh I could start writing it right here but the best practice is always to go onto a new line so I'm going to push return it's using the indentation similar to how we saw it in our HTML and this time instead of a background color I can say color and this will change the color of the text so let's say I say color red and I save that and then I refresh over here and the color of it has changed or I could come in and say font size and I could say I don't know 50 pixels to make it really big and save that and hit refresh and it changes over here and I'll do one more before I talk a bit more about it uh let's do a text align and I'm going to write Center for this one and refresh and then that's going to Center that way so a few things you might have noticed here is when I'm writing these property value pairs I'm doing the property then after the name of the property then after the name of the property I'm putting a colon right there then I put the value I want and then after the value I'm putting a semicolon if I do not put semicolons this would be the same thing as in HTML as if I didn't put my closing uh tags for something so it just think that everything is part of my H1 and it could cause some problems so for example if I don't have those semicolons at the end and I refresh here you can see all the styles are gone because as far as the browser is concerned that's the same as writing this and and so it's saying color red font size 50 it just becomes a mess and it doesn't know what that is so just like in HTML we're creating new lines is just for us and we can add spaces and do different things that's only visual for us for the browser we need to have all of the correct things so color red so this is my property my value so I have a color declaration that's saying that my color will now be red and then I end that declaration here with the semicolon and then the semicolon here and a semicolon there and it does take a little bit of getting used to especially if you don't use a lot of semicolons but very quickly you're going to get used to writing the property values and always having your semicolons there and just it becomes very easy to also know sometimes if you forget one which can definitely happen that when you see that oh my text align Center and my font size aren't working the first thing to go look for is see if there's a typo because if you misspell a property uh VSS code's actually pretty good it will uh it will often highlight when there's a typo or something because it says it's an unknown property right there so that's one thing to look out for is just if you have typos but the other thing is if you do have missing semicolons or missing colons in the middle as well these different things are very important and you want to keep an eye out for them uh as you're working but as you can see VSS code helps us see these things by pointing out some of the mistakes that we might make along the way and another thing that's really important when we're writing our CSS just like with our HTML is this indentation that I talked about uh sometimes people get lazy and they write their CSS like this where they do it all together and at the beginning when you're just doing like one declaration it doesn't really seem like the end of the world because you have your H1 color red you have the red box that vs codes adding there to make life easier the problem with this is that it just becomes like you can see like the more you write the more Awkward this becomes and even if you have word wrap on like this is a big mess with word wrap on even and right now we only have three declarations on there you might end up with four 5 6 10 15 declarations uh on some things at times and so properly organizing them is really important it's going to make your life a lot easier in the long run and it's not hard to do it just means that every time we write something we do our selector so let's come in with a different selector this time I'm going to do p for my paragraphs I do my opening and closing curly braces and I hit return so I go on to a new line or enter now I rate the property I want so we're going to do color again after I do my color I do my colon let's say we do orange this time semicolon at the end and after my semicolon I always push enter or return to go onto a new line and now I hit save on there I can refresh over here and I see that all of my paragraphs have changed over to Orange uh which I definitely don't want to leave it that way it does not look very nice but at least I can see that it's actually working uh the another thing that I see sometimes people doing is they leave for some reason this ends up being over here it just again it just makes it a lot easier to see when you have your opening curly brace your closing curly brace and then all the different properties in one group and then you can come down put an extra space there and then maybe I choose my H2 and I say color is red we're creating a tabal color scheme right now but that's okay I get my H2S both switching over to the color red and then I can go and select the next thing and change other properties and values on the next thing
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
How to create an awesome navigation bar with HTML & CSS
Kevin Powell
Improve your CSS by Keepin' it DRY
Kevin Powell
HTML & CSS for Beginners Part 6: Images
Kevin Powell
HTML & CSS for Beginners Part 7: File Structure
Kevin Powell
HTML & CSS for Beginners Part 4: Bold and Italic text and HTML comments
Kevin Powell
HTML & CSS for Beginners Part 5: Links
Kevin Powell
HTML & CSS for Beginners Part 3: Paragraphs and Headings
Kevin Powell
HTML and CSS for Beginners Part 1: Introduction to HTML
Kevin Powell
HTML and CSS for Beginners Part 2: Building your first web page!
Kevin Powell
HTML & CSS for Beginner Part 8: Introduction to CSS
Kevin Powell
HTML & CSS for Beginners Part 9: External CSS
Kevin Powell
HTML & CSS for Beginners Part 10: Divs & Spans
Kevin Powell
HTML & CSS for Beginners Part 11: Classes & IDs
Kevin Powell
HTML & CSS for Beginners Part 12: The CSS Box Model - Margin, Borders & Padding explained
Kevin Powell
HTML & CSS for Beginners Part 13: Background Images
Kevin Powell
HTML & CSS for Beginners Part 14: Style Text with CSS
Kevin Powell
HTML & CSS for Beginners Part 15: How to style links
Kevin Powell
HTML & CSS for Beginners Part 16: CSS selectors and Specificity
Kevin Powell
HTML & CSS for Beginners Part 17: How to Create and Style HTML Lists
Kevin Powell
HTML & CSS for Beginners Part 18: How Floats and Clears work
Kevin Powell
HTML & CSS for Beginners Part 19: Colors with CSS - hex, rgba, and hsla
Kevin Powell
HTML & CSS for Beginners Part 20: How to center a div
Kevin Powell
HTML & CSS for Beginners Part 21: How to create a basic website layout - the HTML
Kevin Powell
HTML & CSS for Beginners Part 22: How to create a basic layout - the CSS
Kevin Powell
How to Create a Responsive Website from Scratch - Part 1: The HTML #Responsive #HTML5
Kevin Powell
How to Create a Responsive Website from Scratch - Part 2: The Header and Hero area #Responsive #CSS3
Kevin Powell
How to Create a Responsive Website from Scratch - Part 3: The About Section #Responsive #CSS
Kevin Powell
How to Create a Responsive Website from Scratch - Part 4: Building a Responsive Portfolio Section
Kevin Powell
How to Create a Responsive Website from Scratch - Part 5: Call To Action and Footer #CSS #Responsive
Kevin Powell
Tutorial: Learn how to use CSS Media Queries in less than 5 minutes
Kevin Powell
End of the year upate and what's coming to my channel to start the new year
Kevin Powell
Create a CSS only Mega Dropdown Menu
Kevin Powell
CSS Tutorial: Outline and Outline Offset
Kevin Powell
CSS Blending Modes
Kevin Powell
Parallax effect | 2 different ways to add it with jQuery
Kevin Powell
CSS Units: vh, vw, vmin, vmax #css #responsive #design
Kevin Powell
How to Create a Website - Complete workflow | Part 01: Intro + Setting things up
Kevin Powell
100 Subscribers speed coding bonus video
Kevin Powell
How to Create a Website - Complete workflow | Part 02: The Markup #HTML
Kevin Powell
How to Create a Website - Complete workflow | Part 03: Sass Variables and a Mixin #Sass
Kevin Powell
How to Create a Website - Complete workflow | Part 04: Setting up the hero and header
Kevin Powell
How to Create a Website - Complete workflow | Part 05: Typography & Buttons
Kevin Powell
How to Create a Website - Complete workflow | Part 06.1: Building the navigation with Flexbox
Kevin Powell
How to Create a Website - Complete workflow | Part 06.2: Making the nav work with jQuery
Kevin Powell
Redesigning & Coding My Website #CreateICG
Kevin Powell
How to Create a Website - Complete workflow | Part 07: Starting the flexbox grid
Kevin Powell
How to Create a Website - Complete workflow | Part 08: Promo & Problem shooting!
Kevin Powell
How to Create a Website - Complete workflow | Part 09: The CTA and Footer
Kevin Powell
How to Create a Website - Complete workflow | Part 10: Making it responsive
Kevin Powell
How to Create a Website - Complete workflow | Part 11: Making it responsive con't
Kevin Powell
How to Create a Website - Complete workflow | Part 12: Putting the site online
Kevin Powell
Create a Custom Grid System with CSS Calc() and Sass
Kevin Powell
CSS em and rem explained #CSS #responsive
Kevin Powell
Should you use Bootstrap?
Kevin Powell
How to add Smooth Scrolling to your one page website with jQuery
Kevin Powell
Let's learn Bootstrap 4
Kevin Powell
How I approach designing a website - my thought process
Kevin Powell
Build a website with Bootstrap 4 - Part 1: The setup
Kevin Powell
Build a website with Bootstrap 4 - Introduction
Kevin Powell
Build a website with Bootstrap 4 - Part 2: Customizing Variables
Kevin Powell
More on: HTML & CSS
View skill →Related Reads
📰
📰
📰
📰
How I made a scroll-scrubbed video portfolio fast (Next.js 15 + GSAP + canvas)
Dev.to · Pratham Sharma
5 Reasons HTML Is About to Change Frontend Development
Medium · Programming
5 Reasons HTML Is About to Change Frontend Development
Medium · JavaScript
copilot browser tools make the frontend reviewable
Dev.to · Paulo Victor Leite Lima Gomes
🎓
Tutor Explanation
DeepCamp AI