How do I set the font color in HTML? CSS setting font Color method Introduction

Source: Internet
Author: User
Tags tag name
In HTML we often use CSS style to beautify some of the shortcomings of HTML tags, today we say how to use the basic CSS style to change the color of the text, the article is easy to understand, I hope you can practice after reading to deepen the impression.

First, let's show you the basic code of HTML font:

<!doctype html>

Here are the four paragraphs of the p tag, which we should all be able to read, which is the simplest code style. (Want to see more: CSS video lessons)

Second, we want to set the HTML font color, we look at the CSS style code:

<style type= "Text/css" >p{color:blue}</style>

This is the setting in the P tag, which is to put the CSS style in the head tag of the above HTML, and then we can see the effect:

Now we see, is not all changed color Ah, this is the HTML of the paragraph p label parameter style design changes, we changed all the fonts are changed, if we want to change one of the sentence how to do?

Let's look at a complete code:

<!doctype html>

I added a class attribute to the third paragraph, so that the third P tag becomes a class, we can use the class to design its style, and now we set the third P tag yellow, let's look at the effect:

Now we can easily see that the text in the third paragraph becomes yellow, which is not obvious.

Three, CSS style change text color summary:

This is the CSS style we use to set the underlying paragraph properties. We can change the color of this article, of course, we can change the text of the other things, as long as we have this, then a lot of things can be easily understood, the above we also mentioned the class, the class is equivalent to a tag name, of course, this is a public name, a lot of people can use, We can add this name to other labels, so that other labels have the same effect.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.