How to Change Text Color With CSS

By eHow Internet Editor

Rate: (1 Ratings)

CSS (cascading style sheets) lets you add style, such as text colors, background colors, fonts and formatting. If you can grasp HTML, you can pick up CSS rather quickly, too. Let's start out with a simple tag to change text color with CSS.

Instructions

Difficulty: Moderate

Things You’ll Need:

  • Text editor
Step1
Open up your text-based HTML editor. Open up a file so you can see and edit the source.
Step2
Set up default colors. Create a tag: <style type="text/css"> and insert it before the body tags. After that, begin defining the colors of different types of text. For example, to make all the headlines blue, type: H1 {color: blue}. Define all the text types, each one on a separate line. When you are done, close the tag with </style>.
Step3
Use default colors. After defining default colors, whenever you use that particular tag, it will be in your predefined color. For example, we have set H1 to blue, so if you were to type <h1> WOW! </h1> it would automatically be in blue.
Step4
Make an exception. If you want something to be something other than the default color, then simply place the CSS tag within the HTML tag to change it on the fly. For example, to change headlines to red, you would type <h1 style="color: red"> Now it's Red!</h1>.
Step5
Use contextual selectors. When defining defaults in the beginning, you can also set up more exceptions, based on context. For example, if you want all italics in the headline to be green, you would type: <h1 i "color: green">. Now, whenever you make something italic within a headline, it will be green, but outside it will be the default color.

Tips & Warnings

  • This is a basic tutorial. CSS is much, much more powerful if you learn more.
  • You can also use HEX colors. For example #F0FFFF is azure, and #FFFFFF is white.
  • Not all browsers support CSS. Older browsers may ignore the tags altogether, making your page look strange.

Post a Comment

POST A COMMENT

Request a New How-To Article

Looking for more How To information? Chances are there’s an eHow member who knows how to do what you’re looking to do. Submit an article request now!

eHow Article: How to Change Text Color With CSS

eHow Internet Editor

eHow Internet Editor

Category: Internet

Articles: See my other articles

Related Ads

Internet

Veesites
Meet Virginia DeBolt eHow’s Internet Expert.