如何使用CSS使两个元素始终处于同一个位置

By admin, 10 十一月, 2015
 
 

为了便于观察,我把边框尺寸做成不一样。 

 

<div style="position:relative">
  <div style="width:100px;height:100px;border:3px solid #f00">&nbsp;</div>

  <div style="width:100px;height:100px;border:1px solid #00f;position:absolute;top:0;left:0">&nbsp;</div>
</div>

 

标签

评论

Restricted HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img src>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。
验证码
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
请输入"Drupal10"