html怎么让图片不平铺(html怎样让图片平铺在当前页面上)

lxf2023-03-19 12:24:01

在html中,可以利用style属性和“background-repeat”属性设置图片不平铺,语法为“<element style="background-repeat:no-repeat;">”。

html怎么让图片不平铺(html怎样让图片平铺在当前页面上)

本教程操作环境:windows10系统、HTML5版、Dell G3电脑。

html中怎样让图片不平铺

在html中想要让图片不平铺,需要利用到style属性和background-repeat属性。

style属性用于设置元素的样式,background-repeat属性用于定义图片的平铺模式,当设置background-repeat:no-repeat样式时,图片就会不平铺。

示例如下:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body style="background:url(1118.02.png); background-repeat:no-repeat;">
</body>
</html>

输出结果:

html怎么让图片不平铺(html怎样让图片平铺在当前页面上)

推荐教程:《html视频教程》

以上就是html中怎样让图片不平铺的详细内容,更多请关注AdminJS其它相关文章!