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

JavaScript canvas to achieve code rain effect

This article shares the specific code for canvas ...

A quick review of CSS3 pseudo-class selectors

Preface If CSS is the basic skill of front-end de...

js learning notes: class, super and extends keywords

Table of contents Preface 1. Create objects befor...

MySQL permissions and database design case study

Permissions and database design User Management U...

Why does your height:100% not work?

Why doesn't your height:100% work? This knowl...

VMware Workstation download and installation detailed tutorial

Virtual machines are very convenient testing soft...

What is Software 404 and 404 Error and what is the difference between them

First of all, what is 404 and soft 404? 404: Simpl...

Let IE6, IE7, IE8 support CSS3 rounded corners and shadow styles

I want to make a page using CSS3 rounded corners ...

Detailed explanation of mysql download and installation process

1: Download MySql Official website download addre...

In-depth explanation of various binary object relationships in JavaScript

Table of contents Preface Relationships between v...

Detailed explanation of the use of MySQL paradigm

1. Paradigm The English name of the paradigm is N...

How to redirect to other pages in html page within two seconds

Copy code The code is as follows: <!DOCTYPE ht...

The use and difference between JavaScript pseudo-array and array

Pseudo-arrays and arrays In JavaScript, except fo...

JavaScript String Object Methods

Table of contents Methods of String Object Method...