我只是找不到一种方法来将右栏文字的顶部和左栏文字的顶部设置为同一水平。
这是我使用“一切”的代码:
<div class="container" style="background: white">
<div class="row">
<div class="col-xs-2" style="padding: 0px; vertical-align: top; background: yellow; border-width: 0px 0px 0px 0px ;">
<h4 style="vertical-align: top; padding: 0px; background: whitesmoke; border-width: 0px 0px 0px 0px;">First Left Heading</h4>
</div>
<div class="col-xs-10">
<p th:each="paragraph : ${resumeMap.get('personal').get('interests')}" th:text="${paragraph}">default str</p>
</div>
</div>
答案 0 :(得分:0)
Bootstrap将10px
添加到margin-top
和margin-bottom
的标题元素(将<h1>
添加到<h6>
)。因此,如果要使文本在顶部对齐,则需要在第一个margin-top
上添加相同的<p>
或在{{1}上添加10px
padding-top
}类:
示例1:使用col-xs-10
margin-top:10px
示例2:使用<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="container" style="background:white">
<div class="row">
<div class="col-xs-2 bg-warning">
<h4 style="background:whitesmoke;">First Left Heading</h4>
</div>
<div class="col-xs-10 bg-info">
<p style="margin-top:10px">first paragraph</p>
<p>Second paragraph</p>
<p>Third paragraph</p>
<p>Four paragraph</p>
<p>Five paragraph</p>
</div>
</div>
</div>
padding-top:10px