为什么Twitter Bootstrap 2 btn-group不起作用?

时间:2013-08-14 17:49:24

标签: html css twitter-bootstrap laravel laravel-4

有没有可能让它发挥作用?这是我的代码(我在表中使用它):

<div class="btn-group">
    <td><a class="btn btn-mini btn-info" href="{{ URL::to('characters/{{ $player->name') }}">View</a></td>
    <td>{{ Form::open(array('method' => 'DELETE', 'route' => array('players.destroy', $player->id))) }}
    {{ Form::submit('Delete', array('class' => 'btn btn-mini btn-danger')) }}
    {{ Form::close() }}</td>
</div>

1 个答案:

答案 0 :(得分:1)

只需将class="btn-group"提供给<form>元素:

尝试这样的事情:

<td>
    <div class="btn-group">
        <a class="btn btn-mini btn-info" href="{{ URL::to('characters/{{ $player->name') }}">View</a>
        {{ Form::open(array('class' => 'btn-group', 'method' => 'DELETE', 'route' => array('players.destroy', $player->id))) }}
        {{ Form::submit('Delete', array('class' => 'btn btn-mini btn-danger')) }}
        {{ Form::close() }}
    </div>
</td>

最后的HTML应如下所示:http://jsfiddle.net/hyWnt/1/


更新了Bootstrap 2.3.2的jsfiddle:http://jsfiddle.net/msturdy/HyfKZ/4/

更改是:

新CSS:

div.btn-group + form.btn-group {
    margin-left: -5px;
    display:inline;
}

然后代码应该是:

<td>
    <div class="btn-group">
        <div class="btn-group">
            <a href="{{ URL::to('characters/'. $player->name) }}" class="btn btn-mini btn-info">View</a>
            <span class="btn" style="display:none"></span>
        </div>
        <form method="POST" action="http://localhost:8000/account/management/characters/delete/23" accept-charset="UTF-8" class="btn-group">
            <input name="_token" type="hidden" value="7GKfarNh81RKu1Y5Dts8bYeFjOG7i8bLdD0CdNLa">        
            <input name="_method" type="hidden" value="DELETE">
            <input class="btn btn-mini btn-danger" type="submit" value="Delete">            
        </form>    
    </div>
</td>