这是我的做法:
<h1><img src="http://cdn.smugmug.com/photos/2254208423_RS5b5Z6-O.png" alt="Logo"></h1>
--
body {
padding-top: 3em;
}
h1 {
color: #333;
display: table;
}
h1:after,
h1:before {
background-image: -webkit-linear-gradient(transparent 40%, #87a 40%, #87a 60%, transparent 60%);
background-image: -moz-linear-gradient(transparent 40%, #87a 40%, #87a 60%, transparent 60%);
background-image: -ms-linear-gradient(transparent 40%, #87a 40%, #87a 60%, transparent 60%);
background-image: -o-linear-gradient(transparent 40%, #87a 40%, #87a 60%, transparent 60%);
background-image: linear-gradient(transparent 40%, #87a 40%, #87a 60%, transparent 60%);
content: '';
display: table-cell;
width: 50%;
/* Everything below allows us to have a little bit of space between the title and the decoration */
-webkit-background-clip: padding;
-moz-background-clip: padding;
background-clip: padding;
}
h1:after {
border-left: 1.5em solid transparent;
}
h1:before {
border-right: 1.5em solid transparent;
}
这是一个活生生的例子:http: //jsfiddle.net/joshnh/XjXYE/