CSS實現(xiàn)body背景層高于塊元素的方法
來源:易賢網 閱讀:1408 次 日期:2015-02-11 15:06:30
溫馨提示:易賢網小編為您整理了“CSS實現(xiàn)body背景層高于塊元素的方法”,方便廣大網友查閱!

本文實例講述了CSS實現(xiàn)body背景層高于塊元素的方法,分享給大家供大家參考。具體實現(xiàn)方法如下:

復制代碼代碼如下:<!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 class="box"></div>

</body>

</html>

希望本文所述對大家基于css的網頁設計有所幫助。

更多信息請查看IT技術專欄

更多信息請查看網頁制作
關于我們 | 聯(lián)系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點

版權所有:易賢網