我一直在阅读html5,当时我遇到这个叫做webkit的东西。我真的不知道它是什么或者做了什么,所以我想出了两个例子。HTML webkit工具
我写的css风格有什么区别吗?从我看到的,这两个CSS给了我相同的输出。这将是一种更为优惠的方式?
的style.css
body {
text-align: center;
}
#wrapper {
border: 4px solid black;
width:1000px;
margin:20px auto;
text-align: left;
}
#top_header {
background:yellow;
border: 2px solid blue;
padding:20px;
}
#nav_bar {
border: 2px solid red;
background:grey;
color:white;
}
#nav_bar li {
font: bold 14px Tahoma;
display:inline-block;
list-style:none;
padding: 5px;
}
v.s
的style.css
body {
width:100%;
margin:20px auto;
display:-webkit-box;
-webkit-box-pack:center;
}
#wrapper {
width: 1000px;
display:-webkit-box;
-webkit-box-pack:center;
-webkit-box-orient:vertical;
-webkit-box-flex:1;
}
#top_header {
background:yellow;
border: 2px solid blue;
padding:20px;
}
#nav_bar {
border: 2px solid red;
background:grey;
color:white;
}
#nav_bar li {
font: bold 14px Tahoma;
display:inline-block;
list-style:none;
padding: 5px;
}
的index.html
<!DOCTYPE html>
<html-lang="en">
<head>
<meta charset=UTF-8" />
<title>Learning Web Design</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper">
<header id="top_header">
<h1>Learning Website </h1>
</header>
<ul>
<li>navBarOne</li>
<li>navBarTwo</li>
<li>navBarThree</li>
</ul>
</nav>
</div>
'-webkit'供应商前缀用于谷歌浏览器和Apple Safari网络浏览器。 – mdesdev