Home  >  Article  >  Web Front-end  >  How to change div font color with css

How to change div font color with css

藏色散人
藏色散人Original
2021-03-01 10:09:369511browse

How to change the font color of div in css: first create an HTML sample file; then create a div and write the test text in the div; finally, set the text in the div through the color attribute in the css tag color.

How to change div font color with css

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.

Create a new html file, named test.html, to explain how to change the font color in css div.

How to change div font color with css

In the test.html file, create a div and write the test text in the div.

How to change div font color with css

In the test.html file, set the attribute of the div to dd, which is mainly used to style the div using css below. [Recommendation: css video tutorial]

How to change div font color with css

Set the color of the text within the div in the css tag. For example, below we set the style of the div with the class name dd, set the font size to 30px and the font color to red.

How to change div font color with css

Open the test.html file in the browser and check that the text in the div has been changed to red.

How to change div font color with css

In addition to using Chinese red to set the color of the font, you can also use hexadecimal values ​​to represent colors. For example, red can use " #F00".

How to change div font color with css

In addition to the above two methods, you can also use RGB color values ​​​​to change the text color. For example, red can use rgb(255,0, 0) settings.

How to change div font color with css

The above is the detailed content of How to change div font color with css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn