我刚开始学习如何使用 html 和 css,我的老师要求我们使用 Bootstrap。很明显,这真的很酷,但是当我尝试制作一个按钮时,只有按钮内的文本实际上起到了链接的作用,而不是整个矩形按钮。我不确定我是否需要的不仅仅是缩小的 bootstrap javascript 文件来使它们工作或什么。
这是我的 html,我还在头上添加了行“$('.nav-tabs').button()”以及来自 Bootstrap 的 javascript 文件。有什么建议吗?我知道我的 html 可能很简陋,我的老师不是最擅长解释事情的人,所以我一直在摆弄事情,直到它们看起来可行为止。
<div class="btn-toolbar">
<div class="row-fluid">
<div class="span2 offset2">
<div class="btn btn-primary">
<a href="http://students.cec.wustl.edu/~amd4/Portfolio/portfolio%20-%20profile%20-%20final.html">
Profile
</a>
</div>
</div>
<div class="span2 offset.5">
<div class="btn">
<a href="http://students.cec.wustl.edu/~amd4/Portfolio/portfolio%20-%20writing%20-%20final.html">
Writing
</a>
</div>
</div>
<div class="span2 offset.5">
<div class="btn">
<a href="http://students.cec.wustl.edu/~amd4/Portfolio/portfolio%20-%20music%20-%20final.html">
Music
</a>
</div>
</div>
<div class="span2 offset.5">
<div class="btn">
<a href="http://students.cec.wustl.edu/~amd4/Portfolio/portfolio%20-%20photos%20-%20final.html">
Photography
</a>
</div>
</div>
</div>
最佳答案
删除 class="btn btn-primary"
来自 div
标签,把它放在 a
上标签
参见 http://twitter.github.com/bootstrap/base-css.html#buttons
...typically you'll want to apply these to only
<a>
and<button>
elements for the best rendering.
关于javascript - 使用 Bootstrap,我只能让文本充当链接,而不是整个按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15708362/