开发者

<h1> and <h2> are not displayed as expected in Opera browser

I am using the css above to style my h1 and it works good on most browsers except opera that changes the positioning a lot:

h1{
    position:fixed;
    left:5px;
    top:5px;
    color:#111;     
    font-family:'Josefin Sans', Arial, serif;
    font-size:3.3em;
    margin:0px;  
    margin-top: 2px;
    margin-bottom: 2px;
    padding: 0px;;

}

I tried replacing h1's with h2's and everything works nice on all browsers again even positioning in opera seems to be开发者_开发百科 good, but now the font-size is not good and the font used is probably browsers default...Is there something I should know about heading in opera that I don't?please advice...! all other browsers:

<h1> and <h2> are not displayed as expected in Opera browser

opera:

<h1> and <h2> are not displayed as expected in Opera browser

EDIT: the main problem seems to be that it doesn't implement a font I have used from google(that all other browsers do...) but it implements another really similar on above...


Have you tried using pixels for the font-size instead of em? Maybe Opera interprets em differently than other browsers...

EDIT - Using em for the font size was not the issue. Neither was the position:fixed attribute. Here was the solution:

problem solved after I removed 'Josefin Sans', and then had them back again...now opera presents with backup fonts, I think the problem was a stupid combination of Cache and of Opera being incapable to load a google font for h1


Specifying a font size in ems is meaningless. An em is the width of 'm' in the current font size. Font sizes should be specified in points.


"Specifying a font size in ems is meaningless. An em is the width of 'm' in the current font size. Font sizes should be specified in points."

--This is not correct. em is entirely appropriate for defining font sizes. em does refer to the current font size, except when used to define a font size - then it refers to the parent font size. It would be useless otherwise.

From the w3c spec (http://www.w3.org/TR/CSS21/syndata.html) :

"The 'em' unit is equal to the computed value of the 'font-size' property of the element on which it is used. The exception is when 'em' occurs in the value of the 'font-size' property itself, in which case it refers to the font size of the parent element."

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜