1. HTML+DIV+CSS Zero Basic Quick Start to Making Enterprise Station Video Course _15 CSS Background Properties

 

Background properties:

background-color background-color

background-image background image

 

Background repeats:

background-repeat: repeat/no-repeat/repeat-x/repeat-y

 

background-position:background-position:

position: x y:

 Pixels: 100px 100px

 Percentage: 10% 20%: (container width - image width)*10%

 left center right, top center bottom;

 -100px,0px

 

background-attachment: the background scrolls or is fixed with the content

background-attachment:fixed;

background-attachment:scroll;

 

Compound spelling:

background: url("./img/2.jpg") center top no-repeat scroll;

 

 

.html

 

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>背景2</title>
 6     <link rel="stylesheet" href="./bg2.css">
 7 </head>
 8 <body style="height: 2000px;">
 9     <p>0</p>
10     <p>1</p>
11 </body>
12 </html>

 

.css

 

body {
background: #fff url("http://real2.s-angels.com/images/sample/m254_misa/thumb/model_top.jpg") center top no-repeat fixed;
}

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325380697&siteId=291194637