我正在尝试在col-sm-6
列中创建一个面板。
有没有办法让面板标题和面板内容不会超出第一列?
到目前为止,这是我的代码:
<!DOCTYPE html>
<html lang="en">
<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-fluid">
<div class="row">
<div class="col-sm-6" style="background-color:lavender;">
.col-sm-6
<div class="container">
<h3>Panel Heading</h3>
<div class="panel panel-default">
<div class="panel-heading">Panel Heading
</div>
<div class="panel-body">Panel Content
</div>
</div>
</div>
</div>
<div class="col-sm-6" style="background-color:lavenderblush;">.col-sm-6</div>
</div>
</div>
</body>
</html>
我试图添加这个CSS,但它无法正常工作
.container{
position: absolute;
}
答案 0 :(得分:2)
将此代码用于正文:
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row">
<div class="col-sm-6" style="background-color:lavender;">
.col-sm-6
<div class="row">
<h3>Panel Heading</h3>
<div class="panel panel-default">
<div class="panel-heading">Panel Heading
</div>
<div class="panel-body">Panel Content
</div>
</div>
</div>
</div>
<div class="col-sm-6" style="background-color:lavenderblush;">.col-sm-6</div>
</div>
</div>
&#13;