如何将 bootstrap 表单控件填充设置为 0 px

How to set bootstrap form-control padding to 0 px

我在将 Bootstrap 表单控件填充设置为 0 时遇到问题。我尝试在样式中添加 .form-control class 但没有成功。我相信应该可以在样式块中覆盖 CSS classes 的某些属性。

如何将 .form-control 填充设置为 0?

<wicket:head xmlns:wicket="http://wicket.apache.org/">
 <styles>
     .form-control {
        padding: 0px;
     }

 </styles>
</wicket:head>
<wicket:panel xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/">
    <div class="col-xs-12">
        <div class="col-xs-12">
            <div class="form-group">
                <div class="col-sm-3">
                    <input type="submit" value="Request" class="btn btn-danger"/>
                </div>

                <div class="col-sm-3">
                    <label for="quotationId" wicket:id="quotationIdLabel"></label>
                    <div>
                        <input wicket:id="quotationId" type="text" size="20"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="product" wicket:id="productLabel"></label>
                    <div>
                        <select class="form-control" wicket:id="product"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="contract" wicket:id="contractLabel"></label>
                    <div>
                        <input type="hidden" wicket:id="contract"/>
                    </div>
                </div>

                <div class="col-sm-3" style="padding: 0">
                    <label for="customer" wicket:id="customerLabel"></label>
                    <div>
                        <input class="form-control" type="hidden" wicket:id="customer"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="serviceLevel" wicket:id="serviceLevelLabel"></label>
                    <div>
                        <select class="form-control" wicket:id="serviceLevel"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="equipmentType" wicket:id="equipmentTypeLabel"></label>
                    <div>
                        <input class="form-control" type="hidden" wicket:id="equipmentType"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="commodity" wicket:id="commodityLabel"></label>
                    <div>
                        <select class="form-control" wicket:id="commodity"/>
                    </div>
                </div>

                <span class="col-sm-3">
                    <label for="originCountry" wicket:id="originCountryLabel"></label>
                    <div>
                        <input type="hidden" style="display: inline-block;" wicket:id="originCountry"/>
                    </div>
                </span>

                <div class="col-sm-3">
                    <label for="originDgfStation" wicket:id="originDgfStationLabel"></label>
                    <div>
                        <input type="hidden" wicket:id="originDgfStation"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="destinationCountry" wicket:id="destinationCountryLabel"></label>
                    <div>
                        <input type="hidden" wicket:id="destinationCountry"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="destinationDgfStation" wicket:id="destinationDgfStationLabel"></label>
                    <div>
                        <input type="hidden" wicket:id="destinationDgfStation"/>
                    </div>
                </div>

                <div class="col-sm-3">
                    <label for="shippingTerms" wicket:id="shippingTermsLabel"></label>
                    <div>
                        <select class="form-control" wicket:id="shippingTerms"/>
                    </div>
                </div>

            </div>

            <br/>
        </div>
    </div>

    <div class="clearfix"></div>

</wicket:panel> 

添加class "p-0" 0填充到你想要的div,

class="other-class p-0"

像这样尝试更具体的选择器:

.form-group .form-control {
    padding: 0;
}