天天看點

CSS寫省略号

<html>

<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8">

<title>css寫省略号方法</title>

<style>

* { margin: 0; padding: 0; }

a { text-decoration: none; color: #000; }

a:hover { text-decoration: none; color: #000; }

ul {

width: 300px;

margin: 40px auto;

padding: 12px 4px 12px 24px;

border: 1px solid #d4d4d4;

background: #f1f1f1;

}

li { margin: 12px 0; }

li a {

display: block;

width: 220px;

overflow: hidden;

white-space: nowrap;

-o-text-overflow: ellipsis;

text-overflow: ellipsis;

/* firefox only */

li:not(p) {

clear: both;

li:not(p) a {

max-width: 170px;

float: left;

li:not(p):after {

content: "...";

width: 25px;

padding-left: 5px;

color: #000;

/* xhtml demo*/

</style>

</head>

<body>

<ul>

<li><a href="#">設計人員必讀:影響seo的頁面制作細節</a></li>

</ul>

</body>

</html>