How to make the body background layer higher than the block element in CSS

云罗郡主
Release: 2018-11-20 16:51:26
forward
2864 people have browsed it

The content of this article is about how to realize that the body background layer is higher than the block element in CSS. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

The example in this article describes the CSS method to realize that the body background layer is higher than the block element, and is shared with everyone for your reference. The specific implementation method is as follows:

<!DOCTYPE html> 
<html> 
<head> 
<meta charset="UTF-8"> 
<title>demo</title> 
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui"> 
</head> 
<style> 
html, body{ 
width: 100%; 
max-width: 640px; 
height: 100%; 
overflow-x: hidden; 
margin: 0 auto; 
background-color: #000; 
font-family: 微软雅黑, 华文细黑, 黑体; 
} 
body{ 
background-image: url(&#39;img/person1.png&#39;); 
background-repeat: no-repeat; 
background-position: bottom; 
background-color: transparent; 
background-size: 100%; 
} 
.box{ 
width: 100%; 
height: 50%; 
background-color: green; 
z-index: -1; 
position: absolute; 
} 
</style> 
<body> 
<div></div> 
</body> 
</html>
Copy after login

The effect is as follows:

How to make the body background layer higher than the block element in CSS

The above is a complete introduction to how to realize the body background layer is higher than the block element in CSS. If you want To learn more about CSS3 tutorial, please pay attention to the PHP Chinese website.


The above is the detailed content of How to make the body background layer higher than the block element in CSS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:divcss5.com
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