Home > Web Front-end > CSS Tutorial > How to make two backgrounds overlap with css

How to make two backgrounds overlap with css

藏色散人
Release: 2022-12-30 11:11:32
Original
3921 people have browsed it

Css method to overlap two backgrounds: First create an HTML sample file; then use [background-image:url(image address),url(image address);] to overlap the two background images. That’s it.

How to make two backgrounds overlap with css

The operating environment of this tutorial: windows7 system, HTML5&&CSS3 version, Dell G3 computer.

Recommended: css video tutorial

In css, you can use background-image:url (image address), url (image address); to make two backgrounds The pictures are displayed overlappingly.

This way, when you have the idea of ​​blending two shapes into something beautiful, you can get a nice result.

Example:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
body {
background-image: url(https://image.flaticon.com/icons/svg/748/748122.svg), url(https://images.unsplash.com/photo-1478719059408-592965723cbc?ixlib=rb-1.2.1&auto=format&fit=crop&w=2212&q=80);
background-position: center, top;
background-repeat: repeat, no-repeat;
background-size: contain, cover;
}
</style>
</head>
<body>
<!--   Your content here -->
</body>
</html>
Copy after login

Rendering:

How to make two backgrounds overlap with css

The above is the detailed content of How to make two backgrounds overlap with css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template