【发布时间】:2012-12-10 16:54:53
【问题描述】:
我正在用 css 和 jquery 创建一个网站。我的脚本之一是通过鼠标单击在特定位置显示文本。文本在谷歌浏览器中的预期位置显示良好。但在 IE9 和 FF17 中,它们偏离了预期的位置。我的背景图片适合浏览器窗口的大小。
我附上屏幕截图,这将提供更好的想法。我也在写代码。也许只需要一个小的调整,但我不明白。请帮帮我。
这是chrome和IE的比较。正确的是铬,这是正确的。 FF和IE显示在同一位置。
谢谢
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
*Here will my script which is just simple .show and .hide functions*
});
</script>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Train of Thought</title>
<style type="text/css">
html, body {
width: 100%;
height: 100%;
margin-top: 0px;
padding-top: 0px;
top: 0px;
margin-left: 0px;
padding-left: 0px;
left: 0px;
}
body {
overflow: hidden;
}
#background {width: 100%; height: 100%; display: block; position: absolute; z-index:1;}
.content {
visibility:hidden;
border-style: none;
display: block;
position: fixed;
text-align: centre;
z-index: 1;
margin-top: 40%;
background-color: transparent;
font-size:1.5em;
opacity: 0.697;
}
#thought_text{
margin-left: 25%;
margin-right: 25%;
}
<div><img id="background" alt="background" src="tot1.png"></div>
<div class="content" id="thought_text">Here goes the text<br></div>
【问题讨论】:
-
您是否已将 reset.css 添加到您的样式表和供应商前缀中?这似乎是一个兼容性问题!
-
位置:相对缺失。添加相对位置..
标签: html css internet-explorer google-chrome