css實現body背景圖片水平垂直置中方法

來源:互聯網
上載者:User
提示:您可以先修改部分代碼再運行

<style type="text/css">*{margin:0; padding:0;}html,body{ width:100%; height:100%;}body{ background:#fff url(/eg/eg_2014_01_02_14_50.jpg) center no-repeat;}</style><div class="wrap"><h2>讓body標籤中的背景圖片水平垂直置中</h2> <div class="eg"> <h3>讓<body/>標籤的背景圖片水平垂直置中</h3> <p>註:設定html,body{ width:100%; height:100%;}</p> </div></div></td> </tr></table>
提示:您可以先修改部分代碼再運行
相關文章

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.