javascript - 使用 Bootstrap,我只能让文本充当链接,而不是整个按钮?

标签 javascript html css button twitter-bootstrap

我刚开始学习如何使用 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/

相关文章:

javascript - 来自 json 数组的 c3js 堆积条形图

javascript - 以编程方式将文件添加到 jquery fileupload

javascript - onchange 事件不起作用

html - 我可以使用 CSS 为表格列着色而不为单个单元格着色吗?

javascript - 如何使用 Javascript 分解 HTML 字符串中的每个单词,然后在 HTML 中一一显示每个单词?

css - 如何更改 <%=link_to ruby​​ 标签内链接词的字体颜色?

javascript - 在 jquery 移动页面中添加面板会使设备上的页面滚动卡住

javascript - 在 JavaScript 中通过引用传递参数?

html - 哪种方法更适合固定宽度侧边栏的响应式设计?

css - 在 HTML5+CSS 中,<nav class ="nav"> 是多余的吗?