Home > Article > Web Front-end > How to change div font color with css
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.
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.
In the test.html file, create a div and write the test text in the div.
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]
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.
Open the test.html file in the browser and check that the text in the div has been changed to red.
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".
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.
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!