我正在尝试使用Bootstrap面板,但未显示。有人知道为什么我的代码不起作用吗?我是从bootstrap网站上获得的,并做了一些小的修改。

自举代码
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Share Something!</h3>
</div>
<div class="panel-body">
<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<div class="form-group">
<label>Share Title</label>
<input type="text" name="title" class="form-control" />
</div>
<div class="form-group">
<label>Body</label>
<textarea name="body" class="form-control"></textarea>
</div>
<div class="form-group">
<label>Link</label>
<input type="text" name="link" class="form-control" />
</div>
<input class="btn btn-primary" name="submit" type="submit" value="Submit" />
<a class="btn btn-danger" href="<?php echo ROOT_PATH; ?>shares">Cancel</a>
</form>
</div>
</div>
答案 0 :(得分:2)
您只需要正确关闭标签并确保包含正确的bootstrap 3版本的css和js文件
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Share Something!</h3>
</div>
<div class="panel-body">
<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<div class="form-group">
<label>Share Title</label>
<input type="text" name="title" class="form-control" />
</div>
<div class="form-group">
<label>Body</label>
<textarea name="body" class="form-control"></textarea>
</div>
<div class="form-group">
<label>Link</label>
<input type="text" name="link" class="form-control" />
</div>
<input class="btn btn-primary" name="submit" type="submit" value="Submit" />
<a class="btn btn-danger" href="<?php echo ROOT_PATH; ?>shares">Cancel</a>
</div>
</form>
</div>
答案 1 :(得分:1)
div和form元素的关闭是错误的。
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Share Something!</h3>
</div>
<div class="panel-body">
<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<div class="form-group">
<label>Share Title</label>
<input type="text" name="title" class="form-control" />
</div>
<div class="form-group">
<label>Body</label>
<textarea name="body" class="form-control"></textarea>
</div>
<div class="form-group">
<label>Link</label>
<input type="text" name="link" class="form-control" />
</div>
<input class="btn btn-primary" name="submit" type="submit" value="Submit" />
<a class="btn btn-danger" href="<?php echo ROOT_PATH; ?>shares">Cancel</a>
</form>
</div>
</div>