<body> <!-- h1里面嵌套a,并且有网站名,方便seo --> <h1> <a href="#">小米官网</a> </h1> </body>
<style> a { display: block; width: 55px; height: 55px; background: url(logo.png) no-repeat;/* a设置大小,背景图,首行 */ text-indent: -999px;/* 使文字看不见 ,不宜过大,会出现bug*/ overflow: hidden;/* 最好写上,隐藏超出部分,避免出现bug */ } </style>