CSS样式:
.tishiBox,.tishiBox span{ position:absolute;display:inline-block; background:url(/static/images/sns/teacher/tishiBg.png);_background:url(/static/images/sns/teacher/ie6gif/tishiBg.gif)}
.tishiBox{height:36px; position: absolute; white-space:nowrap;background-position:center 0;}
.tishiBox span{ position:absolute;display:inline-block; background:url(/static/images/sns/teacher/tishiBg.png);_background:url(/static/images/sns/teacher/ie6gif/tishiBg.gif)}
.tishiBox span.spanL,.tishiBox span.spanR{10px;height:36px;top:0;}
.tishiBox span.spanL{ background-position:0 0;left:-10px;}
.tishiBox span.spanR{ background-position:right 0;right:-10px;}
.tishiBox p{padding:0 10px;line-height:30px;color:#e70909;}
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=utf-8" />
<title>无标题文档</title>
</head>
<body>
<div class="tishiBox">
<span class="spanL"></span>
<span class="spanR"></span>
<p> 根据字数的多少定义图片的大小</p>
</div>
</body>
</html>
图片:(宽度和高度固定,宽度给到最大)