Detailed explanation of the 8 attribute values ​​of the background attribute (interview question)

Detailed explanation of the 8 attribute values ​​of the background attribute (interview question)

The value of the background property in CSS

  • background-color
  • background-image
  • background-repeat
  • background-position
  • background-attachment

Composite properties: background: background-color background-image background-repeat background-position background-attachment
New in CSS3: You cannot use the composite property of background
background-size,background-origin,background-clip

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
*{
margin: 0;
padding: 0;
}
.pic{
width: 300px;
height:400px;
border: 20px dashed aqua;
padding: 30px;
/* background-color:#f90;
background-image:url(https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1603882574342&di=e
fe3283a838eef10140bcab16bf06371&imgtype=0&src=http%3A%2F%2Fdpic.tiankong.com%2F8i%2Fzu%2FQJ6411171137.jpg);
background-repeat: no-repeat;
background-position: 50% 50%;
background-attachment: fixed; */
background:#f90 url(https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1603882574342&di=e
fe3283a838eef10140bcab16bf06371&imgtype=0&src=http%3A%2F%2Fdpic.tiankong.com%2F8i%2Fzu%2FQJ6411171137.jpg)
no-repeat 50% 50% fixed;
background-size: 100px 100px;
background-origin: border-box;
background-clip: content-box;
}
</style>
</head>
<body>
<div class="pic"></div>
</body>
</html>

This is the end of this article on the 8 attribute values ​​​​of the background attribute (interview questions). For more relevant background attribute value content, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope that everyone will support 123WORDPRESS.COM in the future!

<<:  Several ways to set the expiration time of localStorage

>>:  Sharing experience on the priority of CSS style loading

Recommend

How to create a Pod in Kubernetes

Table of contents How to create a Pod? kubectl to...

How to compare two database table structures in mysql

During the development and debugging process, it ...

MySQL uses the Partition function to implement horizontal partitioning strategy

Table of contents 1 Review 2 Five strategies for ...

Add a copy code button code to the website code block pre tag

Referring to other more professional blog systems...

Solution to Django's inability to access static resources with uwsgi+nginx proxy

When deploying uwsgi+nginx proxy Django, access u...

CnBlogs custom blog style sharing

After spending half the night on it, I finally ma...

Some summary of MySQL's fuzzy query like

1. Common usage: (1) Use with % % represents a wi...

Detailed tutorial on installing MySQL 8.0 from source code on CentOS 7.4

Table of contents 1. Environment 2. Preparation 3...

A good way to improve your design skills

So-called talent (left brain and right brain) Tha...

HTML table tag tutorial (21): row border color attribute BORDERCOLOR

To beautify the table, you can set different bord...

React Hooks Detailed Explanation

Table of contents What are hooks? Class Component...

How to build a DHCP server in Linux

Table of contents 1. Basic knowledge: 2. DHCP ser...

CSS imitates Apple's smooth switch button effect

Table of contents 1. Code analysis 2. Source code...

js to achieve the effect of light switch

This article example shares the specific code of ...