css background image

91 views
Skip to first unread message

Dima Redko

unread,
Apr 5, 2014, 1:17:05 PM4/5/14
to google-we...@googlegroups.com
Hello everyone) I've recently faced a problem. I don't know how to set the background of the page using css (not in java code) while using GWT framework.
What I did:
1) I've created a folder named img in the war folder of my gwt project
2) Then I've coppied there a    .jpg image called "wood.jpg".
3) Then in my css file I've got the following written:

body{
 background
-image: url(/img/wood.jpg) repeat;
}
4) Surely I've added a link to that css file in my HTML Welcome page

When I run this project the background is white. My java code has nothing that affects the backround.
So, would you please help me to handle this problem?
Thanks in advance)))

Jos Flores

unread,
Apr 5, 2014, 3:29:02 PM4/5/14
to google-we...@googlegroups.com
You can try using quotes around the name of the image, and using a relative path. something like:
background-image: url("img/wood.jpg");

note that there is no / before img (a relative instead of an absolute path to the image). Would that work?

Dima Redko

unread,
Apr 6, 2014, 4:00:23 AM4/6/14
to google-we...@googlegroups.com
No, it doesn't work. But still thaks for your reply). Maybe you have any other suggestions?

суббота, 5 апреля 2014 г., 23:29:02 UTC+4 пользователь Jos Flores написал:

Jens

unread,
Apr 6, 2014, 9:43:20 AM4/6/14
to google-we...@googlegroups.com
Check your browsers dev tools to see if the image / css file gets loaded by the browser or if an HTTP 404 NOT FOUND occurs (see network tab in dev tools). If it is a 404 you should see what the browser tries to load and this should already be enough information to fix the problem.

-- J.

Jos Flores

unread,
Apr 6, 2014, 2:01:42 PM4/6/14
to google-we...@googlegroups.com

Agree with Jens. You can also check the style in dev tools. If it's not being found, it's a problem with the path to the image.

-------------------------------------------
phone.brevity.typos.cheers

On 6 Apr 2014 09:43, "Jens" <jens.ne...@gmail.com> wrote:
Check your browsers dev tools to see if the image / css file gets loaded by the browser or if an HTTP 404 NOT FOUND occurs (see network tab in dev tools). If it is a 404 you should see what the browser tries to load and this should already be enough information to fix the problem.

-- J.

--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/snOppc2tWnA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Dima Redko

unread,
Apr 6, 2014, 2:38:00 PM4/6/14
to google-we...@googlegroups.com

Thanks for your reply).
Finally I've found the way to add background/ And now it works as I wanted, but I don't actually understand WHY?
I had this:

body{
 background
-image: url(/img/wood.jpg) repeat;
}

Then I changed that part to make it look like this:
.body{
 background
-image: url(/img/wood.jpg) repeat;
}

Simply added the point before. Previously it was a rule for body element and now it's a rule for body class. And it works.
Can someone, please, explain mw that. Thanks)))


Patrick Tucker

unread,
Apr 6, 2014, 9:09:31 PM4/6/14
to google-we...@googlegroups.com
Can you show us your HTML and any other relavent CSS?

All we can do is assume you have an element that has a class name of body. Have you tried setting the height and width of the body element, and maybe window, to 100%?

Reply all
Reply to author
Forward
0 new messages