手机
当前位置:查字典教程网 >网页设计 > Div+Css教程 >CSS实现body背景层高于块元素的方法
CSS实现body背景层高于块元素的方法
摘要:本文实例讲述了CSS实现body背景层高于块元素的方法,分享给大家供大家参考。具体实现方法如下:demohtml,body{width:10...

本文实例讲述了CSS实现body背景层高于块元素的方法,分享给大家供大家参考。具体实现方法如下:

<!DOCTYPE html>

<html lang="en">

<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('img/person1.png');

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>

希望本文所述对大家基于css的网页设计有所帮助。

【CSS实现body背景层高于块元素的方法】相关文章:

纯CSS实现漂亮tab选项卡切换特效

firefox和谷歌不显示body背景图片的解决方法

css实现body背景图片水平垂直居中方法

用CSS+JS实现Li背景颜色交替

CSS div居中的三种方法

CSS实现同一行的图片和文字垂直居中对齐的方法

CSS隐藏文字的方法

CSS实现左图右文混排布局的方法

CSS让ul所有的li居中显示的方法

纯CSS实现鼠标悬停提示的方法

精品推荐
分类导航