div中的文字和图片垂直居中对齐
程序员文章站
2022-04-24 22:13:50
...
<!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>
<style>
.testTXT{
height:36px;
line-height:36px;
padding-left:36px;
background:url(mtea-error-warn.png) no-repeat left center
}
</style>
</head>
<body>
<div class="testdiv">
<div class="testTXT"><span>这里是文字,看看文字对齐了没</span></div>
</div>
</body>
</html>
推荐阅读
-
11.行盒垂直对齐和图片的底部白边问题
-
CSS让同一行的图片和文字垂直居中对齐(转载)
-
css+div布局中的垂直居中
-
荐 css的3中水平居中方式和4中水平垂直居中方式及应用情形速记
-
iOS - UIButton(UIEdgeInsets)/设置button上的文字和图片上下垂直居中对齐
-
如何提取PPS文件中的图片和背景音乐及带文字说明的图片
-
div中图片和文字同一行实现垂直居中
-
经常用的图片在容器中的水平垂直居中实例_javascript技巧
-
经常用的图片在容器中的水平垂直居中实例_javascript技巧
-
初学HTML/CSS:图片如何在DIV中的垂直居中,文字与DIV中的间距如何消除_html/css_WEB-ITnose