<style type="text/css">
.father{
width: 200px;
height: 200px;
background-color: red;
}.son{
width: 50px;
height: 50px;
background-color: green;
/*
要使得盒子son在盒子father的右上角显示,可以用浮动:
float:right;
但为了规避浮动布局(脱标流),这里不用浮动原理,可以用文档(标准)流:
margin-left:auto;
意思是充满左侧,从而使得盒子son在推往右端
*/
margin-left: auto;
}
.picture img{
vertical-align: middle;
}
</style>
<body>
<div class="father">
<div class="son"></div>
</div>
<hr />
<div class="picture">
<img src="../黑马/02-CSS-基础班/7.css基础五上课资料/03-练习/3.png" alt="">MyHtml
</div>
<hr />
</body>