search
HomeWeb Front-endCSS TutorialCSS text font color setting method (CSS color)

This article mainly introduces the method of setting CSS text font color (CSS color). Friends who need it can refer to it

1. Understanding CSS color (CSS color)

What we want to introduce here is what the web page color settings include; web page color regulations.

1. Commonly used colors include: font color, hyperlink color, web page background color, border color
2. Color specifications and color regulations: Web pages use RGB mode colors

2. Basic knowledge of color

The use of color in web pages is an essential element of web pages. The purpose of using color is to be distinctive, dynamic (especially used in hyperlinks), and beautiful. At the same time, color is also one of the style expression elements of various web pages. Learn about CSS font colors.

Comparison between traditional html color and css color under w3c standard and p CSS application color

CSS color color syntax:

color:#000000;

## In the #Css style, add the RGB color value (#FFFFFF, #000000, #F00) directly after the color.

The RGB color value is determined during the actual layout and can be obtained using the Photoshop (PS for short) picking tool.

3. Two methods to set the object color style

1. Use the color color style in the p tag

www.jb51.net


2. Use the color color style CSS code in the CSS selector:

.pcss5{color:#00F}

/* Set the text in the object pcss5 to be blue*/

Extended reading: Here we use CSS comments to set up this style, understand CSS comments

3, p CSS color style is complete Case:

Css code:

Copy code

The code is as follows:

.pcss5{color:#00F}
/* 设置对象pcss5内文字为蓝色 */

HTML code:

Copy code

The code is as follows:

<p> 
标签内使用color css样式
<p style="color:#F00">www.jb51.net 红色</p> 
</p> 
<p>外部样式表设置对象color颜色
<p class="pcss5">www.jb51.net 蓝色</p> 
</p>

4. Instance structure diagram:





The above uses the color color style within the tag and the color color style in the css code.

4. The text color control is the same

If the text color of traditional html and css is the same, use "color:" "RGB color value", if the color is black text That is, just add "color:#000;" to the corresponding CSS attribute selector.

5. Differences in web page background color settings

Traditionally set the background color using "bgcolor=color value", while in CSS, "background:" color value is used. For example: set the background to black, traditional Html setting, that is, add "bgcolor="#000"" in the tag to achieve a black background color. If it is in W3C, it will always be "background:#000" in the corresponding CSS selector. accomplish.

6. Difference in setting border color

Traditional "bordercolor=value", "border-color:" color value in CSS. For example: In traditional HTML, just add "bordercolor="#000"" directly to the table tag. In current CSS, set "border-color:#000;" to make the border color black. Remember to set the width and Style (dashed, implemented).

p Extended knowledge of CSS color values:

A color value is a keyword or a number in the RGB specification.

16 keywords are taken from the Windows VGA palette: Aqua, Black, Blue, Fuchsia, Gray, Green, Gray, Maroon, Navy, Olive, Purple, Red, Silver , cyan, white, yellow.

7. RGB color gives one of four methods

1. #rrggbb (for example, #00cc00) (it is strongly recommended to use this to represent color values)

2, #RGB (eg, #0c0)
3, RGB(十中,x,x) x is an inclusive integer between 0 and 255 (eg, RGB(0,204,0 ))
4, RGB (Y%, Y%, Y%), where y is an inclusive quantity between 0.0 and 100.0 (such as RGB (0%, 80%, 0%))

8. The following is the RGB color table


Of course, general web development software has color value pickers:


CSS color picker in web development software DW software
How to obtain CSS color value?
We can't remember the color value, and how to determine the exact same color value as the artwork? In fact, it is very simple. Usually we obtain the accurate color value through the color recognizer tool in the PS software. Of course, we can also use other specialized color recognition tools to obtain the accurate color value.

9. p css color color style summary
Use css style to set the color color style of object content. We can use named CSS class objects to set its color style, and set it directly in the html tag. color style. Above, we also introduced and practiced these two methods of setting color for text content in detail.

related suggestion:

HTML5 Video/Audio plays local files


The above is the detailed content of CSS text font color setting method (CSS color). 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
The Lost CSS Tricks of Cohost.orgThe Lost CSS Tricks of Cohost.orgApr 25, 2025 am 09:51 AM

In this post, Blackle Mori shows you a few of the hacks found while trying to push the limits of Cohost’s HTML support. Use these if you dare, lest you too get labelled a CSS criminal.

Next Level CSS Styling for CursorsNext Level CSS Styling for CursorsApr 23, 2025 am 11:04 AM

Custom cursors with CSS are great, but we can take things to the next level with JavaScript. Using JavaScript, we can transition between cursor states, place dynamic text within the cursor, apply complex animations, and apply filters.

Worlds Collide: Keyframe Collision Detection Using Style QueriesWorlds Collide: Keyframe Collision Detection Using Style QueriesApr 23, 2025 am 10:42 AM

Interactive CSS animations with elements ricocheting off each other seem more plausible in 2025. While it’s unnecessary to implement Pong in CSS, the increasing flexibility and power of CSS reinforce Lee's suspicion that one day it will be a

Using CSS backdrop-filter for UI EffectsUsing CSS backdrop-filter for UI EffectsApr 23, 2025 am 10:20 AM

Tips and tricks on utilizing the CSS backdrop-filter property to style user interfaces. You’ll learn how to layer backdrop filters among multiple elements, and integrate them with other CSS graphical effects to create elaborate designs.

SMIL on?SMIL on?Apr 23, 2025 am 09:57 AM

Well, it turns out that SVG's built-in animation features were never deprecated as planned. Sure, CSS and JavaScript are more than capable of carrying the load, but it's good to know that SMIL is not dead in the water as previously

'Pretty' is in the eye of the beholder'Pretty' is in the eye of the beholderApr 23, 2025 am 09:40 AM

Yay, let's jump for text-wrap: pretty landing in Safari Technology Preview! But beware that it's different from how it works in Chromium browsers.

CSS-Tricks Chronicles XLIIICSS-Tricks Chronicles XLIIIApr 23, 2025 am 09:35 AM

This CSS-Tricks update highlights significant progress in the Almanac, recent podcast appearances, a new CSS counters guide, and the addition of several new authors contributing valuable content.

Tailwind's @apply Feature is Better Than it SoundsTailwind's @apply Feature is Better Than it SoundsApr 23, 2025 am 09:23 AM

Most of the time, people showcase Tailwind's @apply feature with one of Tailwind's single-property utilities (which changes a single CSS declaration). When showcased this way, @apply doesn't sound promising at all. So obvio

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor