tags:

views:

51

answers:

3

I have a problem with my site.I cant make the table appears on the img. It appears down of the image or up of the image. I need some help with the codes. Actually i dont want the img to reapet and to fit in users window everytime. The code to insert the img is this

<body oncontextmenu="return false;" background="bg_body.jpg">

And the code that a actually helped me but didnt solved the problem 100% because table didnt appears with img is this

<style> <!-- body { margin: 0px; } --> </style>
<img src='whatever' style='width: 100%; height: 100%;' />
A: 

Consider using CSS background properties.

HTML (something like this, un-tested):

<body ... style="background-image:url('bg_body.jpg'); background-repeat: no-repeat;">

If you want your background image to "resize" to the browser, you will have to hack it to work. One common way is probably to use two div tags; the first one will contain the image at 100% size, with absolute positioning. The second one contains your actual body content, with a higher z-value. It is a lot more work than you might think.

For detailed discussion on this, see this thread: http://www.htmlcodetutorial.com/help/ftopic4503.html

Xavier Ho
broken link :S i cant proceed
It works for me. Hmm.
Xavier Ho
A: 

There is a couple things here that don't make too much sense:

"oncontextmenu="return false;" are you trying to run some sort of javascript? If so, you need to call a function before the "return false", like so:

<body onload="someFunction() return false;">

Also, I don't think you can set a background for an element the way you did it, it would be more like this:

<table style="background:path/to/my/image/...">

I'd love to help some more, but please explain yourself a little better.

ok, I'd suggest you do something like this:

Whether it is on an external style sheet, or embedded inside the head tags, you can set the image size with some simple CSS, like so:

<style type="text/css">
body{
background-image:url(../path/to/image);
background-repeat:no-repeat;
height:100%;
width:100%;
}
</style>

Try this to see if it works, I'll help you more if it doesn't.

jnkrois
Take a look at my existing site lineage2explosive.tk. I want to make this img appears once and not reapeared(fit to window depends users resolution). And the buttons i have +text are made with table. But when i put the codes i post in my question seperates the table from the image and appears the buttons and the text down of it.
I added some changes to my first response, please read up.
jnkrois
the return false; statement is correct...it just cancels the context menu, so it's not meant to run any further functions
davidsleeps
this works with table and image and image dont reapeted but it doesnt works with fit on browser. Understand what i mean?
+1  A: 

if you want a background image to fit the size of the browser (which i'm guessing at, but if you have a 100% height and width on your image, that seems what you're after), you could do something like this:

<style type="text/css">
*{margin:0;padding:0;}
html,body{height:100%;}
.backgroundlayer { position:absolute;top:0;left:0;z-index:1; }
.toplayer { position:absolute;top:0;left:0;z-index:2; }
</style>

and then in the body of your code...

<body>
    <img src="someimage.png" style="height:100%;width:100%;" class="backgroundlayer" />
    <div class="toplayer">
        my content above the image...it doesn't have to be a div...use a table if you want
    </div>
</body>
davidsleeps
Well i am so newbie. I insert the codes you give me and works perfect.But now vote enter button and text dont appears.It seems like they are behind the img. Probably i didnt insert the codes in the right place.Please take a look at the code i have at this page. I bet you know how to do it. View-->source code www.lineage2explosive.tk
I presume it is the vote.html page? for me anyway, it still looks like it did when you first posted the web site address...
davidsleeps
My false you check the source code from here http://l2explosive.ucoz.org/vote.html
I just grabeed your source code, modified it a bit and uploaded it...you've got 1 day to access this file: http://senduit.com/cc6533
davidsleeps
put it in the same place as your vote.html but call it something else to test it out...
davidsleeps
Thanks a lot davidsleeps i dont how to thank you. Problem solved.
Finally i am trying to put the text and the other at the center but i cant. I am inserting align middle at the table but nothing happens
uploaded another file: http://senduit.com/99e988
davidsleeps
you needed to make the table centered, not the content of the table basically...
davidsleeps