html background属性让背景充满整个页面

作者:白雪 | 创建时间: 2023-07-03
有时候,我们想让整个网页面充满我们的背景,可以使用html的background属性完成这个任务。...
html background属性让背景充满整个页面

操作方法

打开Dreamweaver,然后选中html,出来了一个html标准文档。

在<body>标签里添加文件路径,语法如下 <body background="文件路径"> 这时,页面虽然充满了背景,但可以看出背景图片被填充了多次。

在<body>里添加样式,代码如下: style=" background-repeat:no-repeat ; background-size:100% 100%; background-attachment: fixed;" 你看,背景就充满页面了。

整个实现代码如下: <body background="5.jpg" style=" background-repeat:no-repeat ; background-size:100% 100%; background-attachment:fixed;" >

我尝试通过外联式样式和嵌入式样式实现这个功能,但没有成功。

点击展开全文

更多推荐