”。本教程操作环境:windows10系统、">
您的位置:首页 > 技术中心 > 前端框架 >

html中怎样让图片不平铺

时间:2022-02-11 17:22

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

本教程操作环境: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>

输出结果:

06.png

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

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

本类排行

今日推荐

热门手游