如何将图像设置为网页背景

2025-10-21 09:22:14

1、backgoround-image代码。我们用这个代码向一个网页中的body进行赋值就行了。

<html>

<head>

<style type="text/css">

body {background-image:url(/i/4.gif);}

</style>

</head>

<body></body>

</html>

如何将图像设置为网页背景

2、在网页中的三个元素进行背景的图像指定。

<html>

<head>

<style type="text/css">

body {background-image:url(/i/4.gif);}

p.flower {background-image: url(/3.gif); padding: 20px;}

a.radio {background-image: url(/i/7.gif);  padding: 20px;}

</style>

</head>

<body>

<p class="flower">落。<a href="*" class="radio">景的链接。</a>

</body>

</html>

如何将图像设置为网页背景

3、background-repeat 代码的使用会让背景中的图像重复出现。

<style type="text/css">

body

background-image: 

url(/i/eg_bg_03.gif);

background-repeat: repeat

}

</style>

如何将图像设置为网页背景

4、我们重复背景图像的方法可以分为 水平重复或者垂直重复!

background-repeat: repeat-y

background-repeat: repeat-x

如何将图像设置为网页背景

5、还有一种情况就是图像在网页当中只使用一次。

background-repeat: no-repeat

如何将图像设置为网页背景

6、我们可以让图像在网页中的位置进行定位,这个位置是指定的。

background-position:center;

background-position:top;

如何将图像设置为网页背景

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢