Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set font colors in tr by css

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces css how to set the font color in tr, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand it.

In css, you can set the font color of the tr by adding a color attribute style to the tr element, in the syntax format "tr {color: color value;}"; where the color value can be defined using the color name, hexadecimal value, RGB or RGBA, HSL, and so on.

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

Tags define rows in the HTML table.

The tr element contains one or more th or td elements.

A simple form looks like this:

Name, age, Peter 20 Lois 20

Effect picture:

The font color in tr is black by default, so how to set its font color?

We can take advantage of the color attribute, which specifies the color of the text. You just need to set up:

Tr {color: # 0000FF;}

Can also cooperate with: nth-child (n) to set interlaced discoloration effect:

Tr:nth-child (odd) {color: # 0000FF;} tr:nth-child (even) {color: # FFC0CB;}

Extension: css color values can be written in 4 ways:

1. Use the color name

Although about 184 colors have been named, they are really supported by various browsers, and there are only 16 color names recommended by the CSS specification, as shown in the following table.

Table the color names recommended by the 1:CSS specification

/ * Color black pure black silver light gray navy light blue blue light blue green dark green lime light green teal indigo blue aqua deep red red scarlet purple deep purple fuchsia magenta olive brown yellow Yellow bright yellow gray dark gray white shell white * /

It is not recommended to use color names in web pages, especially on a large scale, to avoid some color names not being parsed by browsers or differences in the interpretation of colors by different browsers.

2. Hexadecimal color

The hexadecimal symbols # RRGGBB and # RGB (for example, # ff0000). "#" is followed by 6 or 3 hexadecimal characters (0-9, Amurf).

This is the most commonly used color selection method, such as:

# f03#F03#ff0033#FF0033

RGB, red-green-blue (red-green-blue (RGB))

Specifies that the color value is the color of the rgb code, and the function format is rgb (R _ Magi G ~ B). The value can be an integer or a percentage of 0-255.

Rgb (255pc0551) rgb (255p0pje 51) rgb (100% recollection 0% meme 20%) rgb (100% meme 0% meme 20%)

Expansion: RGBA, Red-Green-Blue-Alpha (RGBa)

RGBA extends the RGB color mode to include alpha channels that allow you to set the transparency of a color. A means transparency: 0 = transparent; 1 = opaque.

Rgba / * 10% opaque * / rgba / * 40% opaque * / rgba / * 70% opaque * / rgba / * opaque, i.e. red * /

4. HSL, hue-saturation-brightness (Hue-saturation-lightness)

The hue (Hue) represents an angle of the color ring (that is, a ring that represents a rainbow).

Saturation and lightness are expressed as percentages.

100% is full saturation, while 0% is a grayscale.

100% lightness is white, 0% lightness is black, and 50% lightness is "average".

Hsl (120100% 25%) / * dark green * / hsl (120100% 50%) / * green * / hsl (120100% 25%) / * light green * /

Expansion: HSLA, hue-saturation-lightness-alpha (HSLa)

HSLa extends from the HSL color mode and includes alpha channels that specify the transparency of a color. A means transparency: 0 = transparent; 1 = opaque.

Hsla (240100% 50% mine0.05) / * 5% opaque * / hsla (240100% 50%, 0.4) / * 40% opaque * / hsla (240100% 50%, 0.7) / * 70% opaque * / hsla (240100% 50%, 1) / * completely opaque * / thank you for reading this article carefully I hope the article "how to set the font color in css in tr" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report