【问题标题】:Using Bootstrap, I can only get the text to act like a link, not the whole button?使用 Bootstrap,我只能让文本像一个链接,而不是整个按钮?
【发布时间】:2013-03-29 17:33:03
【问题描述】:

我刚刚学习如何使用 html 和 css,我的老师要求我们使用 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>

【问题讨论】:

    标签: javascript html css button twitter-bootstrap


    【解决方案1】:

    div标签中去掉class="btn btn-primary",放到a标签上

    http://twitter.github.com/bootstrap/base-css.html#buttons

    ...通常您只想将这些应用到 &lt;a&gt;&lt;button&gt; 元素以获得最佳渲染效果。

    【讨论】:

      【解决方案2】:

      看起来您没有在 a 标记上添加类。 你需要使用类似&lt;a href="#" class="btn btn-primary"&gt;New button&lt;/a&gt; 这样的东西,这应该会给你一个带有文本 New button 的按钮。

      你使用&lt;a href="#" class="btn btn-primary btn-large"&gt;Big Button&lt;/a&gt;

      对于一个大的蓝色按钮。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-12-20
        • 2011-02-26
        • 2010-11-16
        • 2019-09-18
        • 1970-01-01
        • 1970-01-01
        • 2023-03-02
        相关资源
        最近更新 更多