We are going to discuss CSS Selectors and how to select an element and style it!

What are CSS Selectors?

They are simply selectors that can grab one or more elements from the HTML file. Every good looking webpage is because of CSS so it’s vital to understand how to select HTML elements! Probably!

Type Selector

The type selector is the most basic selector for styling elements. In our CSS, we can grab all elements of a type or element name. So if we want to style all <h1> elements, our css rule would look like this:

Image for post
Image for post
CSS style for an H1 Element

Class Selector

The class selector…. you guessed it, selects all elements with the specific class. If we give each div element in our HTML file a classname of class="section" and want to select each “section”, we prepend a period to the class when selecting the element. …

Marshall Slemp

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store