我为背景图像编写了 CSS 代码,但在我的 CSS 表中设置后它没有显示。
我试过了,它只在写在正文中时有效......
<body background="Tokyo.png">
但不在样式表中。
html {
background-color: black;
margin: 10px;
}
body {
background: "Images\tokyo.png";
} //CSS code in style sheet//
我希望显示背景图片,但我没有。
最佳答案
您需要将路径包裹在url
中。
background-image: url("Images\tokyo.png");
关于css - 如何设置背景图片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55616946/