希望實(shí)現(xiàn)標(biāo)題在左對(duì)齊,日期在右對(duì)齊,當(dāng)直接給日期的span加上float:right時(shí),IE8和FF都OK,但I(xiàn)E6/7則會(huì)換行,下面給出一個(gè)簡(jiǎn)單有效的解決辦法。
XML/HTML Code
1.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2.<html xmlns="http://www.w3.org/1999/xhtml">
3.<head>
4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5. <title></title>
6.<style>
7.<!--
8.
9.#mylist { width:400px; list-style-type:none; margin:0; padding:0; }
10.#mylist li span {
11. float:right;
12.}
13.-->
14.</style>
15.</head>
16.<body>
17.<ul id="mylist">
18.
19. <li><span>2011-12-2</span>Web開(kāi)發(fā)者網(wǎng)絡(luò)(Admin10000.com)</li>
20. <li><span>2011-12-2</span>Web開(kāi)發(fā)者網(wǎng)絡(luò)(Admin10000.com)</li>
21. <li><span>2011-12-2</span>Web開(kāi)發(fā)者網(wǎng)絡(luò)(Admin10000.com)</li>
22.</ul>
23.
24.</body>
25.</html>
注意: 要把 span 寫(xiě)到Li標(biāo)簽中的最前面,這樣在IE6/IE7/FF3.5之前版本中才能保證 span中日期右對(duì)齊。