问题1:文字和图片的父元素应该怎么找? 问题2:若在<div class="txtCenter">我想要在父容器中水平居中显示。</div>中加入<span>,</span>,那么文字的父元素还是txtCenter吗?为什么?
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>定宽块状元素水平居中</title>
<style>
div{
border:1px solid red;
margin:20px;
}
.txtCenter{
text-align:center;
}
.imgCenter{
text-align:center;
}
</style>
</head>
<body>
<div class="txtCenter">我想要在父容器中水平居中显示。</div>
<!--下面是任务部分-->
<div class="imgCenter"><img src="http://img1.sycdn.imooc.com//52da54ed0001ecfa04120172.jpg" /></div>
</body>
</html>