CSS stands for Cascading Style Sheets
CSS describes how HTML elements are to be displayed on screen, paper, or in other media
CSS saves a lot of work. It can control the layout of multiple web pages all at once
External stylesheets are stored in CSS files
Why Use CSS?
CSS is used to define styles for your web pages, including the design, layout and variations in display for different devices and screen sizes.
CSS Solved a Big Problem
HTML was NEVER intended to contain tags for formatting a web page!
HTML was created to describe the content of a web page, like:
This is a paragraph.
elements will be center-aligned, with a red text color:
CSS Selectors
CSS selectors are used to "find" (or select) HTML elements based on their element name, id, class, attribute, and more.
The element Selector
The element selector selects elements based on the element name.
You can select all
elements on a page like this (in this case, all
elements will be center-aligned, with a red text color): The id Selector
The id selector uses the id attribute of an HTML element to select a specific element.
The id of an element should be unique within a page, so the id selector is used to select one unique element!
To select an element with a specific id, write a hash (#) character, followed by the id of the element.
The style rule below will be applied to the HTML element with id="para1":
The class Selector
The class selector selects elements with a specific class attribute.
To select elements with a specific class, write a period (.) character, followed by the name of the class.
In the example below, all HTML elements with class="center" will be red and center-aligned:
- Here are the Best 5 Themes for your WordPress Website to buy in 2022 which is SEO Friendly and optimized for search visibility.
- As a result, there are an increasing number of websites that provide gorgeous stock images. Furthermore, theyre absolutely free of charge!
- Simple customization options include the ability to upload your own header image or logo, modify the colour scheme.
- The theme also supports page editor plugins such as Elementor and WP Bakery Page Builder, which allow for virtually limitless customization.