body{ background:url("?../img/by.jpg") no-repeat; background-size:cover;
}这段代码可以在所有浏览器中工作吗?或者我可以不带问号?
emeijp431#
试试这个,它会在所有的浏览器上工作。
body{ /* background: color-name url("image-source") repeat-property attachment-property position-property; Shorthand Example :- */ background: #D0E4F5 url("https://picsum.photos/200") no-repeat scroll 0px 0px; /* Long Example :- #demo { background-color: #D0E4F5; background-image: url("/images/smiley.png"); background-repeat: no-repeat; background-attachment: scroll; background-position: 0px 0px; } */ }
<html> <head></head> <body> Some Example Text </body> </html>
disbfnqx2#
使用这个来背景图像的一个元素,这也将工作在所有浏览器
element { background-image: url('your_Source'); background-repeat: no-repeat; background-attachment: fixed; background-size: cover; }
2条答案
按热度按时间emeijp431#
试试这个,它会在所有的浏览器上工作。
disbfnqx2#
使用这个来背景图像的一个元素,这也将工作在所有浏览器