1、图标跟文字混排
html
<div class="link"> <span class="icon wyyx"></span> 分享</div>
css
.link{ width: 92px; border: 1px solid #0f0; line-height: 18px;}.icon{ display: inline-block; *zoom: 1; vertical-align: bottom;}.wyyx{ width: 18px; height: 18px; background: url(http://p2.qhimg.com/t0116804ffa3cc8a59f.png) no-repeat;}截图:
注意:
父容器的line-height值与图标的高度相等,另保持设置图标的vertical-align的值为bottom。
立即学习“前端免费学习笔记(深入)”;
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号