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>

  • 相关阅读:
    一些术语
    Professional Frontend Engineering
    爱上阿森纳,爱上一种信仰
    ThinkPHP 和 UCenter接口的冲突
    这个城市
    来自Google的10条价值观
    如何将Gb2312转为unicode?
    未完成的代码(JS)
    微软也用PHP?!
    博客园对"公告"的Js进行了过滤
  • 原文地址:https://www.cnblogs.com/Bighua123/p/7588150.html
Copyright © 2011-2022 走看看