我使用laravel創建一個窗體樣式與引導CSS。Bootstrap CSS表格類是過度btn類提交按鈕樣式
{!! Form::open(['url' => '/hold', 'method' => 'POST', 'class' => 'form-horizontal']) !!}
<div class="form-group">
{!! Form::label($detail->name, NULL, array('class'=>'control-label')) !!}
{!! Form::text('detail['.$detail->name.']', null, ['class' => 'controls']) !!}
</div>
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
{!! Form::submit('Hold', ['class'=>'btn btn-danger', 'style' => 'float:right;']) !!}
{!! Form::close() !!}
根據Chrome瀏覽器開發工具,即重寫.btn樣式規則的CSS選擇器button, html input[type="button"], input[type="reset"], input[type="submit"]
我猜的html input
類優先於btn
類。我不知道如何防止這種情況,並強制btn
優先。
CSS選擇器'.FORM容器button'沒有應用該樣式到提交按鈕。元素類型不是「按鈕」,而是「輸入」。我不想將樣式規則應用於表單中的所有輸入。 –
您可以針對容器中的特定輸入 - 我更新了代碼以向您展示如何。我在答案中解釋了同樣的模式。 – staypuftman