What Is CSS?

ExploreEXPLORE THE CATALOGSupercharge your career with 700+ hands-on coursesView All CoursesPythonJavaJavaScriptCReactDockerVue JSRWeb DevDevOpsAWSC#LEARNING TOOLSExplore the industry's most complete learning platformCoursesLevel up your skillsSkill PathsAchieve learning goalsProjectsBuild real-world applicationsMock InterviewsNewAI-Powered interviewsPersonalized PathsGet the right resources for your goalsLEARN TO CODECheck out our beginner friendly courses.PricingFor BusinessResourcesNewsletterCurated insights on AI, Cloud & System DesignBlogFor developers, By developersFree CheatsheetsDownload handy guides for tech topicsAnswersTrusted answers to developer questionsGamesSharpen your skills with daily challengesSearchCoursesLog InJoin for freeWhat is CSS?

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​:

svg viewer

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:

OutputHTML

They can also be defined inline:

OutputHTML

CSS 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 reserved

Tag » All H1 Elements Css