HTML Color
- HTML color can used to edit for the documents.
- For your website to have a pleasing appearance and feel, colors are crucial.
- Using the <body> tag, you can set the color for the entire page.
Background color:
- The background-color attribute to set the colors for specific tags
- The bgcolor is a sets of colors for the background of the page like, headers and paragraphs tag.
Example:
<!DOCTYPE html>
<html>
<head>
<title>HTML</title>
</head>
<body>
<h1>Background
Colors</h1>
<h2 style ="background-color: purple;">Purple
color</h2>
<h2 style ="background-color: pink;">Pink
color</h2>
<h2 style ="background-color: blue;">Blue
color</h2>
<h2
style ="background-color:
green;">Green color</h2>
</body>
</html>
Output:
Text Color:
- To change the color of a text using an inline style attribute which is to be displayed on a web page.
- We can using this color for the text in HTML document.
Example:
<!DOCTYPE
html>
<html>
<head>
<title>HTML</title>
</head>
<body>
<h1>Text
Color</h1>
<h2 style ="color: tomato;">This is a
tomato color for the text</h2>
<h2
style ="color: lightpink;">This is a
lightpink color for the text</h2>
<h2
style ="color: skyblue;">This is a
skyblue color for the text</h2>
</body>
</html>
Output:
Border Color:
- HTML documents can use border we can give styles to them. We can give width, style and color for the border.
- The border-color property is used to set the color of a border, like border - specifies a color name, like "red".
Example:
<!DOCTYPE html>
<html>
<head>
<title>HTML</title>
</head>
<body>
<p
style ="border: 3px solid red;"> This
is red border.</p>
<p style ="border: 3px solid yellow;">
This is yellow border.</p>
<p style ="border: 3px solid blue;"> This
is blue border.</p >
</body>
</html>
Output:
More topic in HTML