用于设计文本和数量相同行的 CSS



我有一个设计如下要求。我在 MVC 5 中使用引导程序。这适用于响应式 UI。我需要在引导模式弹出窗口中显示如下。


Lorem ipsum dolor sit amet, consectetur adipiscing elit.Cras id mi neque.Donec pulvinar quam diam, at accumsan odio pretium ac

..............................$xx......

余额 $xx,xxx.xx

最后付款 月-日-年 ............$x......


要允许文本悬挂在值上方,您需要使用div 并将值浮动到右侧。请记住,根据描述的长度,成本仍有可能下降。

<div style="width: 600px">
  <div>
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id mi neque. Donec pulvinar quam diam, at accumsan odio pretium ac<span style="float: right;">$xx,xxx.xx</span>
  </div>
  <div style="background-color: whitesmoke;">
  Balance<span style="float: right;">$xx,xxx.xx</span>
  </div>
  <div>
  Last Payment mm-dd-yyyy<span style="float: right;">$x,xxx.xx</span>
  </div>
</div>

这应该处理将金额与文本对齐的问题。

tr td:last-child {
  text-align: right;
}
table {
  background-color: white;
}
tr:nth-child(even) {
  background-color: whitesmoke;
}
td {
  vertical-align: bottom;
}
<table>
<tbody>
  <tr>
    <td>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id mi neque. Donec pulvinar quam diam, at accumsan odio pretium ac</td>
    <td>$xx,xxx.xx</td>
  </tr>
  <tr>
    <td>Balance</td>
    <td>$xx,xxx.xx</td>
  </tr>
  <tr>
    <td>Last Payment mm-dd-yyyy</td>
    <td>$x,xxx.xx</td>
  </tr>
</tbody>
</table>

我试图解决你的问题。 希望对您有所帮助

<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id mi neque. Donec pulvinar quam diam, at accumsan odio pretium </h4>
        </div>
        <div class="modal-body">
<table class="table table-hover">
<tbody>
  <tr>
    <td>ac........</td>
    <td>$xx,xxx.xx</td>
    
  </tr>
  <tr>
    <td>Balance....</td>
    <td>$xx,xxx.xx</td>
    
  </tr>
  <tr>
    <td>July</td>
    <td>$xx,xxx.xx</td>
    
  </tr>
</tbody>
  </table>            </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>
      
    </div>
  </div>
  </div>

相关内容

  • 没有找到相关文章

最新更新