What Is CSS?
Maybe your like
CSS (Cascading Style Sheets) describes how HTML elements will be displayed on a webpage. It controls the design elements of a webpage such as color schemes, dimensions of the HTML elements, webpage layout, and variations in display for different devices and screen sizes.
Syntax
A CSS rule consists of a selector and a declaration block:
The selector points the HTML element to a style. In the illustration above, the selector is pointing to an h1 element. The declaration block contains one or more declaration, separated by semi-colons. Each declaration includes a CSS property name and a value separated by a colon.
This particular CSS rule will color all h1 elements blue and make them bold.
Where is CSS written?
CSS rules can be written in the same HTML files between <style> </style> tags, as shown below:
OutputHTMLThey can also be defined inline:
OutputHTMLCSS rules can also be defined in an external CSS file with a .css extension. This file needs to be imported into the relevant HTML file(s).
OutputHTMLCSS (SCSS)Styling specific elements
In the examples above, the CSS rule applies a particular style to all h1 elements. However, if one wants to only style one particular element, then it needs to be targeted by either its ID or its class.
This functionality is shown in the code below:
OutputHTMLCSS (SCSS)Note how the class is styled with a . before the class’s name, and the ID is styled using a # before the ID’s name.
Relevant Answers
Explore Courses
Free Resources
Copyright ©2025 Educative, Inc. All rights reservedTag » All H1 Elements Css
-
Basic Selectors - The CSS Layout Workshop
-
CSS Element,element Selector - W3Schools
-
Css Selectors: Difference Between "body H1", "body .h1" And "body.h1"
-
Cascading Style Sheets, Designing For The Web – Chapter 2: CSS
-
-
: Les éléments De Titre De Section - MDN
-
Change The Color Of All
And
Elements, To "red ...
-
[Solved] To Add A Background Color For All
Elements, Which
-
How Do You Add A Background Color For All H1 Elements..., CSS Basic ...
-
How Does The Element Selector Work In CSS? - EduCBA
-
Quick Tip: Selecting By Tag Name (article) - Khan Academy
-
HTML And CSS Tutorial - Nanyang Technological University
-
How To Use CSS Selectors To Style Your Web Page - FreeCodeCamp
-
Can You Target All H1 Css?
-
Not - CSS-Tricks