本文目录
- html background属性
- HTML中background的图片地址是相对地址吗
- html语言中background的图片在哪里调用
- html中background如何设置格式是什么
- HTML 中用background添加的图片怎么才能平铺在网页上
- HTML语言中,设置背景颜色的代码是
html background属性
background 属性在一个声明中设置所有的背景属性。
语法:
Object.style.background=background-color background-image
background-repeat background-attachment background-position
参数
描述
值
background-color 设置元素的背景色。
color-name
color-rgb
color-hex
transparent
background-image 设置背景图像。
url(URL)
none
background-repeat 设置背景图像是否及如何重复。
repeat
repeat-x
repeat-y
no-repeat
background-attachment 背景图像是否固定或者随着页面的其余部分滚动。
scroll
fixed
background-position 设置背景图像的起始位置。
top left
top center
top right
center left
center center
center right
bottom left
bottom center
bottom right
x% y%
xpos ypos
HTML中background的图片地址是相对地址吗
html中background的图片地址是相对的。
比如
这个背景图片就是和该
html文件
所在的路径一直。
为了避免混乱可以使用
绝对路径
,写
bachground:url(/1.jpg).
html语言中background的图片在哪里调用
把图片放在和html文档同一个文件夹即可
如改为《body background=“../1.jpg“》 则把图片放在html文档所在文件夹的上一级。
如改为《body background=“a/1.jpg“》 则把图片放在html文档所在文件夹里的a文件夹里。
如改为《body background=“../a/1.jpg“》 则把图片放在html文档所在文件夹的上一级中的a文件夹里
注:../表示上一级目录,
html中background如何设置格式是什么
只图片的话可以用background-image属性
background有以下几种属性
background-color
background-position
background-size
background-repeat
background-origin
background-clip
background-attachment
background-image
background-image: url(bgimage.gif);
HTML 中用background添加的图片怎么才能平铺在网页上
我想你的意思是把背景图
拉伸铺满整个网页吧?我只能说
background(背景图)是不能拉伸的,你可以找几张合适的图
拼在一起(效果好得多),也可以选着纯色的图片
纵、横平铺
也就是重复(横向平铺:background-repeat:
repeat-x;
纵向平铺:background-repeat:
repeat-y;
)
HTML语言中,设置背景颜色的代码是
html中设置元素的背景色都是通过CSS中的background 属性来完成。
例如,给整个页面(body)设置背景色:body{background: #ddd;};如果要将图片作为背景色:body{background-image: url(1.jpg);},其中url括号后面的是背景图片的链接。
拓展资料:
background 简写属性在一个声明中设置所有的背景属性。
background可以设置如下属性:
background-color 背景颜色
background-position 背景图像的位置
background-size 背景图片的尺寸
background-repeat 重复背景图像
background-origin 背景图片的定位区域
background-clip 背景的绘制区域
background-attachment 背景图像是否固定或者随着页面的其余部分滚动
background-image 背景图像
如果不设置其中的某个值,也不会出问题,通常建议使用这个属性,而不是分别使用单个属性,因为这个属性在较老的浏览器中能够得到更好的支持,而且需要键入的字母也更少。
代码:
效果: