html文本框颜色修改_如何更改HTML文本颜色?

html文本框颜色修改

html文本框颜色修改

Most of the HTML web pages contain text in order to provide information. HTML Text may contains instructions, explanation etc. But in order to make the reading experience better, the HTML text is generally formatted with different styling techniques, and coloring or changing text color is one of them. In this tutorial, we will explain how to change the HTML Text color in different ways.

大多数HTML网页包含文本以提供信息。 HTML文本可能包含说明,解释等。但是,为了使阅读体验更好,通常使用不同的样式技术来格式化HTML文本,其中的一种是上色或更改文本颜色。 在本教程中,我们将说明如何以不同方式更改HTML文本颜色。

为什么要更改HTML文本颜色? (Why Change HTML Text Color?)

Before starting to explain how to change HTML Text color, we will list some use cases and benefits changing text color.

在开始解释如何更改HTML文本颜色之前,我们将列出一些用例和更改文本颜色的好处。

  • Express an important part of the text or information.

    表达文本或信息的重要部分。
  • Mark important keywords in a text and made it easier to find.

    在文本中标记重要的关键字,以便于查找。
  • Style notes to differentiate from normal text.

    样式注释与普通文本有所区别。
  • Make warnings more visible and readable.

    使警告更清晰可见。

使用样式属性更改HTML颜色 (Change HTML Color With Style Attribute)

The most popular and easy way to change HTML text color is to use the style attribute of different HTML tags. In this example, we will change the <p> tag style attribute with the color value by setting the color we want to set.

更改HTML文本颜色的最流行,最简单的方法是使用不同HTML标记的style属性。 在此示例中,我们将通过设置要设置的颜色来使用color值更改<p>标签样式属性。

<html>
<body>

<p>I am normal which means black</p>
<p style="color:red;">I am RED</p>
<p style="color:blue;">I am BLUE</p>
<p style="color:yellow">I am YELLOW</p>
<p style="color:purple">I am PURPLE</p>
<p style="color:brown">I am BROWN</p>

</body>
</html>
Change HTML Color With Style Attribute
使用样式属性更改HTML颜色

更改特定标记或块HTML颜色(Change HTML Color For Specific Tag or Block)

We can set the HTML color for different tags or blocks. CSS class or selectors can be used to make a group of HTML elements text color.

我们可以为不同的标签或块设置HTML颜色。 CSS类或选择器可用于使一组HTML元素成为文本颜色。

<html>
<head>
  <style>  
    p {
      color: blue;
    }
    h1 {
      color: green;
    }
</style>
</head>
<body>

  <p>I am normal which means black</p>
  <h1>I am a Header</h1>

</body>
</html>
Change HTML Color For Specific Tag or Block
更改特定标记或块HTML颜色

HTML颜色格式(HTML Color Formats)

HTML Colors can be definedin different formats. Most popular HTML color formats are Hex, Color Name, RGB and HSL formats.

可以用不同的格式定义HTML颜色。 最受欢迎HTML颜色格式是十六进制,颜色名称,RGB和HSL格式。

LEARN MORE  HTML Bold Tag Usage and Examples
了解更多HTML粗体标记的用法和示例

Hex Color Code consist of hexadecimal value where the color can be expressed precisely. As an example ” #FF0000″ defines the red color.

Hex Color Code由十六进制值组成,可以精确表示颜色。 例如,“#FF0000”定义红色。

Color Name is the most used, popular, and human-friendly name where the exact color name is provided like red, cyan, black, etc.

Color Name是最常用,最受欢迎和人性化的名称,其中提供了准确的颜色名称,例如红色,青色,黑色等。

RGB Color Value is similar to the hex color code where 3 values are provided to define the color it is like a color palette where red, green, and blue are merged together in order to create other colors.

RGB Color Value类似于十六进制颜色代码,其中提供了3个值来定义颜色,就像将红色,绿色和蓝色合并在一起以创建其他颜色的调色板一样。

HTML Color Formats
HTML颜色格式

使用十六进制颜色代码更改HTML颜色(Change HTML Color With Hex Color Codes)

We can change the HTML text color by using Hex color code. We will just use previously defined techniques to set color.

我们可以使用十六进制颜色代码更改HTML文本颜色。 我们将只使用先前定义的技术来设置颜色。

<html>
<body>

<p>I am normal which means black</p>
<p style="color:#FF0000;">I am RED</p>
<p style="color:#0066ff;">I am BLUE</p>
<p style="color:#ffff00">I am YELLOW</p>
<p style="color:#663300">I am BROWN</p>

</body>
</html>
Change HTML Color With Hex Color Codes
使用十六进制颜色代码更改HTML颜色

使用颜色名称更改HTML颜色(Change HTML Color With Color Names)

Color names are the easiest way to define and change the HTML text color. Actually we have already provided examples to use color names for HTML text. Please take a look “Change HTML Color With Style Attribute” section.

颜色名称是定义和更改HTML文本颜色的最简单方法。 实际上,我们已经提供了将颜色名称用于HTML文本的示例。 请查看“使用样式属性更改HTML颜色”部分。

使用RGB颜色值更改HTML颜色 (Change HTML Color With RGB Color Values)

RBG Color values are another way to define different colors with different dark and light variations.

RBG颜色值是定义具有不同暗和亮变化的不同颜色的另一种方法。

<html>
<body>

<p>I am normal which means black</p>
<p style="color:rgb(255, 0, 0);">I am RED</p>
<p style="color:rgb(0, 102, 255);">I am BLUE</p>
<p style="color:rgb(255, 255, 0)">I am YELLOW</p>
<p style="color:rgb(102, 51, 0)">I am BROWN</p>

</body>
</html>
Change HTML Color With RGB Color Values
使用RGB颜色值更改HTML颜色

使用HSL颜色值更改HTML颜色(Change HTML Color With HSL Color Values)

Even not so popular HSL Color Values can be used to set HTML Text color. HSL looks similar to the RGB where some values are provided to define a color with more dark or light.

即使不是很流行的HSL颜色值也可以用来设置HTML文本颜色。 HSL看起来类似于RGB,其中提供了一些值以定义更暗或更亮的颜色。

<html>
<body>

<p>I am normal which means black</p>
<p style="color:hsl(0, 100%, 50%);">I am RED</p>
<p style="color:hsl(216, 100%, 50%);">I am BLUE</p>
<p style="color:hsl(60, 100%, 50%)">I am YELLOW</p>
<p style="color:hsl(30, 100%, 20%)">I am BROWN</p>

</body>
</html>
Change HTML Color With HSL Color Values
使用HSL颜色值更改HTML颜色

翻译自: https://www.poftut.com/how-to-change-html-text-color/

html文本框颜色修改

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值