表和背景img问题 [英] Table and background img problem
问题描述
我有一个问题,我的网站。我不能使表出现在img。它出现在图像下方或图像上方。我需要一些帮助的代码。实际上我不想img重新申请和适合用户窗口每次。插入img的代码是
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">
并且代码实际上帮助了我,但没有解决问题100%,因为表did not出现与img是
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%;' />
推荐答案
如果你想要一个背景图片适合大小浏览器(我猜,但如果你有100%的高度和宽度在你的图像,这似乎是你的),你可以做这样的:
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>
这篇关于表和背景img问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!