Change the look of your website’s text and background color with just a few lines of CSS code!

Whether you’re looking to give your website a fresh new look or just want to change the color scheme of your landing page, knowing how to change text and background color in CSS can be incredibly useful.

In this post, we’ll guide you through the step-by-step process of changing text and background color in CSS. So let’s jump right in!

Step 1: Create a New Style Sheet

Before we get started, make sure that you have a separate style sheet for your website. If you’re not sure how to create a new style sheet, follow these simple steps:

– Open your website’s HTML file in a text editor or web development IDE.

– Create a new file and save it as style.css (or any other file name that makes sense for your website).

– Link to your new style sheet in your HTML file using the tag.

Now that you have your style sheet set up, let’s move on to changing the text and background color.

Step 2: Select a Text and Background Color

The first thing you’ll need to do is choose the colors that you want to use for your text and background. You can select any colors you like, but we recommend using a color picker tool to help you find the perfect shade.

Once you’ve chosen your colors, note down their corresponding HEX code or RGB values. For example, the HEX code for a dark blue color is #00008B, and the RGB values are (0, 0, 139).

Step 3: Change the Text Color

To change the text color on your website, add the following line of CSS code to your style sheet:

“`

body {

color: #00008B;

}

“`

In this example, we’ve used the HEX code for dark blue. If you want to use a different color, just substitute the HEX code or RGB values for the ones you want to use.

This code tells the browser that all text on your website should be dark blue. If you only want to change the color of one specific element (e.g. a heading), you can use the element selector instead. For example:

“`

h1 {

color: #00008B;

}

“`

This code will change the color of all h1 headings on your website to dark blue.

Step 4: Change the Background Color

To change the background color on your website, add the following line of CSS code to your style sheet:

“`

body {

background-color: #F0F8FF;

}

“`

In this example, we’ve used the HEX code for a light blue color. Again, you can substitute the HEX code or RGB values for the color you want to use.

This code tells the browser that the background color of your website should be light blue. If you only want to change the color of a specific element’s background, you can use the element selector instead. For example:

“`

header {

background-color: #F0F8FF;

}

“`

This code will change the background color of the header element to light blue.

And that’s it! With just a few lines of CSS code, you can completely change the text and background color of your website. Play around with different colors and see what works best for your brand.

We want to thank the thought leader Anna Fitzgerald as the source for this content and such awesome teachings on the subject and we hope that this article can help you and your business! Here’s the link to his post https://blog.hubspot.com/website/change-text-color-css

Custom Website

We'll create a unique website design that suits the needs and image of your brand.

Website Redesign

We offer updates and improvements to existing websites to keep them fresh, competitive, and also converting for your target audience.

Ecommerce Websites

We craft user-friendly interfaces with a strong focus on user experience to create online stores with easy-to-use shopping functionalities.

Web Hosting Services

We provide one-year of free hosting solutions and domain name registration for our clients.

Multilingual Websites

We design websites that can be viewed in multiple languages so you can reach any audience you need with your message.

Copywriting Services

We provide professional copywriting for website content so you don't have to hire writers for converting content.

Atmospheric Thinking is a digital marketing company that specializes in and focuses on SEO. We believe that any business or brand should regularly have an SEO Strategy created that aligns with their goals so they have a great understanding of who their target audience is and how to better attract them and turn views into conversions. Set up a free consultation with us today!

Trending post

Solutions

Custom Website

We’ll create a unique website design that suits the needs and image of your brand.

Ecommerce Website

Strategies vary by region and target audiences are approached differently based on culture, language, location, and so much more.

Website Redesign

We craft user-friendly interfaces with a strong focus on user experience to create online stores with easy-to-use shopping functionalities.