Home  >  Article  >  Web Front-end  >  How to set the color of label label in html

How to set the color of label label in html

青灯夜游
青灯夜游Original
2021-05-20 11:22:1116285browse

htmlHow to set the label color: 1. Use the style attribute of the label tag and add the "color: color value;" style; 2. Use the style attribute of the label tag and add "background-color: color value;" "style.

How to set the color of label label in html

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

Method 1: Use the style attribute to add the "color: color value;" style

<form>
  <label for="male">Male</label>
  <input type="radio" name="sex" id="male" />
  <br />
  <label for="female" style="color: red;">Female</label>
  <input type="radio" name="sex" id="female" />
</form>

Rendering:

How to set the color of label label in html

##Method 2: Use the style attribute to add the "background-color: color value;" style

<form>
  <label for="male">Male</label>
  <input type="radio" name="sex" id="male" />
  <br />
  <label for="female" style="background-color: red;">Female</label>
  <input type="radio" name="sex" id="female" />
</form>

Rendering:

How to set the color of label label in html

Recommended tutorials:

html video tutorial, css video tutorial

The above is the detailed content of How to set the color of label label in html. 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