html5怎么设置整页背景图片

html5怎么设置整页背景图片,第1张

html5中设置整页背景图片的方法是利用css3样式

写法如下:

img.bg {

 /* Set rules to fill background */

 min-height: 100%

 min-width: 1024px

 /* Set up proportionate scaling */

 width: 100%

 height: auto

 /* Set up positioning */

 position: fixed

 top: 0

 left: 0

}

@media screen and (max-width: 1024px) { /* Specific to this particular image */

 img.bg {

   left: 50%

   margin-left: -512px  /* 50% */

 }

}

效果如:

HTML5前端的选择器一般有js选择器和css选择器

其中css选择器上面的网友回答的很全面了使用p>img就可以了。

js选择器一般使用jquery选择器,而jquery选择器可以通过id或者class样式或者元素类型进行选择,子选择器可以用find或者children查找。


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

原文地址: https://outofmemory.cn/tougao/11040756.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-13
下一篇 2023-05-13

发表评论

登录后才能评论

评论列表(0条)

保存