css如何让背景图⽚平铺?css背景图⽚平铺四种⽅式介绍在⽹页设计的过程中,有时候可能会要求背景图⽚平铺,因为这样会让整个⽹页看起来⽐较好看,图⽚平铺可以不⽤具体设置body宽度和⾼度⼤⼩,就可以直接将图⽚平铺整个页⾯,那么,如何让背景图⽚平铺呢?接下来本篇⽂章将给⼤家来介绍关于css让背景图⽚平铺的⽅法,有需要的朋友可以参考⼀下。
我们⾸先来看⼀下css设置背景图⽚平铺⽅式。
repeat:即默认⽅式,完全平铺背景;
no-repeat:在X及Y轴⽅向均不平铺;
repeat-x:横向平铺背景;
repeat-y:纵向平铺背景。
下⾯我们就来看⼀下css的这四种背景图⽚平铺的实现代码。
css背景图⽚平铺之完全平铺背景的代码:
<html>
<head>
<style type="text/css">
#content {
border:1px solid #000fff;
height:500px;
background-image:url(img12.3lian/gaoqing02/01/58/85.jpg);
background-repeat: no-repeat;
}
</style>
<div id="content">
</div>
</body>
</html>
css背景图⽚平铺效果如下:
css背景图⽚平铺之在X及Y轴⽅向均不平铺:
<html>
<head>
<style type="text/css">
#content {
border:1px solid #000fff;
height:500px;
好看的css代码background-image:url(images/tu.jpg);
background-repeat: no-repeat;
}
</style>
<div id="content">
</div>
</body>
</html>
css背景在X及Y轴⽅向均不平铺效果如下:
css背景图⽚平铺之横向平铺背景:
背景图⽚现在只在X轴即横向进⾏了平铺操作,纵向并没有进⾏平铺
<html>
<head>
<style type="text/css">
#content {
border:1px solid #000fff;
height:500px;
background-image:url(images/tu.jpg);
background-repeat: repeat-x;
}
</style>
<div id="content">
</div>
</body>
</html>
css横向平铺背景效果如下:
css背景图⽚平铺之纵向平铺背景:
背景图⽚现在只在Y轴即横向进⾏了平铺操作,横向并没有进⾏平铺
<html>
<head>
<style type="text/css">
#content {
border:1px solid #000fff;
height:500px;
background-image:url(images/tu.jpg);
background-repeat: repeat-y;
}
</style>
<div id="content">
</div>
</body>
</html>
css纵向平铺背景效果如下:
以上就是本篇⽂章的全部内容了,更多精彩内容可以关注我
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论