2014-02-06 52 views
0

Firefox和Chrome似乎以不同的字体大小显示。CSS(font-size?) - Chrome浏览器与Firefox的缩小版

HTML:

<div id="gallery-section" class="section"> 
    <div id="gallery-section-inner" class="inner"> 
     <div class='gallery-post'> 
      <div class="thumbnail"></div> 
      <div class='gallery-excerpt'><p>This is some random text witch shows in photo description. text witch shows in photo description.</p> </div> 
     </div> 
    </div> 
</div> 

CSS:

.gallery-post { 
    width:170px; 
    background-color:white; 
    float:left; 
    font-family:'Open Sans'; 
    margin-left:1.5em; 
    border:1px solid #e0e0e0; 
} 

.gallery-excerpt { 
    text-align:left; 
    float:left; 
    background-color:#EDEDED; 
    width:150px; 
    min-height:100px; 
    border:1px solid #e0e0e0; 
    font-size:12px; 
    border-top:none; 
    color:#535353; 
    -moz-box-sizing: border-box; 
    -webkit-box-sizing:border-box; 
    box-sizing: border-box; 
    margin-left:10px ; 
    margin-bottom:10px; 
    padding:1em 1em 0em 1em; 
} 

.thumbnail { 
    width:150px; 
    height:170px; 
    border:1px solid #e0e0e0; 
    margin-left: auto ; 
    margin-right: auto ; 
    margin-top:10px; 
} 

可视化:

enter image description here

代码:jsfiddle

+2

请将您的代码放在一个JSFiddle http://jsfiddle.net/64H63/以及问题中。如果不查看代码,这几乎是不可能解决的。 – Anonymous

+0

http://jsfiddle.net/rokas/U6Khy/ – user3272725

+1

在这两个浏览器上(_the ** chrome ** version_),看起来和我完全一样。尝试在两个浏览器上检查开发人员工具。 – Anonymous

回答

1

它与你的代码无关。您在Chrome浏览器的最大缩小范围内看到的只是最小的铬字体大小。您可以用explained here的方式进行设置。但是,你不能低于你可以看到的情况下的某个价值。你无法做任何事情。 它被认为是一个铬错误:http://code.google.com/p/chromium/issues/detail?id=7417似乎有一些解决方法,但它不会修复默认的铬行为(你必须调整你浏览页面的每个铬浏览器)。 为什么你甚至不在乎呢?

1
<script> 

    if(navigator.userAgent.indexOf("Chrome") != -1) 
    { 
     var fontsize = "<style>body{font-size: 125%;}</style>"; 
    } 
    else if(navigator.userAgent.indexOf("Opera") != -1) 
    { 
     var fontsize = "<style>body{font-size: 100%;}</style>"; 
    } 
    else if(navigator.userAgent.indexOf("Firefox") != -1) 
    { 
     var fontsize = "<style>body{font-size: 100%;}</style>"; 
    } 
    else if((navigator.userAgent.indexOf("MSIE") != -1) || (!!document.documentMode == true)) //IF IE > 10 
    { 
     var fontsize = "<style>body {font-size: 100%;}</style>"; 
    } 
    else 
    { 
     var fontsize = "<style>body {font-size: 100%;}</style>"; 
    } 
    </script> 

<script>document.writeln(fontsize);</script> 
相关问题