A detailed introduction to the background-size property in CSS3
We know that there is a very important attribute in CSS3, the bachground-size attribute. Its function is to define the size of the background image. There are 5 values, auto, pixel value, percentage, cover, and contain. Today I will teach you how to use the bachground-size attribute.
background-size:auto, the default value, fills the element with the size of the image itself, adjusts its own proportion according to the size of the element, and does not deform the image.
CSS3 about the background-size attribute
1.
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>background-size属性</title> <style type="text/css"> div{ width:300px; height:150px; border:1px solid black; background:url("photo.jpg") no-repeat; } </style></head><body> <div></div></body></html>
2. The size of the background image itself—width: 200px, height: 133px. The rendering of the above code is as follows:
Pixel values, such as 30px 50px, respectively represent width height
CSS3 about the background-size attribute
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>background-size属性</title> <style type="text/css"> div{ width:300px; height:150px; border:1px solid black; background:url("photo.jpg") no-repeat; background-size:250px 100px; } </style></head><body> <div></div></body></html>
I believe you have read these cases You have mastered the method. For more exciting information, please pay attention to other related articles on the php Chinese website!
Related reading:
Tutorial on using the transform attribute in Css3
Detailed introduction to the border-image attribute in Css3
Several ways to position in front-end projects
The above is the detailed content of A detailed introduction to the background-size property in CSS3. 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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

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

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download
The most popular open source editor