前几天在写我的流星影院APP下载页的时候,是想着背景写成图片吧,后面想了一下改成了视频背景(视频是我姐妹的快手偷来的?)
背景

然后在这里教一下大家html中用css添加背景颜色和添加背景图图吧!

{lamp/}

{x} 背景设置颜色:

  <style>
body {
    background-color: #F0F8FF
}
</style>

{lamp/}

{x} 背景设置图片

    <style type="text/css">
      body{
        background: url("./photoes/background.jpg") no-repeat center center fixed;
                    /*兼容浏览器版本*/
                    -webkit-background-size: cover;
                    -o-background-size: cover;                
                    background-size: cover;
      } /*背景图*/
 
      .test {
        margin-top: 100px;
      }
    </style>

注意:CSS 有三种方式添加到HTML中:

1、内联样式- 在HTML元素中使用"style" 属性

2、内部样式表 -在HTML文档头部 <head> 区域使用<style> 元素 来包含CSS

3、外部引用 - 使用外部 CSS 文件

在设置背景图这里我用的是加到里面
1