zoukankan      html  css  js  c++  java
  • CSS设置背景

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <style type="text/css">
    /*1.如何设置背景图片*/
    body{
    background-image: url(../images/background.png);
    background-repeat: repeat-y;
    background-position: center;
    }
    /*2.可以采用简化的方式一起设置背景色及背景图.语法如下
    background:背景色 背景图 平铺 位置
    以上四个可以酌情省略,但至少保留背景色或背景图中的一个*/
    .enemy{
    border: 1px solid red;
    50px;
    height: 50px;
    margin: 20px auto;
    background: url(../images/airplane.png) no-repeat center;


    }
    .hero{
    border: 1px solid red;
    125px;
    height: 125px;
    margin: 20px auto;
    background: url(../images/hero0.png) no-repeat center;
    }
    /*3.固定背景图*/
    body{
    background-attachment: fixed;
    }
    </style>
    </head>
    <body>
    <div class="enemy"></div>
    <div class="enemy"></div>
    <div class="enemy"></div>
    <div class="enemy"></div>
    <div class="enemy"></div>
    <div class="enemy"></div>
    <div class="enemy"></div>
    <div class="enemy"></div>
    <div class="enemy"></div>
    <div class="hero"></div>
    <div class="hero"></div>

    </body>
    </html>

  • 相关阅读:
    HDU 1333 基础数论 暴力
    HDU 1299 基础数论 分解
    HDU 1211 EXGCD
    HDU 3507 单调队列 斜率优化
    博弈
    std:ios::sync_with_stdio(false);
    NBUT[1220] SPY
    nbut1217 Dinner
    poj2236Wireless Network
    ZOJ Problem Set
  • 原文地址:https://www.cnblogs.com/Bighua123/p/7588150.html
Copyright © 2011-2022 走看看