How To Add Css To H1 H2 H3

CSS Programming

When it comes to styling the headings on a webpage, CSS is the go-to tool for adding that personal touch. In this article, I’ll guide you through the process of adding CSS to the h1, h2, and h3 elements, allowing you to customize the appearance of these headings to match your design preferences.

First and foremost, it’s important to understand that CSS stands for Cascading Style Sheets. It is a style sheet language that allows you to specify how the content of a web page should be displayed. With CSS, you can control various aspects of the appearance, such as font size, color, and positioning.

Adding CSS to the h1 Heading

The h1 element is typically used to represent the main heading of a page. To add CSS to the h1 heading, you need to target it using a CSS selector. Let’s say you want to change the font color to red:

h1 {
  color: red;

This CSS code selects all h1 elements on the page and applies the specified styles. You can place this code in an external CSS file or include it within a <style> tag in the <head> section of your HTML document.

Adding CSS to the h2 and h3 Headings

Similarly, you can add CSS to the h2 and h3 headings by targeting them with their respective selectors. For example, let’s change the font size of h2 to 24 pixels and h3 to 20 pixels:

h2 {
  font-size: 24px;

h3 {
  font-size: 20px;

With these CSS rules, all h2 elements will have a font size of 24 pixels, while all h3 elements will have a font size of 20 pixels.

Remember, you can customize more than just the font color and size. CSS provides a wide range of properties that you can use to style the headings to your liking. Experiment with different combinations to achieve the desired look and feel.


In conclusion, adding CSS to the h1, h2, and h3 elements allows you to customize the appearance of these headings on your web page. By leveraging CSS selectors and properties, you can easily modify the font color, size, and other styling aspects. Get creative and make your headings stand out!