The difference between CSS positioning in Windows and Linux
I’m having trouble rendering my html page using the same browser in different operating systems.
There are 3 spans, and the position of each span is corrected by CSS (position:relative).
But I found that the page that looks correct in Firefox under Linux is not displayed correctly in the same Firefox (3.5.7) under Windows OS.
Linux (left – how it should be)/Windows (right): link text
The same goes for other browsers. What is the cause of this problem and how to fix it.
My code:
Question .html:
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Question</title>
<link href="css/question.css" rel="stylesheet" media="all" />
</head>
<body>
<div class="eventFullDate">
<span class="eventYear">2010</span>
<span class="eventDate">17</span>
<span class="eventMonth">FEB</span>
</div>
</body>
</html>
Question .css:
html, body{
font-family: Georgia;
}
div.eventFullDate{
height: 39px;
width: 31px;
float: left;
border: 1px solid;
border-color: #E3E3E3;
background-color: #F7FFFF;
}
span.eventYear, span.eventDate, span.eventMonth{
color: #EC5C1D;
position: relative;
width: 100%;
}
span.eventYear{
left: 1px;
bottom: 3px;
font-size: 0.8em;
}
span.eventDate{
left: 5px;
bottom: 12px;
font-size: 1.3em;
}
span.eventMonth{
left: 3px;
bottom: 15px;
font-size: 0.8em;
}
Solution
You should use CSS-reset, which will help standardize your CSS for better cross-browser compatibility: http://developer.yahoo.com/yui/reset/
Also, you have this
html, body{
font-family: Georgia;
}
I’m guessing one of your operating systems doesn’t have Georgia fonts. Probably the Windows version.