2
我无法弄清楚没有使用float:right或使用相对定位。如果我使用它,当人们放大和缩小时它会四处移动。我试图弄清楚如何让它保持在我放置它的位置,即使人们放大和缩小。我怎样才能让文本框粘在每个包装div的顶部?
HTML结构:
<div class="staff-block">
<img class="staff-pics" />
<div class="staff-text">
<h3>
<p>
</div>
</div>
CSS:
.staff-block { /* Red */
border: 1px dashed red;
display: block;
}
.staff-pics { /* Orange */
border: 1px dashed orange;
display: ;
width:150px;
display: inline-block;
margin-bottom: 50px;
}
.staff-text { /* Yellow */
border: 1px dashed yellow;
width: 70%;
font-size: 15px;
color: #FFCC00;
display: inline-block;
}
.staff-text h3 { /* Green */
border: 1px dashed lime;
margin-bottom: 10px;
color: white;
}
.staff-text p { /* Blue */
border: 1px dashed aqua;
}
谢谢,我不知道该vertical-align属性 – ekedin
的一些原因,当我用文本编辑器打开它时,它不在开发工具之外工作。 – ekedin
@ekedin它应该工作 - 检查开发工具,看看是否有任何东西被覆盖..也有可能是chaching ..否则将'vertical-align:top'添加到'divs' –