Blogger Information
Blog 7
fans 0
comment 1
visits 11590
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
html 背景图片全局填充
Original
1955 people have browsed it

实例

首先先设置html,body的宽高为100%;如果不设置默认为空,将不显示

实例

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        html,body{
            width: 100%;
            height: 100%;
            background: url('图片地址') no-repeat center center / 100% 100%;
        }
    </style>
</head>
<body>

<script>
   
</script>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

background: url('图片地址') no-repeat center center / 100% 100%;  

background缩写解析 

    url('')  本地图片路径

    no-repeat  不填从

    center center   上下居中显示

    / 100% 100%;   拉满宽高



运行实例 »

点击 "运行实例" 按钮查看在线实例



Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post