編碼的世界 / 優質文選 / 生涯

背景圖片拉伸效果(css3支持)


2022年3月24日
-   

<!DOCTYPE HTML>
<html>
<head>
<title>背景圖片拉伸效果(css3支持)</title>
<style type="text/css">
body{
padding:0;
margin:0;
overflow-x: hidden;
background:url(ss.jpg) center no-repeat;
background-size:cover;
}
</style>
<script type="text/javascript" src="jquery-1.8.2.min.js"></script>
<script type="text/javascript">
$(function(){
function resizeBody(){
$("body").height($(window).height() - 2).width($(window).width() - 2);
}
resizeBody();

$(window).resize(function(){
resizeBody();
});
});
</script>
</head>
<body>
</body>
</html>

熱門文章