background-size:cover及css3绝对定位水平居中

background-size:cover及css3绝对定位水平居中

<!DOCTYPE html>
<html lang=”zh-CN”>
<head>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<title></title>
<link href=”http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css” rel=”stylesheet”>
<style>
html,body {height:100%;width:100%}
body{min-height:400px;background: url(assets/images/bg.jpg) top center no-repeat;background-size:cover;}
.social{text-align:center;position:absolute;left:50%;transform: translate(-50%, 00%);bottom:20%;}
.social a {margin: 5px 30px;}
</style>
</head>
<body class=”home-template custom-bg”>
<div class=”container”>
<div class=”social”>
<span class=”col-xs-12 col-sm-4″><a href=”#” class=”btn btn-outline btn-lg”>广告工程</a></span>
<span class=”col-xs-12 col-sm-4″><a href=”#” class=”btn btn-outline btn-lg”>商务庆典</a></span>
<span class=”col-xs-12 col-sm-4″><a href=”#” class=”btn btn-outline btn-lg”>广告礼品</a></span>
</div>
</div>

</body>
</html>

« »