CSS与Tables之战仍然在继续
时间总喜欢跟我们开玩笑,一场永恒的table和CSS布局的大战仍在持续。就像经典的vi vs. emacs ,星际大战 vs.星际旅行。
首先让我们来看下giveupandusetables.com :
然后继续看一下:shouldiusetablesforlayout.com
来看一下源代码:
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
- < html >
- < head >
- < meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" />
- < title > Should I use tables for layout? </ title >
- < style type = "text/css" >
- html,body{
- background:999;color:ccc;
- }
-
- h1{
- font-family:"Georgia",Helvetica,Arial,Sans-Serif;
- font-size:10em;
- padding:.1em 0;
- text-align:center;
- color:333;
- margin:.5em auto;
- }
- </ style >
- </ head >
- < body >
- < h1 > No. </ h1 >
-
- <!--
- < table border = "0" width = "100%" >
- < tr >
- < td align = "center" > No. </ td >
- </ tr >
-
- -->
-
- </ body >
-
- </ html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Should I use tables for layout?</title>
<style type="text/css">
html,body{
background:999;color:ccc;
}
h1{
font-family:"Georgia",Helvetica,Arial,Sans-Serif;
font-size:10em;
padding:.1em 0;
text-align:center;
color:333;
margin:.5em auto;
}
</style>
</head>
<body>
<h1>No.</h1>
<!-- Honestly, no. -->
<!--
<table border="0" width="100%">
<tr>
<td align="center">No.</td>
</tr>
-->
<!-- Fact: Chuck Norris hates layout tables! -->
</body>
</html>
让我们来猜猜谁将会赢得这次胜利?也许,没有输赢, display: table ,两者相结合。