html中怎样让图片不平铺

html中怎样让图片不平铺,第1张

html中怎样让图片不平铺

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>

输出结果:

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

以上就是html中怎样让图片不平铺的详细内容,

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/698689.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-22
下一篇 2022-04-22

发表评论

登录后才能评论

评论列表(0条)

保存