html5

时间始终在内容最后侧

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    .wrap {
      max-width: 200px;
      background: #ccc;
      zoom: 1;
      /* box-sizing: border-box */
    }
    .wrap:after {
      content: '';
      display: block;
      clear: both;
    }
    .text {
      /* float: left; 这个样式不能加,而且该html必须是行内元素 */
      word-wrap: break-word; /* 自动换行 */
    }
    .time {
      float: right;
    }
  </style>
  <body>
    <div class="wrap">
      <span class="text"
        >.........................................................................</span
      >
      <div class="time">
        <div>18:30</div>
      </div>
    </div>
  </body>
</html>
上次更新: