Home >Web Front-end >CSS Tutorial >How to set the color of the border in css

How to set the color of the border in css

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-04-21 15:49:484239browse

You can use the background-color attribute in css to change the color within the border. You only need to set the "background-color: color value" style to the input element. The background-color attribute sets the background color of the element. The value is the color name, hexadecimal value and RGB code.

How to set the color of the border in css

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

Create html file and set page background color. Create h1 tag and content, create p tag and content, set border and border background color for h1 element. Sets the border and border background color for the p element.

<!DOCTYPE html> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>document</title> 
<style>
h1{
    border: 1px solid red;
    background-color: rgb(113, 255, 201);
}
p{
    border: 1px solid #fff;
    background-color: rgb(255, 182, 113);
}
</style>
</head> 
<body bgcolor="#ccc">
    <h1>这是一个标题</h1>
    <p>这是一个段落,这是一句话。</p>
</body> 
</html>

The effect is as follows:

How to set the color of the border in css

Recommended learning: css video tutorial

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