简体   繁体   English

Java Play:无法在HTML / CSS中设置背景图片

[英]Java Play: Can't set background image in HTML/CSS

Im currently an intern at a company here in Sweden, and they are using Java Play for their projects. 我目前在瑞典一家公司的实习生,他们正在使用Java Play进行项目。 So i have been given the task to create a website (my programming skills is not developed enough to do some work for them. This website is just practice). 因此,我被赋予创建一个网站的任务(我的编程技能尚不足以为他们做一些工作。这个网站只是练习)。 I have programmed a page with a combination of HTML , CSS JavaScript , Java and Jquery , but i can not figure out how i should set my background. 我已经用HTMLCSS JavaScriptJavaJquery组合编程了一个页面,但是我不知道该如何设置背景。 The people at my internship can do it in their own code, but they can't make it work for me. 我实习的人员可以用自己的代码来完成此操作,但不能使它对我有用。

This is my code in CSS : 这是我在CSS代码:

body {
    height: 100%;
    margin: 0 0 0px;
    padding-top: 80px;
    background-image:url("..\pictures\road.jpg")
}

And in HTML : HTML

<body background = "..\..\public\pictures\road.jpg">
(a bunch of other stuff)
</body>

When i open the code in just HTML , the image is shown, but when i open it with Java Play (which is required for my work) there is no picture. 当我只用HTML打开代码时,将显示图像,但是当我使用Java Play打开它(这是我的工作所必需的)时,没有图片。

Fixed it: 修复:

<body style = 'background: url("/assets/pictures/road.jpg")'>

in HTML 在HTML中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM