求助,如何让背景图片充满全图,随容器大小变动而变动

一户 2019-03-17 09:52:59
这是现在的代码 <body style="background-attachment: fixed" background="image/车间背景1.png " style=" background-position: center center; background-repeat: no-repeat; background-attachment: fixed; background-size: cover;">
...全文
2706 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yan大大 2020-09-08
  • 打赏
  • 举报
回复
<body style="background: url(img/背景图.png);background-size: 100% 100%;background-repeat: no-repeat;background-attachment: fixed;height: 100vh;width: 100vw;">
前端小学生hwb 2020-09-07
  • 打赏
  • 举报
回复
<body style="background-image: url('image/车间背景1.png'); background-position: center center; background-repeat: no-repeat; background-attachment: fixed; background-size: 100% 100%;"> 设置background-size为百分百,这样会占满整个盒子,盒子多大它多大
Van-bo 2019-03-18
  • 打赏
  • 举报
回复
width height设成100%,不要把css写在html里面🌝
天际的海浪 2019-03-17
  • 打赏
  • 举报
回复
<body style="background-image: url('image/车间背景1.png'); background-position: center center; background-repeat: no-repeat; background-attachment: fixed; background-size: cover;">

61,115

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧