html - Css 模板在所有浏览器中都不相同(覆盖 div)

标签 html css

基本上我有 2 列,左侧有一个叠加的灰色图像以创建一种模糊效果。当您将鼠标悬停在它上面时,它会变成透明的。它在 Chrome/Safari 中运行良好,但在 Firefox 中运行良好,我真的不明白为什么。

我上传了一个链接到我的网站以表明我的意思:

http://generowicz.nl/showing_template.html

在 Firefox 中查看时,覆盖图像不适合并覆盖整个左侧。

html, body {
    height: 100%;
    margin: 0;
    font-size: 15px;
	font-family: Helvetica;
	font-weight: lighter;
}
#left{
	text-indent:1cm;
    width: 20%;
    height: 100%;
    position: fixed;
	background: rgba(51,51,51,1);
}

#right {
	padding-top:2cm;
    width: 80%;
    height: auto;
    position: absolute;
    right: 0;
    background: white;
}

#img {
	position: absolute;
	opacity: 0.4;
	width:100%;
	height:100%;
	pointer-events:none;
	-webkit-transition: opacity .25s ease-out;
	-moz-transition: opacity .25s ease-out;
	-o-transition: opacity .25s ease-out;
	transition: opacity .25s ease-out;
	color:#000;
}

#left:hover>#img {
  opacity: 0;
}

h1{
	font-size: 80px;
	color:#CCC;
}

h2 {
	font-size: 15px;
	color: #CCC;
	font-weight: lighter;
}

h3 {
	font-size: 15px;
	color:#CCC;
}

/* These are for main body */
h4 {
	font-size: 15px;
	color:#000;
}

h5 {
	font-size: 15px;
	color:#000;
	font-weight: lighter;
}
	


a.one:link {
	text-decoration: none;
	color: #CCC;
  -webkit-transition: all 0.5s ease-out;   Saf3.2+, Chrome 
     -moz-transition: all 0.5s ease-out;   FF4+ 
      -ms-transition: all 0.5s ease-out;   IE10 
       -o-transition: all 0.5s ease-out;   Opera 10.5+ 
          transition: all 0.5s ease-out;
}  

a.one:link:hover {
	text-decoration: none;
	color: #09F;
}

a.one:visited {
		text-decoration: none;
	color: #CCC;
  -webkit-transition: all 0.5s ease-out;   Saf3.2+, Chrome 
     -moz-transition: all 0.5s ease-out;   FF4+ 
      -ms-transition: all 0.5s ease-out;   IE10 
       -o-transition: all 0.5s ease-out;   Opera 10.5+ 
          transition: all 0.5s ease-out;
		  }
		  
a.one:visited:hover {
	text-decoration: none;
	color: #09F;
}
a.one:active {	text-decoration: none;
	color: #CCC;
  -webkit-transition: all 0.5s ease-out;   Saf3.2+, Chrome 
     -moz-transition: all 0.5s ease-out;   FF4+ 
      -ms-transition: all 0.5s ease-out;   IE10 
       -o-transition: all 0.5s ease-out;   Opera 10.5+ 
          transition: all 0.5s ease-out;
}
<body>
<div id="left"><img src="images/graysmall.png" name="img" width="93" height="55" id="img" />
  <h1> B </h1>
  <h2><a class="one" href="../index.html">Home</a></h2>
  <h2><a class="one" href="../about.html">About Me</a></h2>
  <h2><a class="one" href="../contact.html">Contact</a></h2>
</div>

<div id="right">


<table width="100%" border="0" align="left">
  <tr>
    <td width="5%">&nbsp;</td>
    <td width="95%" align="left" valign="top">
<!-- TemplateBeginEditable name="Content" -->
   
    
<!-- TemplateEndEditable -->
    </td>
  </tr>
</table>
</div>

</body>

最佳答案

在您的 #img 类中添加 left:0 将提供您需要的结果。请参阅下面更新的类(class),

#img {
position: absolute;
opacity: 0.4;
width: 100%;
height: 100%;
pointer-events: none;
-webkit-transition: opacity .25s ease-out;
-moz-transition: opacity .25s ease-out;
-o-transition: opacity .25s ease-out;
transition: opacity .25s ease-out;
color: #000;
left: 0;
}

关于html - Css 模板在所有浏览器中都不相同(覆盖 div),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39167287/

相关文章:

javascript - 调整窗口大小时重新验证 DIV 的尺寸

css - 屏幕宽度为 100% 的 Div,但位于固定宽度的父 div 内

css - 负上边距+溢出:hidden on Boostrap carousel

html - 在父 fiv 中居中多个 div 并缩放它们

php - 我可以提取部分 php 包含吗?

android - HTML5 地理定位在 Android 模拟器中不起作用

html - Position 固定元素导致整个页面重绘/重绘

javascript - 如何在 IE8 中使用 XPath 访问 HTML 元素?

javascript - 在 DOM 元素上触发点击事件

javascript - Ionic V1.3 - 选项卡 - 带条件的徽章样式 <ion-tab>