[英]Chrome occasionally renders my HTML/CSS differently
我剛剛開始學習HTML / CSS,並試圖從頭開始創建個人網站(沒有CSS工具)
昨晚當我在Firefox和IE中測試我的網站時,它看起來很干凈
當我在Chrome中測試我的網站時,我的鏈接四處移動:
有人知道這里發生了什么嗎? 這是我的標記:
<!DOCTYPE html>
<html>
<head>
<title>Home | Some Website!</title>
<style>
* {
padding: 0;
margin: 0;
}
body {
width: 960px;
font-size: small;
font-family: Verdana, Helvetica, Arial, sans-serif;
line-height: 1.6em;
background-color: #FFFFF0;
margin: 0 auto;
}
#header {
border-style: solid;
}
#header img {
margin: 4px 0px 0px 4px;
}
#header ul {
list-style-type: none;
display: inline;
margin: 25px 30px 0px 0px;
float: right;
font-size: x-large;
}
#header ul li {
display: inline;
margin: 0 30px;
}
#header li a:link {
color: #FF00FF;
text-decoration: none;
}
#header li a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div id="header">
<img src="http://i.imgur.com/YbAx7y1.png" alt="Temp Logo!">
<ul>
<li><a href="about.html">About Me</a></li>
<li><a href="resume.html">Résumé</a></li>
<li><a href="projects.html">Projects</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
</body>
</html>
從display: inline;
更改#header ul
css定義display: inline;
display: inline-block;
。
每個瀏覽器對事物的解釋都不同。 您應該比body { font-size: small }
更具體。 我建議使用px值,除非您確實打算將其留給瀏覽器使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.