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

 时间:2026-02-14 07:59:44

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;

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

  • 如何在div中让图片居中
  • HTML怎么实现网页跳转
  • HBuilder怎么在HTML里面插入图片?
  • 利用css实现图片往两边展开的动画效果
  • hbuilderx怎么加入图片
  • 热门搜索
    钓海鱼用什么鱼饵 台湾蓝绿什么意思 破绽是什么意思 耿直是什么意思 象拔蚌什么梗 搁浅的意思 同等学历是什么意思 绿色通道是什么意思 有什么好看的小说玄幻 服役是什么意思