简体   繁体   English

浏览器之间div中文本的垂直对齐方式的差异

[英]Difference in vertical alignment of text in a div between browsers

I have a div in my html as follows: 我的html中有一个div,如下所示:

<div class="questInfo">
   <div class="questBounty">100</div>
</div>

And CSS: 和CSS:

.questInfo {
  background-color: #fcfcfb;
  padding: 10px;
  -webkit-border-radius: 10px;
  border-radius: 10px;
  position: relative;
}

.questBounty {
  position: absolute;
  right: 10px;
  font-family: 'Helvetica';
  font-weight: bold;
  background-color: #ffedcc;
  font-size: 40px;
  padding: 15px;
  -webkit-border-radius: 15px;
  border-radius: 15px;
  border: 1px solid #808080;
}

When I view this in Safari, I get the following, as I intended: 当我在Safari中查看此内容时,将得到以下预期的结果:

苹果浏览器

But in Firefox, the text appears to be pushed up: 但是在Firefox中,文本似乎被推上了:

火狐

Is there some attribute I should have set to achieve the former? 我应该设置一些属性来实现前者吗?

A fiddle. 小提琴。

Thanks. 谢谢。

I don't really think this can solve but try adding the -moz- in ur CSS That's support for Firefox 我真的不认为这可以解决,但是请尝试在CSS中添加-moz-这是对Firefox的支持

-moz-border-radius -moz-border-radius

-WebKit - has given support for safari so I think this should give for Firefox -WebKit-已提供对safari的支持,所以我认为这应该适用于Firefox

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM