CSS實現背景圖片置中

來源:互聯網
上載者:User
 <!doctype html> <html> <head> <meta charset="utf-8"> <title>標題</title> </head> <body style=" background:url(psb.jpg) top center no-repeat #000"> </body> </html> .bgcolor{background:url("images/image.jpg") no-repeat top #999;} top是給圖片定位的 當然你也可以改成left、right或者bottom 
背景圖片和背景顏色是可以共存的。{background:#000 url(img/img.jpg) center top no-repeat;}


w3cbackground-image:url("images/image.jpg") no-repeat center center;background-color:#000;這樣就行。第一是背景圖片 不重複平鋪  左右置中 上下置中 第二句背景色黑色

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.