CSS Tutorial - Zero to Hero (Complete Course)

Brief Summary

This CSS Zero to Hero course provides a comprehensive guide to learning CSS from the ground up. It covers major CSS concepts through step-by-step lessons, practical examples, and coding exercises. The course includes styling a base website, creating grids and gradients, and working with custom fonts, colors, and backgrounds. It also features a final challenge to style a website from scratch, reinforcing learned skills.

  • Comprehensive CSS learning from basic to advanced concepts.
  • Practical application through styling a website and coding exercises.
  • Focus on responsive design, animations, and modern layout techniques.

Course Introduction and Motivation

The course aims to teach CSS from the ground up, covering major concepts step by step. It motivates learners by showcasing the transformation of a basic website using various CSS techniques, including grids, colors, gradients, custom fonts, and backgrounds. The course culminates in a challenge where learners style a website from scratch, applying all the skills they've acquired. This includes creating a responsive layout with animations. The course emphasizes understanding every line of code, making complex styling understandable.

Syllabus Overview

The course is structured into sections, each ending with a 10-question multiple-choice quiz to reinforce learning. Active participation and practical application of skills are encouraged for better retention. The syllabus includes an introductory section for setting up the course environment, followed by an introduction to CSS theory and document linking. Subsequent sections cover selectors, properties, colors, text styling, layout fundamentals, Flexbox, CSS Grid, animations, and transitions. The course concludes with a final exam and a practical challenge to style a website from scratch.

Software and Project Files

The course primarily uses Sublime Text as the recommended text editor for its color coding and formatting features. While Notepad can be used, Sublime Text is preferred for ease of development. Project files and code from each lecture are available on a GitHub repository, allowing learners to track progress and review changes. Those unfamiliar with Git can access lecture-specific changes directly on the GitHub page.

Introduction to CSS

CSS, or Cascading Style Sheets, is used to style websites, providing visual flair and distinguishing modern sites from older ones. It works in conjunction with HTML, which provides the structure and content. CSS files are saved in the ".css" format and use selectors to target HTML elements for styling.

Creating and Linking a CSS Stylesheet

To begin using CSS, a new CSS file is created in a dedicated directory and named "style.css". This file is then linked to the HTML document using a <link> tag within the <head> section. The rel attribute is set to "stylesheet", and the href attribute points to the CSS file's URL, ensuring the stylesheet is properly connected to the HTML page.

Testing Your CSS Stylesheet

To test if a CSS stylesheet is correctly linked, a random, obvious property is added to the CSS file. If the property's effect is visible on the webpage, the stylesheet is working. For example, setting the background-color property to red can quickly confirm the connection.

CSS Selectors: Grabbing and Styling HTML Elements

CSS selectors are used to target and style specific HTML elements. The element selector targets all elements of a specific type (e.g., <p>). The class selector targets elements with a specific class attribute, denoted by a dot prefix (e.g., .classname). The ID selector targets a unique element with a specific ID attribute, denoted by a hash symbol prefix (e.g., #idname).

Adding Classes and IDs to HTML Documents

Classes and IDs are added to HTML elements to apply specific styles. The class attribute can be used multiple times on different elements, allowing for reusable styles. The id attribute should be unique within a document, targeting a single element. CSS selectors then reference these classes and IDs to apply the defined styles.

Understanding Specificity in CSS

Specificity determines which CSS rule applies when multiple rules target the same element. Inline styles have the highest specificity, followed by IDs, classes, and then element selectors. Classes are reusable and can be applied to multiple elements, while IDs should be unique and used for specific, one-time styling.

Pseudo Selectors: Styling Based on State

Pseudo-selectors are used to style elements based on their state or position. Common pseudo-selectors include :hover for styling when a user hovers over an element, :first-child for the first element within a parent, :last-child for the last element, :nth-child(n) for styling elements based on their order, and :only-child for styling elements that are the only child of their parent. Anchor tags have specific pseudo-selectors like :link for unvisited links and :visited for visited links.

Advanced CSS Selectors

Advanced CSS selectors include the adjacent sibling selector (element + element), which selects an element immediately following another, and the general sibling combinator (element ~ element), which selects all following siblings. The child selector (parent > child) targets direct children of an element, while the descendant selector (parent element) targets all descendants.

Attribute Selectors: Targeting Elements by Attributes

Attribute selectors target HTML elements based on their attributes and values. The basic syntax is [attribute=value]. Additional selectors include [attribute^=value] for attributes starting with a value, [attribute$=value] for attributes ending with a value, and [attribute*=value] for attributes containing a value. Whitespace attribute selectors ([attribute~=value]) target elements with a specific class, and [attribute|=value] targets elements where the attribute is exactly equal to the value or starts with the value followed by a dash.

CSS Properties: The Building Blocks of Styling

CSS properties are used to style HTML elements, consisting of a property name and a value, separated by a colon and ending with a semicolon. Properties define aspects like color, background, positioning, height, and width. The value specifies the type of change, such as color names, RGB codes, or pixel values.

The CSS General Rule: Structure and Syntax

The CSS general rule consists of a selector, a CSS block enclosed in curly braces, and properties within the block. The selector targets HTML elements, and the properties define the styling. Each property includes a name, a colon, a value, and a semicolon. Multiple properties can be included within a single CSS block.

Coloring and Styling: Introduction

Coloring is essential for modern website design, enhancing visual appeal. The course covers different color types, including CSS color codes, hex codes, and RGB codes. CSS color codes provide easy-to-use names, while hex and RGB codes offer more specific color options.

Applying Colors to Text

Classes and IDs are added to HTML elements to apply specific styles. The color property is used to change text color, with values specified in hex or RGB codes. RGB codes are preferred for their flexibility, allowing easy manipulation of color components.

Background Colors: Adding Visual Depth

Background colors are added using the background property, which accepts hex codes, RGB codes, or CSS color names. Applying background colors to the entire page or specific elements can enhance the visual appeal. Lighter background colors are often preferred for better readability.

Background Images: Adding Visual Interest

Background images can be added using the background property with the url() function, which links to an image file either locally or from the internet. The background-image property can also be used. To ensure proper display, additional properties like background-repeat, background-position, and background-size may be needed.

Advanced Background Properties: Controlling Image Display

The background-repeat property controls how a background image is repeated, with options like no-repeat, repeat, repeat-x, and repeat-y. The background-size property adjusts the size of the image, with values like cover to fill the entire element and contain to fit the image within the element while maintaining its aspect ratio.

RGBA Colors: Adding Transparency

RGBA colors extend RGB by adding an alpha component, controlling transparency. The alpha value ranges from 0 (completely transparent) to 1 (fully opaque). This allows for creating subtle color effects and layering elements.

CSS Gradients: Smooth Color Transitions

CSS gradients create smooth transitions between colors. Linear gradients transition colors in a straight line, while radial gradients transition colors from a central point. Linear gradients are created using the linear-gradient() function, specifying the direction (e.g., to right, to bottom) and color stops. Radial gradients are created using the radial-gradient() function, specifying the shape (e.g., ellipse, circle) and color stops.

CSS Units: Absolute vs. Relative

CSS units define the size and dimensions of elements. Absolute units (e.g., centimeters, millimeters, inches, pixels) provide fixed sizes, while relative units (e.g., percentages, em, vw, vh) scale relative to other elements or the viewport. Pixels, though technically absolute, scale based on device DPI. Relative units are preferred for responsive designs.

Text Manipulation: Styling Text Elements

Text manipulation involves styling text elements using properties like text-decoration (underline, overline, line-through, none) and text-transform (uppercase, lowercase, capitalize). The text-align property controls text alignment (left, right, center, justify).

Font Properties: Enhancing Text Appearance

Font properties control the appearance of text. font-size sets the text size, font-weight sets the boldness, and font-style sets the italicization. These properties enhance the visual presentation of text elements.

Font Families: Choosing the Right Typeface

Font families are collections of fonts with similar characteristics. Main font families include serif, sans-serif, and monospace. The font-family property specifies the font, with fallback options for browser compatibility.

External Fonts: Expanding Your Options

External fonts can be imported from services like Google Fonts. The process involves linking the font stylesheet in the HTML document and specifying the font family in the CSS. Fallback fonts should be included to ensure readability if the external font fails to load.

CSS Layout: Introducing the Box Model

CSS layout involves controlling the positioning and spacing of elements. The box model is a fundamental concept where every element is treated as a box with content, padding, border, and margin layers. Padding adds space around the content, borders create a visible separation, and margins add space between the element and other elements.

Content Resizing: Controlling Element Dimensions

Content resizing involves setting the height and width of elements. Absolute units (pixels) are used for height, while relative units (vw, percentage) are preferred for width to ensure responsiveness. Chrome's Inspect tool allows for testing layouts on different devices.

Borders: Adding Visual Structure

Borders add visual structure to elements, with properties for size, style (solid, dotted, dashed, double), and color. Borders help visualize the box model and separate content from surrounding elements.

Margin and Padding: Spacing and Positioning

Margin and padding control spacing around elements. Padding adds internal space between the content and border, while margin adds external space between the element and other elements. Shorthand properties allow for setting values for all sides at once.

Float and Display: Controlling Element Flow

Float and display control how elements flow on the page. Block-level elements (e.g., <p>, <div>) take up the full width and start on a new line, while inline elements (e.g., <span>, <a>) flow within the text. The float property positions elements to the left or right, and the display property changes the display type (e.g., none, inline-block).

CSS Flexbox: Introduction to Flexible Layouts

Flexbox is a CSS layout model that provides an efficient way to align and distribute space among items in a container. It consists of a flex container (parent element) and flex items (child elements). Flexbox is used for creating responsive layouts and aligning elements in a flexible manner.

Creating a Flex Container

A flex container is created by setting the display property to flex on a parent element. This activates the flex layout for its child elements, allowing for easy alignment and distribution of space.

Flex Direction and Wrap: Controlling Item Flow

The flex-direction property specifies the direction of flex items (row or column), and the flex-wrap property controls whether items wrap to a new line or column when they exceed the container's size. These properties are essential for creating responsive layouts.

Justify Content and Align Items: Aligning Flex Items

The justify-content property aligns flex items horizontally within the container, with values like flex-start, flex-end, center, space-between, and space-around. The align-items property aligns flex items vertically, with values like flex-start, flex-end, center, baseline, and stretch.

Flex Item Order: Changing Item Positions

The order property changes the position of flex items within the container. By assigning numerical values to the order property, items can be rearranged without altering the HTML structure.

Flex Grow, Shrink, and Basis: Controlling Item Size

flex-grow determines how much an item will grow relative to other items in the flex container. flex-shrink determines how much an item will shrink relative to other items. flex-basis specifies the initial size of the item before the remaining space is distributed.

The Flex Shorthand: Streamlining Size Properties

The flex property is a shorthand for setting flex-grow, flex-shrink, and flex-basis in one declaration. This simplifies the code and makes it easier to manage flex item sizing.

Align Self: Individual Item Alignment

The align-self property overrides the align-items property for individual flex items, allowing for custom vertical alignment. Values include flex-start, flex-end, and center.

Grid vs. Flexbox: Choosing the Right Layout Tool

CSS Grid and Flexbox are both layout models, but they differ in their approach. Flexbox is primarily for one-dimensional layouts, focusing on either rows or columns, while Grid is for two-dimensional layouts, providing tools for both width and height. Grid offers more manual control over the layout.

Creating a Grid Container

A grid container is created by setting the display property to grid on a parent element. This activates the grid layout, allowing for the creation of structured two-dimensional layouts.

Grid Template Columns and Rows: Defining Grid Structure

The grid-template-columns and grid-template-rows properties define the number and size of columns and rows in a grid layout. Values can be specified in pixels, percentages, or using the auto keyword for even distribution.

Justify Content and Align Content: Aligning Grid Items

The justify-content property aligns grid items horizontally within the container, with values like start, end, center, space-around, and space-evenly. The align-content property aligns grid items vertically, using similar values and space-between.

Column and Row Gaps: Adding Spacing to Grids

The grid-column-gap and grid-row-gap properties specify the spacing between columns and rows in a grid layout. The shorthand grid-gap property sets both values at once.

Grid Lines: Positioning Items Precisely

Grid lines are used to position items within a grid. The grid-column and grid-row properties specify the start and end lines for an item, allowing it to span multiple columns or rows. The span keyword can be used to define the number of tracks an item should occupy.

Grid Area: A Shorthand for Positioning

The grid-area property is a shorthand for specifying the row start, column start, row end, and column end lines in one declaration. This simplifies the code and makes it easier to manage grid item positioning.

CSS Transitions: Adding Smoothness to Interactions

CSS transitions create smooth changes in property values over a specified duration. The transition property is a shorthand for transition-property, transition-duration, transition-timing-function, and transition-delay. Common timing functions include ease, linear, and ease-in-out.

CSS Transforms: Manipulating Element Appearance

CSS transforms alter the appearance of elements using functions like translate() for moving elements, scale() for resizing, and rotate() for rotating. Skew transformations (skewX(), skewY()) distort elements along the x and y axes. The matrix() function combines multiple transformations into one.

CSS Animations: Creating Dynamic Effects

CSS animations create dynamic effects by defining keyframes that specify the changes in property values over time. The @keyframes rule defines the animation, and properties like animation-name, animation-duration, animation-timing-function, animation-delay, animation-iteration-count, and animation-direction control the animation's behavior.

CSS Challenge: Styling a Website from Scratch

The course culminates in a challenge to style an unstyled website using the learned CSS techniques. The challenge involves applying coloring, layout, grid, Flexbox, and animations to revamp the website. A solution video is provided for reference.

Course Conclusion and Next Steps

After completing the course, learners should have proficiency in HTML5 and CSS3, enabling them to style websites with creative freedom. Next steps include learning JavaScript, exploring front-end frameworks (React, Vue.js), and considering back-end technologies (Node.js, Python, PHP) for full-stack development. Continuous learning and staying updated with new CSS features are encouraged.

Summarize any YouTube video in seconds

Get summaries like this one for any video, in your language, with the free Summ app.

Download on the Apple Store
Get it on Google Play

Transcript

Full transcript of “CSS Tutorial - Zero to Hero (Complete Course)”. Click a timestamp to open the video at that moment. Need another video? Use the YouTube transcript generator.

0:00 Hi, welcome to the CSS zero to hero course, in this course, you're going to completely learn how to use CSS from the ground up, we're going to cover every single concept or every major concept in CSS, and really build up our knowledge of it. So before we move on, I just wanted to give you some motivation on what you're going to be doing in this course. So you can, you know, really get excited about the course and start jump, you just jump straight into learning. So first of all, let's look at some of the stuff that we've done over the course. Now we start with a base website. And over time, we style this and change up the website using every technique that we've learned. So you can see that we've created multiple grids, colors, we've changed this completely and transformed the website in

0:47 every single way. We've also created things like gradients. And we've also styled change our custom fonts, colors, and backgrounds. We cover all of this in depth throughout the course. And we do it step by step so that you don't rush through and forget anything. At the end of the course, there's also a little challenge here, where you try to bring all your skills together and style a website from scratch. Now there is a solution video, if you need it, maybe you just want to see another opinion on it. But pretty much you're going to bring all the skills you learned in this course together and create this nice website. It's responsive, it's got all sorts of layout features. And it also has animations, you can see just like that. So that's some of the actual website stuff we're going to be

1:34 doing in the course. But why don't we look at some of the code that we've written. So I created this file from the start, I didn't have it at the start of this course. But at the end, you can see that we've written now, well over 100 lines of code here. And I although it may look intimidating. Now, I do explain every single part of it, so that at the end, you can just read this straightaway and understand what's going on in an instant. There's also the styling for our solution video or for the solution to the challenge here. So you can see we've got a bunch of stuff here. And like I said, it may look confusing, but once we move on, this will make a lot more sense. So that's pretty much it for the little achievements

2:19 video for this course, I hope you're a little bit motivated and excited to go forward and start learning about CSS is a pretty exciting topic. And it can really advance your web development if you don't already know it. Alright, let's get straight into it. Hi, welcome to the CSS zero to hero course, in this course, you're going to completely learn how to use CSS from the ground up, we're going to cover every single concept or every major concept in CSS, and really build up our knowledge of it. So before we move on, I just wanted to give you some motivation on what you're going to be doing in this course. So you can, you know, really get excited about the course and start jump, you just jump straight into learning. So first of all, let's look at some of the stuff that we've done over the course. Now we start with a base website. And over time, we style this and change up the website using every technique that we've learned. So you can see that we've created multiple grids, colors, we've changed this completely and transformed the website in every single way. We've also created things like gradients. And we've also styled change our custom fonts, colors, and backgrounds. We cover all of this in depth throughout the course. And we do it step by step so that you don't rush through and forget anything. At the end of the course, there's also a little challenge here, where you try to bring all your skills together and style a website from scratch. Now there is a solution video, if you need it, maybe you just want to see another opinion on it. But pretty much you're going to bring all the skills you learned in this course together and create this nice website. It's responsive, it's got all sorts of layout features. And it also has animations, you can see just like that. So that's some of the actual website stuff we're going to be doing in the course. But why don't we look at some of the code that we've written. So I created this file from the start, I didn't have it at the start of this course. But at the end, you can see that we've written now, well over 100 lines of code here. And I although it may look intimidating. Now, I do explain every single part of it, so that at the end, you can just read this straightaway and understand what's going on in an instant. There's also the styling for our solution video or for the solution to the challenge here. So you can see we've got a bunch of stuff here. And like I said, it may look confusing, but once we move on, this will make a lot more sense. So that's pretty much it for the little achievements video for this course, I hope you're a little bit motivated and excited to go forward and start learning about CSS is a pretty exciting topic. And it can really advance your web development if you don't already know it. Alright, let's get straight into it. So in this video, I'm going to be giving a quick introduction to the syllabus of the course. Now it is quite a long video. So if you don't want to watch it, or if you don't really want to know an in depth analysis on what the course is going to be covering, then you can go ahead and skip this video. All I say is that please make sure that you read

3:05 the prerequisites lecture that came before this. Now, there are some very important details in there and some skills that you need to know to move on with this course. And if you don't know them, you're going to have a very difficult time picking up some of the language. Now there's only one real prerequisite, which is HTML. But you can go ahead and read that. And just make sure that you have all the skills necessary. Alright, so let's get started. And the first thing I want to talk about is the section structure. So the section is just a it's a bunch of lectures. So these are video lectures. And they're made in an interactive way. So you can see in this picture here, I am coding along with a nice preview on the side showing what what our progress looks like. So at the end of each section is a 10, a 10 question multiple choice quiz that covers all of the skills learned in that section.

3:52 So it's really encouraged to go and just try it out and see if you know everything. And then that way you can diagnose yourself and see maybe there's some skills that you're fuzzy on or you need to revisit. And on top of that, I really encourage everyone who is following along in the course, to not just watch and be a passive consumer, you know, really go out and try and use your skills because otherwise you're not going to learn it. Otherwise, you're just gonna end up having the information on your head. And especially when it comes to development programming, you know, experiences everything, you can't just watch lectures and just magically be able to do it. So I encourage you to go off and follow the lectures and try and really use the skills that you learn in your own time and that will make sure that you have the highest retention possible. So let's get

4:41 straight into it. The first section, which is the section we're in right now is the introductory section. So setting up the course and we also install all the programs and software necessary to set up our working environment. So you can follow along it's not necessary but it is highly recommended. Because if you're using maybe Something else that you're not experienced with, you may have a hard time getting used to the program and things like that. So I recommend you follow along and set up the environment just like I do. So the second question of sorry, the second section is the introduction to CSS. Now, unlike the first section, this is going to be looking at introducing the actual CSS language, we're going to be looking at some theory behind it, where it's used and what kind of a difference it makes,

5:28 we're also going to be looking at creating and linking our own CSS document to our page. So the third section is going to be looking at our first real part of CSS. So these are the selectors and properties. Now, again, you don't need to know any of these terms. I'm just going over like a kind of spit ball kind of effect here, just trying to just skim over everything. So here we're going to learn about a very important concept, which are selectors and properties, and how they really play into CSS, we're also going to be learning about the different types of selectors and where to use each one, depending on the situation. So you're going to learn that as well. next section is where we start using the real power of CSS. So we're going to start using colors. And we're going to be applying those colors

6:14 to our page. So we're going to be learning about different color types, how kind of a little bit of how colors are set up on the computer. So things like RGB or other color codes, and then we're going to use them and apply them using CSS to backgrounds and text and all sorts of other things. The next section is going to be looking at mainly at text. So we're going to be looking at trying to change the field style and look of text. So we're going to be changing the fonts the size, we're also going to be changing the bolding, there are so many different things that you can do in the section. And we're going to cover all of them then. So the next section is where we will kind of take a turn from looking at styling and looking now at layout. So we're going to be learning some more fundamental

7:00 CSS concepts related to layout, we'll talk about those when we get to it, then we're going to be applying them to actually change the style or the layout of our page. So we're going to be moving items around, we're going to resize them and do all sorts of things with them once we get to that point. The next section we're going to look at is called Flexbox. Now I'm sure you've heard of this if you've looked into any web development, but pretty much it's an alternate way to mess around with the layout in CSS, and it is quite new. But it is a pretty commonly used concept today, especially for Responsive layouts, making websites that can work on all devices. So it's a pretty important concept there. So we're going to focus on the theory behind Flexbox. First, talking about how it works, how it's set up. And then we're also going to be applying it to real life talking about,

7:48 you know, where it can be used some of the benefits, and then actually using it in our own projects by creating our own Flexbox and messing around with it. So we're going to do that as well. So the next section is pretty similar to Section seven, it's going to be looking at a another alternative to using normal layout features. in CSS. It's called grid. And there are a lot of similarities. But we're also going to be talking about the differences. So along with going over a comprehensive overview of kind of how grid works, we're also going to be going over some of the similarities and differences kind of comparing it to Flexbox. And then we're going to talk about, you know which one you should use in each individual situation. So the next section is probably one of my favorites because it really puts

8:36 all of the older kind of websites from the new sites and separates them the modern sites from the old sites, and we're going to be looking at animations and transitions. So first, we're going to look at transitions and how to use pseudo selectors. Again, don't worry about our means to create these nice smooth transitions. And then we're also going to be learning how to manipulate them. So kind of change how a transition looks, we're also going to learn how to create a flight and manipulate our own animation. So we create these animations from scratch using CSS. And then we can kind of change them and change how they look based on what we want. So the last section is a really interesting section, which kind of summarizes everything and test your skills. So it starts with a 30 question

9:22 final exam, which is a bunch of questions from every single section or topic that we've covered. And it is it is a final exam. So there is like a passing grade and everything like that. But again, if you fail, there's no real consequences to it. It's just kind of a diagnostic tool to test where you are in your CSS knowledge. And after that, it's followed by a really nice challenge, which can help you know, really see where you're at, not from a theoretical standpoint, but from an actual practical standpoint. So this challenge is going to be talked about later and when to get to that point, but pretty much you're going to Be styling a website from scratch, you're going to be given a blank HTML document or Well, it's not blank, it's going to have content. But you're going to

10:08 be given an HTML document with no styling. And you have to style it yourself based on a list of So in this video, I'm going to be giving a quick introduction to the syllabus of the course. Now it is quite a long video. So if you don't want to watch it, or if you don't really want to know an in depth analysis on what the course is going to be covering, then you can go ahead and skip this video. All I say is that please make sure that you read the prerequisites lecture that came before this. Now, there are some very important details in there and some skills that you need to know to move on with this course. And if you don't know them, you're going to have a very difficult time picking up some of the language. Now there's only one real prerequisite, which is HTML. But you can go ahead and read that. And just make sure that you have all the skills necessary. Alright, so let's get started.

10:55 And the first thing I want to talk about is the section structure. So the section is just a it's a bunch of lectures. So these are video lectures. And they're made in an interactive way. So you can see in this picture here, I am coding along with a nice preview on the side showing what what our progress looks like. So at the end of each section is a 10, a 10 question multiple choice quiz that covers all of the skills learned in that section. So it's really encouraged to go and just try it out and see if you know everything. And then that way you can diagnose yourself and see maybe there's some skills that you're fuzzy on or you need to revisit. And on top of that, I really encourage everyone who is following along in the course, to not just watch and be a passive consumer, you know, really go out and try and use your skills because otherwise you're not going to learn

11:43 it. Otherwise, you're just gonna end up having the information on your head. And especially when it comes to development programming, you know, experiences everything, you can't just watch lectures and just magically be able to do it. So I encourage you to go off and follow the lectures and try and really use the skills that you learn in your own time and that will make sure that you have the highest retention possible. So let's get straight into it. The first section, which is the section we're in right now is the introductory section. So setting up the course and we also install all the programs and software necessary to set up our working environment. So you can follow along it's not necessary but it is highly recommended. Because if you're using maybe Something else that you're not experienced with, you may have a hard time getting used to the program and things like that. So I recommend you follow along and set up the environment just like I do. So the second

12:31 question of sorry, the second section is the introduction to CSS. Now, unlike the first section, this is going to be looking at introducing the actual CSS language, we're going to be looking at some theory behind it, where it's used and what kind of a difference it makes, we're also going to be looking at creating and linking our own CSS document to our page. So the third section is going to be looking at our first real part of CSS. So these are the selectors and properties. Now, again, you don't need to know any of these terms. I'm just going over like a kind of spit ball kind of effect here, just trying to just skim over everything. So here we're going to learn about a very important concept, which are selectors and properties, and how they really play into CSS, we're also going to be learning about the different types of selectors and where to use each one, depending on the situation. So you're going to learn that as well. next section is where we start using the real power of CSS. So we're going to start using colors. And we're going to be applying those colors

13:20 to our page. So we're going to be learning about different color types, how kind of a little bit of how colors are set up on the computer. So things like RGB or other color codes, and then we're going to use them and apply them using CSS to backgrounds and text and all sorts of other things. The next section is going to be looking at mainly at text. So we're going to be looking at trying to change the field style and look of text. So we're going to be changing the fonts the size, we're also going to be changing the bolding, there are so many different things that you can do in the section. And we're going to

14:07 cover all of them then. So the next section is where we will kind of take a turn from looking at styling and looking now at layout. So we're going to be learning some more fundamental CSS concepts related to layout, we'll talk about those when we get to it, then we're going to be applying them to actually change the style or the layout of our page. So we're going to be moving items around, we're going to resize them and do all sorts of things with them once we get to that point. The next section we're going to look at is called Flexbox. Now I'm sure you've heard of this if you've looked into any web development, but pretty much it's an alternate way to mess around with the layout in CSS, and it is quite new.

14:53 But it is a pretty commonly used concept today, especially for Responsive layouts, making websites that can work on all devices. So it's a pretty important concept there. So we're going to focus on the theory behind Flexbox. First, talking about how it works, how it's set up. And then we're also going to be applying it to real life talking about, you know, where it can be used some of the benefits, and then actually using it in our own projects by creating our own Flexbox and messing around with it. So we're going to do that as well. So the next section is pretty similar to Section seven, it's going to be looking at a another alternative to using normal layout features. in CSS. It's called grid. And there are a lot of similarities. But we're also going to be talking about the differences. So along with going over a comprehensive overview of kind of how grid works, we're

15:39 also going to be going over some of the similarities and differences kind of comparing it to Flexbox. And then we're going to talk about, you know which one you should use in each individual situation. So the next section is probably one of my favorites because it really puts all of the older kind of websites from the new sites and separates them the modern sites from the old sites, and we're going to be looking at animations and transitions. So first, we're going to look at transitions and how to use pseudo selectors. Again, don't worry about our means to create these nice smooth transitions. And then we're also going to be learning how to manipulate them. So kind of change how a transition looks, we're also going to learn how to create a flight and manipulate our own animation. So we create

16:24 these animations from scratch using CSS. And then we can kind of change them and change how they look based on what we want. So the last section is a really interesting section, which kind of summarizes everything and test your skills. So it starts with a 30 question final exam, which is a bunch of questions from every single section or topic that we've covered. And it is it is a final exam. So there is like a passing grade and everything like that. But again, if you fail, there's no real consequences to it. It's just kind of a diagnostic tool to test where you are in your CSS knowledge. And after that, it's followed by a really nice challenge, which can help you know, really see where you're at, not from a theoretical standpoint, but from an actual practical standpoint. So this

17:13 challenge is going to be talked about later and when to get to that point, but pretty much you're going to Be styling a website from scratch, you're going to be given a blank HTML document or Well, it's not blank, it's going to have content. But you're going to be given an HTML document with no styling. And you have to style it yourself based on a list of based on a list of tasks given in the document. Now, don't worry too much about that. But pretty much there is a solution video that I created to style it based on how I want the website to look. But again, it's not kind of like an iron fist thing, you can go and be creative with it once you get to that point. Because once you learn all that CSS, what's the point, if you just have to conform to something, you can really unleash your creative freedom through CSS, once you learn all the skills necessary. So again, it will be talked about in a lot more detail once we get to that point. But for now, that's just a quick

18:01 overview of what it's going to look like. From here. Alright, so there's a quick overview of what the course is going to go over some of the topics. Now, again, this isn't a, you know, kind of a strict video on, you know, this is what we're going to learn. And if you don't learn it, that's it. It's just kind of showing you what you're going to be getting out of the course, so that you can really get a view into it before you start working on the course. Alright, let's get started. based on a list of tasks given in the document. Now, don't worry too much about that. But pretty much there is a solution video that I created to style it based on how I want the website to look. But again, it's not kind of like an iron fist thing, you can go and be creative with it once you get to that point. Because once you learn all that CSS, what's the point, if you just have to conform to something, you can really unleash your creative

18:50 freedom through CSS, once you learn all the skills necessary. So again, it will be talked about in a lot more detail once we get to that point. But for now, that's just a quick overview of what it's going to look like. From here. Alright, so there's a quick overview of what the course is going to go over some of the topics. Now, again, this isn't a, you know, kind of a strict video on, you know, this is what we're going to learn. And if you don't learn it, that's it. It's just kind of showing you what you're going to be getting out of the course, so that you can really get a view into it before you start working on the course. Alright, let's get started. So in this video, I'm just going to be talking about some of the software that we're going to be using in this course. Now, there's not a lot of actual software, since most of the

19:39 stuff we're going to be doing is built straight into CSS and HTML. But we do need a text editor. And if you want to go ahead and use Notepad, go ahead. But I wouldn't really recommend that because it is quite hard to use when you're developing things. So I recommend this text editor right here. It's called Sublime Text, and gives you all of the color coding and formatting that you need, it makes things really easy for you. So you can go ahead to the website. Here, it's attached to the lecture resources, if you go ahead and click in the top left corner, in the bullet list icon, you can go ahead and find the lecture contents and downloadable resources. So go ahead, check out this website. And depending whether you're on Windows or Mac or Linux, you go ahead and download this. And then it should be pretty much it. So this is what its gonna look like when you're inside, I was just typing a little bit of stuff here making things making sure things were working. So there you go, this

20:28 is what it's gonna look like, once you download it, we'll go through and actually set everything up as we go through this course. Alright, let's move on. So before we move on, I just want to talk about finding project files. Now, I do do a lot of code throughout each lecture. And if you want to keep track of those, or maybe have some sort of working reference of what's going on, then I highly recommend that you go and check out the GitHub repository that I created for all the content of this course. Now, if you don't know what Git is, or how to use it, don't worry, I'm going to show an alternative to that in just a second, using this platform. But pretty much this is going to contain all the history of every single lecture. Now, if you know how to use Git, you can download this and check out each state. But if you don't know, then all you have to do is head over to the main page. And right here under commit, it's pretty much going to show every single lecture changes. So for example, I have seven to eight item alignment, so I can click on it. And

21:16 when I click on this, it shows all of the changes I have made to both files or any files that I've changed. So for example, you can see here, it has one changed file. And you can see I've added a bunch of stuff here. So you can kind of review what I've done over the lecture. So you can just go ahead and check it out. I've attached this to the lecture resources, if you want to go and look at it. Now, this does contain all of the history, all of the things that I've done over the course. So you can go review, maybe look at the code. And you can also download it, you can download the actual file or the the repository from here. So you can just download that very easily. And other than that, you can find all of the project files on here, if you ever need them. So if you want to, you know, maybe bookmark this or keep this somewhere or Notepad, just to make sure that you have a reference

22:02 of it throughout the course in case you ever want to go and review the contents or changes of some lecture. You will have it there. Alright, let's move on. So in this video, I'm just going to be talking about some of the software that we're going to be using in this course. Now, there's not a lot of actual software, since most of the stuff we're going to be doing is built straight into CSS and HTML. But we do need a text editor. And if you want to go ahead and use Notepad, go ahead. But I wouldn't really recommend that because it is quite hard to use when you're developing things. So I recommend this text editor right here. It's called Sublime Text, and gives you all of the color coding and formatting that you need, it makes things really easy for you. So you can go ahead to the website. Here, it's attached to the lecture resources, if you go ahead and click in the top left corner, in the bullet list icon, you can go ahead and find the lecture contents

22:49 and downloadable resources. So go ahead, check out this website. And depending whether you're on Windows or Mac or Linux, you go ahead and download this. And then it should be pretty much it. So this is what its gonna look like when you're inside, I was just typing a little bit of stuff here making things making sure things were working. So there you go, this is what it's gonna look like, once you download it, we'll go through and actually set everything up as we go through this course. Alright, let's move on. So before we move on, I just want to talk about finding project files. Now, I do do a lot of code throughout each lecture. And if you want to keep track of those, or maybe have some sort of working reference of what's going on, then I highly recommend that you go and check out the GitHub

23:39 repository that I created for all the content of this course. Now, if you don't know what Git is, or how to use it, don't worry, I'm going to show an alternative to that in just a second, using this platform. But pretty much this is going to contain all the history of every single lecture. Now, if you know how to use Git, you can download this and check out each state. But if you don't know, then all you have to do is head over to the main page. And right here under commit, it's pretty much going to show every single lecture changes. So for example, I have seven to eight item alignment, so I can click on it. And

24:26 when I click on this, it shows all of the changes I have made to both files or any files that I've changed. So for example, you can see here, it has one changed file. And you can see I've added a bunch of stuff here. So you can kind of review what I've done over the lecture. So you can just go ahead and check it out. I've attached this to the lecture resources, if you want to go and look at it. Now, this does contain all of the history, all of the things that I've done over the course. So you can go review, maybe look at the code. And you can also download it, you can download the actual file or the the repository from here. So you can just download that very easily. And other than that, you can find

25:17 all of the project files on here, if you ever need them. So if you want to, you know, maybe bookmark this or keep this somewhere or Notepad, just to make sure that you have a reference of it throughout the course in case you ever want to go and review the contents or changes of some lecture. You will have it there. Alright, let's move on. So today, I'm going to be giving a quick introduction to CSS, we're going to be going through what it actually is, why it's used and what actually does CSS do. So before we get started, if you're just starting out this course and you don't really know the prerequisites, make

26:03 sure that you do have a little bit of HTML experience. It's not recommended. Sorry, it's not needed. But it's highly recommended because we're going to be using a lot of HTML in this course. And although we're not going to be writing any directly, it would be really helpful to know some so I do offer a free HTML course. It's really quick one and a half hours, you should be go good to go and up and running in just one or two days. So if you don't know any HTML, you can go and check that out. And if you do know, HTML, continue watching along. So first of all, let's get started, what actually is CSS. So if you don't know what it stands for already, it's called Cascading Style Sheets. So from that name, you can pretty much assume

26:48 that this is used to style websites. So unlike HTML, which is used to create structure and actual website content, this is mainly used to give it that visual flair to make the websites look good. So CSS is pretty much what makes a website standout from websites from the early days from the early 2000s, things like that. So that's what really makes a website stand out is the CSS or the styling. So this pretty much goes hand in hand with HTML. As it said, Here, they work almost consistently together. And they're always used all like all the time together. So let's go ahead and check out some pages that look with CSS and without. So you can see here that this is the page with CSS. So you can change all of

27:42 the layout options. You can make fonts, font changes, text manipulation, all sorts of things, which we're all going to be doing in this course are learning to do. And this is the website without HTML, sorry, without CSS looks pretty standard, right? Obviously, this looks just like a normal website doesn't have any HTML, apart from some font changes. But you can see that the difference that something like this mix, CSS will completely change the way a website looks if it's used correctly. So the next line is just a little bit of information about CSS, we're going to be going way more in depth into all of these points later. So a CSS file is saved in the dot CSS format, we're going to be doing that in the next few videos. There's some information about selectors and things like that, like I said, you can just read through this, I'm not going to go through it, because we're going to talk about

28:27 it way more in detail in the next few sections. But for now, this is just a little bit of general information about CSS. Alright, so now that you know what CSS is, why don't we go ahead and get started working with CSS. So today, I'm going to be giving a quick introduction to CSS, we're going to be going through what it actually is, why it's used and what actually does CSS do. So before we get started, if you're just starting out this course and you don't really know the prerequisites, make sure that you do have a little bit of HTML experience. It's not recommended. Sorry, it's not needed. But it's highly recommended because we're going to be using a lot of HTML in this course. And although we're not going to be writing any directly, it would be really helpful to know some so I do offer a free HTML course. It's really quick one and a half hours, you should be go good to go and up and running in just one or two days. So if you don't know any HTML, you can go and check that out. And if you do know, HTML, continue watching along.

29:14 So first of all, let's get started, what actually is CSS. So if you don't know what it stands for already, it's called Cascading Style Sheets. So from that name, you can pretty much assume that this is used to style websites. So unlike HTML, which is used to create structure and actual website content, this is mainly used to give it that visual flair to make the websites look good. So CSS is pretty much what makes a website standout from websites from the early days from the early 2000s, things like that. So that's what really makes a website stand out is the CSS or the styling. So this pretty much goes hand in hand with HTML. As it said, Here, they work almost consistently together. And they're always used all like all the time together. So let's go ahead and check out some pages that look with CSS and without. So you can see here that this is the page with CSS. So you can change all of

30:00 the layout options. You can make fonts, font changes, text manipulation, all sorts of things, which we're all going to be doing in this course are learning to do. And this is the website without HTML, sorry, without CSS looks pretty standard, right? Obviously, this looks just like a normal website doesn't have any HTML, apart from some font changes. But you can see that the difference that something like this mix, CSS will completely change the way a website looks if it's used correctly. So the next line is just a little bit of information about CSS, we're going to be going way more in depth into all of these points later. So a CSS file is saved in the dot CSS format, we're going to be doing that in the next few videos. There's some information about selectors and things like that, like I said, you can just read through this, I'm not going to go through it, because we're going to talk about it way more in detail in the next few sections. But for now, this is just a little bit of

30:50 general information about CSS. Alright, so now that you know what CSS is, why don't we go ahead and get started working with CSS. So in this video, we're going to be creating and linking a CSS stylesheet. So we're not actually going to be doing with anything with it yet, we're just going to be creating it and linking it so that we can get started and actually learn some of the properties in CSS. Alright, let's get started. So the first thing I want to do is go ahead and create my CSS file. So what I'm going to do is go into my Sublime Text or my text editor. Now, if you're not using this, and you know how to use the other text editor that maybe you're using some something else like Visual Studio, go ahead and use that if you know the shortcuts.

31:39 But for now, I am going to use Sublime Text on Sublime Text. To create a new file, you go Ctrl or Command n depending on what operating system you're on. Once you're there, you can use Ctrl S to go ahead and save the file. And right now I'm here. And what I want to do is create a new folder, a new directory in my course content folder. Again, you can set this up however you like. But the way I like doing it is creating a folder for every type of file. So that for example, when the website gets very big, when you have multiple pages, multiple style sheets, everything stays organized. So I'm going to go ahead and create that directory. Go ahead into my CSS folder here. And I'm going to name this style dot

32:26 CSS. So dot CSS, D is the file format used to save CSS documents, and style, just kind of the standard name you use when you're saving CSS documents. So once I go ahead, and I'm going to go ahead and save that. Now I have my stylesheet created. But we don't actually have anything yet, because right now our HTML page is blank and our CSS file is blank. So this is where knowing a little bit of HTML comes in handy. First of all, I'm going to go ahead and create my boilerplate. I just typed in HTML and hit tab. Again, I talked all about this in my other courses talking about HTML. But there we go, we're going to go ahead and do that. I'm just going to say my website here. And once that's done, I'm going to go ahead and link it. So how do we actually do this? Well, what you want to do

33:16 pretty much is just go into here and into your head into the head portion of your website, you're going to go ahead and create a link tag. So if you just take the link and hit tab in Sublime Text, it's going to create the tag for you. So let's go ahead and break this down here. REL stylesheet is pretty much saying that we're linking to a stylesheet. But then type says it's a CSS stylesheet. So this is just kind of a more specific identifier. And then we have the href. So in the href. This is where we're going to put the URL to our stylesheet. So if you don't already know how to write file URLs, pretty much what we're going to do is first up move back in directory, because right now we're inside here and there's no CSS. We want to go back to the top level. So Going to go dot dot slash. Now remember,

34:03 we're up here, I want to go into CSS. So I hit CSS slash, and then style dot CSS, which has our endpoints or final destination. So this is pretty much your basic link tag, this is how it works. You have all of your stuff here and you created it. And from there, you can go ahead and pretty much do whatever you want. So right here, I have my stylesheet linked and everything's working. But we don't actually know if it works yet. So in the next video, we're actually going to be going through and testing our stylesheet, I'm going to show you a few ways that you can do that. Alright, let's move on. So today, I'm going to be showing

34:50 you how you can test your CSS stylesheet. So we've already created the file and linked it. But now we're actually going to go ahead and test it because we don't know if this is working or not. So obviously, we don't know anything about CSS yet. We don't know about selectors or properties or how to do anything with them. But I just want you to keep this in mind so that when you know how to do them, it becomes very easy to test these style sheets. So for a style sheet to work, we need all of the properties that are in this file to appear on the page. So the easiest way we can test it is but just by writing

35:41 a random, obvious property, that's going to change the way the website looks. If it's not working, then we know that something's wrong with our link. So I'm going to go ahead and just create a property here. Now, you don't know how to do any of this. So don't worry about it. We're going to learn how to do all of this later. But what you want to do pretty much is create a random property, you can go ahead and copy this on for now, I'm going to go ahead and refresh the page. And you can see that this is bright red. Now if I go ahead and make the link wrong. So if I, for example, remove a letter, you can see that it's still white, which means that this isn't working. So this is pretty much the easiest way that you can test your stylesheet. If it's working, it's just writing some random,

36:29 obvious properties don't make them completely non visible, you want to make sure that you can actually see the difference on the page. And then you want to go ahead and refresh it. And if it's working, you will know that this stylesheet is linked properly. Alright, let's move on. So in this video, we're going to be creating and linking a CSS stylesheet. So we're not actually going to be doing with anything with it yet, we're just going to be creating it and linking it so that we can get started and actually learn some of the properties in CSS. Alright, let's get started. So the first thing I want to do is go ahead and create my CSS file. So what I'm going to do is go into my Sublime Text or my text editor. Now, if you're not using this, and you know how to use the other text editor that maybe you're using some something else like Visual Studio, go ahead and use that if you know the shortcuts.

37:17 But for now, I am going to use Sublime Text on Sublime Text. To create a new file, you go Ctrl or Command n depending on what operating system you're on. Once you're there, you can use Ctrl S to go ahead and save the file. And right now I'm here. And what I want to do is create a new folder, a new directory in my course content folder. Again, you can set this up however you like. But the way I like doing it is creating a folder for every type of file. So that for example, when the website gets very big, when you have multiple pages, multiple style sheets, everything stays organized. So I'm going to go ahead and create that directory. Go ahead into my CSS folder here. And I'm going to name this style dot CSS. So dot CSS, D is the file format used to save CSS documents, and style, just kind

38:10 of the standard name you use when you're saving CSS documents. So once I go ahead, and I'm going to go ahead and save that. Now I have my stylesheet created. But we don't actually have anything yet, because right now our HTML page is blank and our CSS file is blank. So this is where knowing a little bit of HTML comes in handy. First of all, I'm going to go ahead and create my boilerplate. I just typed in HTML and hit tab. Again, I talked all about this in my other courses talking about HTML. But there we go, we're going to go ahead and do that. I'm just going to say my website here. And once that's done, I'm going to go ahead and link it. So how do we actually do this? Well, what you want to do

38:59 pretty much is just go into here and into your head into the head portion of your website, you're going to go ahead and create a link tag. So if you just take the link and hit tab in Sublime Text, it's going to create the tag for you. So let's go ahead and break this down here. REL stylesheet is pretty much saying that we're linking to a stylesheet. But then type says it's a CSS stylesheet. So this is just kind of a more specific identifier. And then we have the href. So in the href. This is where we're going to put the URL to our stylesheet. So if you don't already know how to write file URLs, pretty much what we're

39:48 going to do is first up move back in directory, because right now we're inside here and there's no CSS. We want to go back to the top level. So Going to go dot dot slash. Now remember, we're up here, I want to go into CSS. So I hit CSS slash, and then style dot CSS, which has our endpoints or final destination. So this is pretty much your basic link tag, this is how it works. You have all of your stuff here and you created it. And from there, you can go ahead and pretty much do whatever you want. So right here, I have my stylesheet linked and everything's working. But we don't actually know if it works yet. So in the next video, we're actually going to be going through and testing our stylesheet, I'm going to show

40:34 you a few ways that you can do that. Alright, let's move on. So today, I'm going to be showing you how you can test your CSS stylesheet. So we've already created the file and linked it. But now we're actually going to go ahead and test it because we don't know if this is working or not. So obviously, we don't know anything about CSS yet. We don't know about selectors or properties or how to do anything with them. But I just want you to keep this in mind so that when you know how to do them, it becomes very easy to test these style sheets. So for a style sheet to work, we need all of the properties that are in this file to appear on the page. So the easiest way we can test it is but just by writing

41:21 a random, obvious property, that's going to change the way the website looks. If it's not working, then we know that something's wrong with our link. So I'm going to go ahead and just create a property here. Now, you don't know how to do any of this. So don't worry about it. We're going to learn how to do all of this later. But what you want to do pretty much is create a random property, you can go ahead and copy this on for now, I'm going to go ahead and refresh the page. And you can see that this is bright red. Now if I go ahead and make the link wrong. So if I, for example, remove a letter, you can see that it's still white, which means that this isn't working. So this is pretty much the easiest way that you can test your stylesheet. If it's working, it's just writing some random, obvious properties don't make them completely non visible, you want to make sure that you can actually see the difference on the page. And then you want to go ahead and refresh

42:09 it. And if it's working, you will know that this stylesheet is linked properly. Alright, let's move on. So in this video, I'm going to be talking about CSS selectors. I'm also going to be going through what they do and what types of selectors there are. So you're probably wondering what a selector actually is, because we haven't actually talked about this at all. And it's pretty much one half of everything that you do in CSS. So as you know, you have two different documents, you have your HTML document, which is kind of your structure gives all of the different text and content of the page. And then you have your CSS document, which is going to be for all the styling. Now because the two documents are kind of disconnected, you can't just go and type random things and have them appear where you want them, you need a way to actually assign these styles and properties to elements on the page. So we do this with something called selectors. So selectors pretty much a way of grabbing

42:56 an element from an HTML document, and then styling it. So it's kind of like a target in a way. There are many different types of selectors. And they all work in different ways and are used for different purposes. So I'm going to be going through three with you in this video. So the first one is the element selector. The element selector is the most basic of all of them, pretty much, what you do is you find the name of the target that you want to select or target. So in this case, it would be the paragraph tag or the p tag. And then you have the selector here. So pretty much how a selector works is you just type out the selector. And then you have curly braces, and then you have your properties, we'll go that will go with this in much more depth towards the end of this section. So

43:47 you go through and you select, you type out your tag name. And pretty much what that's going to do is select all of the elements on the document with that tag name. So there we go. That is the first one. The next is the class selector. So the class selector is very similar to the element selector, except it goes by class name. So you can see here that we have some class attributes here, we assign the class, don't worry, we'll go through with this in the next video. But you can see we assigned the class to these values. And pretty much all we have to do to references is type dot, which is the class prefix for CSS, and then the name of the class and then again, the properties. So you can actually

44:34 use this cloud. The reason that we use classes over things like element selectors, is because you can apply this class to specific items, and it's only going to style those specific items. So for example, maybe if you had a subtitle, and you only wanted to style that subtitle, you would go through and actually apply that class to your subtitle, your element, whether it's a paragraph or a header. And from there, you're going to go through and add it. So there we go. The next What I want to talk about is the id selector. So these two, the class and id selector are pretty much identical, you have your attribute where you assign the class or ID. But the only difference is the prefix here is a hash symbol or an

45:25 octave Thorpe or hash tag. So then you type up the name of the ID, and it puts it here. Now, I am going to go through and actually talk more about why when we should use classes and IDs. And I'm going to talk about some of the differences between them. And although they look very similar, we actually have different very different purposes for them, based on how you use them in your HTML document. So those are some of the basics of selectors, like I said, we're gonna go through and pretty much use this all the time during our course. So we're gonna go through use them and add the properties. So it's pretty good that you get familiar with these now, so that when we move on, this becomes kind of like second

46:10 nature. So in this video, I'm going to be talking about CSS selectors. I'm also going to be going through what they do and what types of selectors there are. So you're probably wondering what a selector actually is, because we haven't actually talked about this at all. And it's pretty much one half of everything that you do in CSS. So as you know, you have two different documents, you have your HTML document, which is kind of your structure gives all of the different text and content of the page. And then you have your CSS document, which is going to be for all the styling. Now because the two documents are kind of disconnected, you can't just go and type random things and have them appear where you want them, you need a way to actually assign these styles and properties to elements on the page. So we do this with something called selectors. So selectors pretty much a way of grabbing an element from an HTML document, and then styling it. So it's kind of like a target

46:56 in a way. There are many different types of selectors. And they all work in different ways and are used for different purposes. So I'm going to be going through three with you in this video. So the first one is the element selector. The element selector is the most basic of all of them, pretty much, what you do is you find the name of the target that you want to select or target. So in this case, it would be the paragraph tag or the p tag. And then you have the selector here. So pretty much how a selector works is you just type out the selector. And then you have curly braces, and then you have your properties, we'll go that will go with this in much more depth towards the end of this section. So you go through and you select, you type out your tag name. And pretty much what that's

47:45 going to do is select all of the elements on the document with that tag name. So there we go. That is the first one. The next is the class selector. So the class selector is very similar to the element selector, except it goes by class name. So you can see here that we have some class attributes here, we assign the class, don't worry, we'll go through with this in the next video. But you can see we assigned the class to these values. And pretty much all we have to do to references is type dot, which is the class prefix for CSS, and then the name of the class and then again, the properties. So you can actually use this cloud. The reason that we use classes over things like element selectors, is because you can apply this class to specific items, and it's only going to style those specific

48:35 items. So for example, maybe if you had a subtitle, and you only wanted to style that subtitle, you would go through and actually apply that class to your subtitle, your element, whether it's a paragraph or a header. And from there, you're going to go through and add it. So there we go. The next What I want to talk about is the id selector. So these two, the class and id selector are pretty much identical, you have your attribute where you assign the class or ID. But the only difference is the prefix here is a hash symbol or an octave Thorpe or hash tag. So then you type up the name of the ID, and it puts it here. Now, I am going to go through and actually talk more about why when we should use classes

49:21 and IDs. And I'm going to talk about some of the differences between them. And although they look very similar, we actually have different very different purposes for them, based on how you use them in your HTML document. So those are some of the basics of selectors, like I said, we're gonna go through and pretty much use this all the time during our course. So we're gonna go through use them and add the properties. So it's pretty good that you get familiar with these now, so that when we move on, this becomes kind of like second nature. So in this video, I am going to be teaching you how to how to add classes in IDs to our document here and actually start using some of these selectors. Now, I'm not going to teach you any of the properties yet, because we're going to cover that in a little bit later in this section and in the next few sections. But I'm just going to be teaching

50:07 you how to get familiar with classes and IDs, because they are by far the most commonly used selectors in CSS, I mean, sometimes very uncommonly, you'd see some elements, selectors, and other types of selectors, which we're going to go over in the next few videos. But the two most common that you're going to see are our classes and IDs. So let's go through and get started. Now I have a bunch of HTML content here, we're actually going to be using this and adding on to it for the rest of the course, we're going to be styling this website fully. But let's actually go through and start adding these classes and IDs. So the first thing you need to note, before we move on, is that classes and IDs are different, you can't just use them interchangeably. And I'm going to explain why in the next video. But for now, let's just pretend that they are the same. And we can use them interchangeably

50:53 because they have almost the same methods of application. So let's go ahead now the first thing you want to do is identify the element that you want to target. So first of all, let's just say I wanted to maybe make the color of this red. Okay, so the color of this title. Now that we know we've targeted it, we want to actually go through and edit it. So first thing, how do you think we would go through and do this now if you're thinking going through and adding an element selector or maybe adding some inline styles, if you know what that is, then you are right, partially, but the only problem is that if there are any other h ones on this page, then it will style all of them as well. And because we

51:39 only want to style this title, that wouldn't be really effective. So the best way to do this would be to use a class or an ID, I'm going to go ahead and use a class. So the way the way you would do this is go through and type in class as your attribute. And you would again, put this into the opening tag of whatever target element you want to style. And in here, you're putting, you're gonna put your class name. Now, if this isn't where you put your CSS prefix, this isn't where you put the dots. As I explained in the last video, here, you're just going to type the name of the class. So I'm going to go through and type a title, just like that. And you can name this whatever you want. But I'd recommend keeping it short and sweet. You don't want it to get too long, because then it's going

52:27 to be really hard to work with. So once you've applied that, and we go ahead and refresh the page, you can see that nothing's actually there, it hasn't started working yet. That's because we haven't applied any styles. So when we go over here, we need to actually select our element. So I'm going to go ahead and add the prefix for a class, which is dot, and then the name of the class, which is title. Then I'm going to open up these brackets and get started. So what I want to do here is now apply on my properties. I'm going to be explaining you to you how to do all of this in the next in future videos. of a for now,

53:13 all you need to know is that the first thing you need to do is select an element using some method. And then you're going to add the properties. So I'm going to go ahead and refresh the page. And you can see it works just like that. Now to prove to you that this works, I'm actually going to go through and style just this about me right here, blue. So you can see we have more than one h2 on the page, but there's only one h1. But let's say we wanted to only style this the about me and we didn't want to style every single h2, what I would do is go ahead and add a class of subtitle to our target element. And then here I would select it So in this video, I am going to be teaching you how to how to add classes in IDs to our

54:01 document here and actually start using some of these selectors. Now, I'm not going to teach you any of the properties yet, because we're going to cover that in a little bit later in this section and in the next few sections. But I'm just going to be teaching you how to get familiar with classes and IDs, because they are by far the most commonly used selectors in CSS, I mean, sometimes very uncommonly, you'd see some elements, selectors, and other types of selectors, which we're going to go over in the next few videos. But the two most common that you're going to see are our classes and IDs. So let's go through

54:48 and get started. Now I have a bunch of HTML content here, we're actually going to be using this and adding on to it for the rest of the course, we're going to be styling this website fully. But let's actually go through and start adding these classes and IDs. So the first thing you need to note, before we move on, is that classes and IDs are different, you can't just use them interchangeably. And I'm going to explain why in the next video. But for now, let's just pretend that they are the same. And we can use them interchangeably because they have almost the same methods of application. So let's go ahead now the first thing you want to do is identify the element that you want to target. So first of all, let's just say I wanted to maybe make the color of this red. Okay, so the color

55:37 of this title. Now that we know we've targeted it, we want to actually go through and edit it. So first thing, how do you think we would go through and do this now if you're thinking going through and adding an element selector or maybe adding some inline styles, if you know what that is, then you are right, partially, but the only problem is that if there are any other h ones on this page, then it will style all of them as well. And because we only want to style this title, that wouldn't be really effective. So the best way to do this would be to use a class or an ID, I'm going to go ahead and use a class. So the way the way you would do this is go through and type in class as your attribute. And you would again, put this into the opening tag of whatever target element you want to style.

56:23 And in here, you're putting, you're gonna put your class name. Now, if this isn't where you put your CSS prefix, this isn't where you put the dots. As I explained in the last video, here, you're just going to type the name of the class. So I'm going to go through and type a title, just like that. And you can name this whatever you want. But I'd recommend keeping it short and sweet. You don't want it to get too long, because then it's going to be really hard to work with. So once you've applied that, and we go ahead and refresh the page, you can see that nothing's actually there, it hasn't started working yet. That's because we haven't applied any styles. So when we go over here, we need to actually select our element. So I'm going to go ahead and add the prefix for a class, which is dot,

…

Share

More video summaries