我正在学习Bootstrap,并且正在尝试一些可能很简单但我无法理解的事情。
我正在做一些实验,这是一个非常原始的设计,由只有一个col的行(标题)和位于另一行之下的两个内容col组成。我想不出比这更简单的东西!
问题是,无论我做什么,第一行(标题)都坚持小于内容行。在第一行和第二行之间也有空白。
下面的我的代码:
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
user-scalable-no,
initial-scale=1.0,
maximum-scale=1.0,
minimum-scale=1.0">
<title>Tabelas</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<style>
header {
background:#2c3e50;
color:#fff;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm">
<header>
<h1 class="text-center">
My Title
</h1>
</header>
</div>
</div>
<div class="row">
<div class="col-sm-9" style="background:#e7e1c7;">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took.
</div>
<div class="col-sm-3" style="background:#a0c9f1;">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took.
</div>
</div>
</div>
</body>
</html>
有帮助吗?
not具有col-sm
类的div ...,而对于以下各列,您已使用col-sm-9
和[C0 ]类
col-sm-3
.header-parent-div {
background: #2c3e50;
color: #fff;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<div class="container">
<div class="row">
<div class="col-sm header-parent-div">
<header>
<h1 class="text-center">
My Title
</h1>
</header>
</div>
</div>
<div class="row">
<div class="col-sm-9" style="background:#e7e1c7;">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took.
</div>
<div class="col-sm-3" style="background:#a0c9f1;">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took.
</div>
</div>
</div>
</body>
</html>
Saludos