html - 相同的 css 代码但输出不同

标签 html css

我这里有一个文件。

我的 html 看起来像这样:

<div id="banner">
<div id="bannerTextBlue"> <h1> lorem ipsum </h1> </div> 
<div id="bannerTextYellow"> <h1> dolor sit amet. </h1> </div>
</div>

我的 CSS 是这样的:

#banner{
  background: #FFF;
  width: 1140px;
  margin:30px auto 0;
  border: 12px solid #323232;
  height: 448px;
  position:relative;
}

#bannerTextBlue{
  height: 90px;
  background: #027cd6;
  width: 600px;
  right: 0px;
  position: absolute;
  padding-left: 90px;
}

#bannerTextBlue h1{
  color: #FFFFFF;
  font-size: 88px;
  line-height: 50px;
  padding-right: 30px;
  text-transform: uppercase;
}

#bannerTextYellow{
  height: 60px;
  background: #f4b437;
  width: 500px;
  right: 0px;
  top: 100px;
  position: absolute;
  padding-left: 10px;
}

#bannerTextYellow h1{
  color: #FFFFFF;
  font-size: 50px;
  line-height: 35px;
  padding-right: 30px;
  text-transform: uppercase;
}

但输出不同。它应该在 Chrome 中看起来不错,但在 Firefox 中它被破坏了。不确定这里的故障在哪里。请帮忙?我的 css 结构有问题吗?

最佳答案

您确定要使 font-size 大于 line-height 吗?

这使得第二行(在蓝色框中)与第一行重叠......(如果这就是你所说的destroyed)

(但它在所有浏览器中都是一样的..)

关于html - 相同的 css 代码但输出不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10312304/

相关文章:

html - Bootstrap 创建文本区域和两个内联按钮

javascript - 如何在jquery中使用相同的类将子div同等地附加到父div?

javascript - 通过javascript更改div中属性的事件监听器

html - 我需要弄清楚为什么这个元素在 Chrome 和 Internet Explorer 中的对齐方式不同

循环中的 Jquery 动画函数不一起运行

html - 是否可以使用 CSS 在图像 map 上设置鼠标悬停样式?

css - 调整浏览器窗口大小时标题分开

没有固定宽度的CSS水平子菜单

html - 将 div 与百分比宽度和以像素为单位的边距相结合

php - 某些幻灯片在 Firefox 中不起作用 - Wordpress Revolution Slider