长标题的文章可以使用简单的CSS样式实现省略号控制显示。下面的例子是标题很长的文章,我们截取14个汉字,其余省略号代替
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>CSS控制文章标题长短代码www.cssjiaocheng.cn</title>
<style type="text/css">
ul {width:200px; margin:50px auto;}
li {width:200px; line-height:25px; text-overflow:ellipsis; white-space:nowrap; overflow:hidden;}
a {color:#03c; font-size:13px;}
a:hover {color:#000;}
</style>
</head>
<body>
<ul>
<li><a href="http://www.webdn.com/web_file/3sword/flash/N0607020/">Flash播放器最新全面升级,下载flash播放器</a>
<li><a href="http://www.webdn.com/web_file/program/php/0602080577/">MySQL的管理工具:phpMyAdmin教程</a>
<li><a href="http://www.webdn.com/web_file/program/asp/N0610483/">asp无组件上传,ASP学习超级实用工具</a>
</ul>
</body>
</html>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>CSS控制文章标题长短代码www.cssjiaocheng.cn</title>
<style type="text/css">
ul {width:200px; margin:50px auto;}
li {width:200px; line-height:25px; text-overflow:ellipsis; white-space:nowrap; overflow:hidden;}
a {color:#03c; font-size:13px;}
a:hover {color:#000;}
</style>
</head>
<body>
<ul>
<li><a href="http://www.webdn.com/web_file/3sword/flash/N0607020/">Flash播放器最新全面升级,下载flash播放器</a>
<li><a href="http://www.webdn.com/web_file/program/php/0602080577/">MySQL的管理工具:phpMyAdmin教程</a>
<li><a href="http://www.webdn.com/web_file/program/asp/N0610483/">asp无组件上传,ASP学习超级实用工具</a>
</ul>
</body>
</html>