1. The Specific analysis of the background attribute in CSS attribute can set the Specific analysis of the background attribute in CSS style of an element. Of course, the premise is that the element has a specific width and height value.
Let’s start with a simple Specific analysis of the background attribute in CSS setting:
#show-box { width: 800px; height: 500px; Specific analysis of the background attribute in CSS: #000; Specific analysis of the background attribute in CSS-image: url(image url); } </style>
Here we simply set the color and Specific analysis of the background attribute in CSS texture.
Let’s take a look at the official Specific analysis of the background attribute in CSS attributes:
Syntax format:
Specific analysis of the background attribute in CSS: color position size repeat origin clip attachment image;
Note: If the two attributes "position" and "size" are set at the same time, you should use a left slash "/" instead of using spaces to separate the two parameter values. Separate: "position/size".
1 Specific analysis of the background attribute in CSS: url("img.jpg") center center/100% 100% no-repeat;
Attribute table (the image may be displayed too small, please right-click "Open in new tab" to view the original image):
1.color: Specific analysis of the background attribute in CSS color value. This attribute will add color to the entire element and is at the bottom (this can be seen if there is a Specific analysis of the background attribute in CSS image).
Optional value: The default is transparent, other values can be set by viewing the "CSS Color Value Table".
<style> #show-box { width: 180px; height: 180px; border: 20px dashed #000; Specific analysis of the background attribute in CSS-color: #000000; Specific analysis of the background attribute in CSS-color: blue; Specific analysis of the background attribute in CSS-color: rgb(255, 255, 255); Specific analysis of the background attribute in CSS-color: rgba(255, 255, 255, 0.8); } </style>
2.position: the positioning of the Specific analysis of the background attribute in CSS image. If there is no image setting, then this attribute has no effect.
Optional values: two parameters, horizontal position and vertical position. If there is only one value, the second value is "center".
The default value is the upper left corner of the element. Positional keywords (top, right, bottom, left, center) can be used. Percent (based on element size). Pixel values.
<style> #show-box { width: 180px; height: 180px; border: 20px dashed #000; Specific analysis of the background attribute in CSS-position: center; Specific analysis of the background attribute in CSS-position: center top; Specific analysis of the background attribute in CSS-position: 0 100px; Specific analysis of the background attribute in CSS-position: 10% 20%; } </style>
3.size: Image size. Applied to pictures.
Optional values: two values. If there is only one value, the second value is auto.
The default is the size of the image itself. You can use pixel values, percent (based on the element size).
Cover: Scale the image proportionally to cover this element. Similar to the "fill" of the desktop Specific analysis of the background attribute in CSS in Windows.
Contain: Scale the image proportionally to adapt to the width or height of the element. Similar to the "adaptation" of the desktop Specific analysis of the background attribute in CSS in Windows.
4.repeat: tiling method.
Repeat: Completely tile, copy the image to fill the entire element. (Default)
Repeat-x: Tile horizontally, copy and tile in the horizontal direction.
repeat-y: vertical tile, copy and tile in the vertical direction.
no-repeat: No tiling, only use one image.
5.origin: the reference area of the Specific analysis of the background attribute in CSS.
Optional values: border-box, padding-box, content-box.
6.clip: The visible area of the Specific analysis of the background attribute in CSS.
Optional values: border-box, padding-box, content-box.
Compare the renderings of different values:
1. origin: border-box; clip: border-box;
<style> #show-box { width: 180px; height: 180px; margin: 20px; padding: 20px; border: 20px dashed #000; Specific analysis of the background attribute in CSS: url("img.jpg") no-repeat border-box border-box; } </style>
2.origin:padding-box;clip:border-box;
<style> #show-box { width: 180px; height: 180px; margin: 20px; padding: 20px; border: 20px dashed #000; Specific analysis of the background attribute in CSS: url("img.jpg") no-repeat padding-box border-box; } </style>
4.origin:border-box;clip:content-box;
<style> #show-box { width: 180px; height: 180px; margin: 20px; padding: 20px; border: 20px dashed #000; Specific analysis of the background attribute in CSS: url("img.jpg") no-repeat content-box border-box; } </style>
It can be seen that origin sets the position, and clip will crop the Specific analysis of the background attribute in CSS image according to the area.
The default value is scroll: the Specific analysis of the background attribute in CSS image scrolls with the rest of the page. fixed: The Specific analysis of the background attribute in CSS image is fixed.
8. Multiple Specific analysis of the background attribute in CSS settings. Import images: Specific analysis of the background attribute in CSS-image: url(image url); 2. Multiple Specific analysis of the background attribute in CSS settings. How to write multiple Specific analysis of the background attribute in CSSs: separate them with commas "," and continue writing the Specific analysis of the background attribute in CSS attributes. Background:color position size repeat origin clip attachment image,
color position size repeat origin clip attachment image; Specific attributes can also be set individually :Specific analysis of the background attribute in CSS-image: url(image url 1), url(image url 2);<style> #show-box { width: 180px; height: 180px; margin: 20px; padding: 20px; border: 20px dashed #000; Specific analysis of the background attribute in CSS: url("img.jpg") no-repeat border-box content-box; } </style>
<style> #show-box { width: 180px; height: 180px; border: 20px dashed #000; Specific analysis of the background attribute in CSS: url("img.jpg1") left top/100% 100% no-repeat, url("img.jpg2") left center/100% 100% no-repeat, url("img.jpg3") left bottom/100% 100% no-repeat, url("img.jpg4") center top/100% 100% no-repeat; } </style>
The above is the detailed content of Specific analysis of the background attribute in CSS. For more information, please follow other related articles on the PHP Chinese website!

Here's a container with some child elements:

Flyout menus! The second you need to implement a menu that uses a hover event to display more menu items, you're in tricky territory. For one, they should

"The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect."- Tim Berners-Lee

In this week's roundup: datepickers are giving keyboard users headaches, a new web component compiler that helps fight FOUC, we finally get our hands on styling list item markers, and four steps to getting webmentions on your site.

The short answer: flex-shrink and flex-basis are probably what you’re lookin’ for.

In this week's look around the world of web platform news, Google Search Console makes it easier to view crawled markup, we learn that custom properties

The IndieWeb is a thing! They've got a conference coming up and everything. The New Yorker is even writing about it:


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 English version
Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.