How to adjust font color size in html

下次还敢
Release: 2024-04-11 13:40:14
Original
859 people have browsed it

By using CSS styles, you can adjust the color and size of fonts in HTML. Color can be specified using the color attribute and color name, hex code, etc.; size can be specified using the font-size attribute and various units (such as px, rem, %). Composite styles can be used when adjusting color and size at the same time.

How to adjust font color size in html

How to adjust the size and color of fonts in HTML

In HTML, you can adjust it by using CSS styles Font color and size.

Adjust font color:

  1. Use color attribute: color: red;

    Example:

    <code class="html"><p style="color: red;">红色文本</p></code>
    Copy after login
  2. Use CSS color name: color: blue;

    Example:

    <code class="html"><p style="color: blue;">蓝色文本</p></code>
    Copy after login
  3. Use hex code: color: #ff0000;

    Example:

    <code class="html"><p style="color: #ff0000;">纯红色文本</p></code>
    Copy after login

Adjust font size :

  1. ##Use

    font-size Attribute: font-size: 20px;

    Example:

    <code class="html"><p style="font-size: 20px;">20px 大小的文本</p></code>
    Copy after login
  2. Use CSS font size unit:

    font-size: 1.5rem;

    Example:

    <code class="html"><p style="font-size: 1.5rem;">1.5rem 大小的文本</p></code>
    Copy after login
  3. Use relative size units:

    font-size: 120%;

    Example:

    <code class="html"><p style="font-size: 120%;">120% 相对大小的文本</p></code>
    Copy after login

Adjust font color and size simultaneously:

To adjust font color and size at the same time, you can use a compound style:

<code class="html"><p style="color: blue; font-size: 20px;">蓝色 20px 文本</p></code>
Copy after login

The above is the detailed content of How to adjust font color size in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!