设置span宽度的完美解决方案

<!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><title>Test Span</title>

<style type="text/css">

span { background-color:#ffcc00; display:-moz-inline-box; display:inline-block; 150px;}

</style>

</head>

<body>
<p>
下面代码的 CSS定义完美解决了span的宽度设置问题。由于浏览器通常对不支持的CSS属性采取忽略处理的态度,所以最好将
display:inline -block行写在后面,这样在Firefox里面,如果到了未来的Firefox
3,这一行就能起作用,代码可以同时兼容各种版本。</p>

fixed <span>width</span> span

</body></html>

原文地址:https://www.cnblogs.com/059212315/p/1673048.html