[英]Bootstrap 3 Button Groups - how to make them links?
This seems really dumb to me, but what are the point of Bootstrap 3's button groups if you can't make them links? 这对我来说真的很愚蠢,但如果你不能让它们链接起来,那么Bootstrap 3的按钮组有什么意义呢?
http://getbootstrap.com/components/#btn-groups http://getbootstrap.com/components/#btn-groups
We've tried this: 我们试过这个:
<button type="button" class="btn btn-lg btn-success" href="add.php">
<span class="glyphicon glyphicon-plus"></span> Add
</button>
And... 和...
<button type="button" class="btn btn-lg btn-success">
<a href="add.php"><span class="glyphicon glyphicon-plus"></span> Add</a>
</button>
But neither work as links. 但两者都不能作为链接。 What am I not understanding here?
我在这里不理解什么? Thank you.
谢谢。 NJ
NJ
You can use the classes in bootstrap to change the a
tag. 您可以使用类的引导来改变
a
标签。
<div class="btn-group" role="group" aria-label="...">
<a href="" class="btn btn-default">Left</a>
<a href="" class="btn btn-default">Middle</a>
<a href="" class="btn btn-default">Right</a>
</div>
<a href="add.php" class="btn btn-lg btn-success">
<span class="glyphicon glyphicon-plus"></span> Add
</a
See the example here - http://www.bootply.com/v8anIQZU97 请参阅此处的示例 - http://www.bootply.com/v8anIQZU97
HTML buttons don't have an href attribute. HTML按钮没有href属性。 Instead try using anchor tags.
而是尝试使用锚标签。 Here's a Plnkr that illustrates a button group using anchor tags to open search engines in a new window.
这是一个Plnkr ,它说明了一个按钮组,它使用锚标签在新窗口中打开搜索引擎。
<div class="btn-group">
<a class="btn btn-lg btn-success" href="http://www.google.com" target="_blank">Google</a>
....
</div>
Try this... 试试这个...
<button type="button" class="btn btn-lg btn-success" onclick="location.href='@Url.Action("Action", "Controller")'">
<span class="glyphicon glyphicon-plus"></span> Add
</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.