Home >Web Front-end >CSS Tutorial >How to remove background color in css

How to remove background color in css

王林
王林Original
2021-05-21 14:00:358955browse

The way to remove the background color in css is to add the background-color attribute to the background color and set the attribute value to transparent, such as [background-color:transparent;], transparent means transparent effect.

How to remove background color in css

The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.

In fact, it is very simple for us to remove the background color. We only need to use background-color:transparent;.

Let’s take a look at this property.

The background-color property sets the background color of an element.

Attribute value:

  • color Specifies the background color. In CSS Color Values ​​it is possible to find a complete list of color values.

  • transparent Specifies that the background color should be transparent. This is the default

  • inherit specifies the background color, which should be inherited from the parent element

Code example:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title></title> 
<style>
body
{
	background-color:yellow;
}
h1
{
	background-color:#00ff00;
}
p
{
	background-color:rgb(255,0,255);
}
</style>
</head>

<body>
<h1>这是标题 1</h1>
<p>这是一个段落。</p>
</body>

</html>

You can put Save the above code locally and run it to see the effect.

Related video sharing: css video tutorial

The above is the detailed content of How to remove background color 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