Html 增加Listboxfor字段的宽度

Html 增加Listboxfor字段的宽度,html,css,Html,Css,在下面的图片中,我试图通过保持每个其他项目不变来增加ListBoxFor项目的大小 下面是我的Html代码: <div class="cf mpcontent_header"> <div class="col-md-2" style="width: 250px;"> <h4 style="font-size: 18px;">@Resources.LanguageStrings.ApproveOneOrAll</h4>

在下面的图片中,我试图通过保持每个其他项目不变来增加ListBoxFor项目的大小

下面是我的Html代码:

<div class="cf mpcontent_header">
    <div class="col-md-2" style="width: 250px;">
        <h4 style="font-size: 18px;">@Resources.LanguageStrings.ApproveOneOrAll</h4>
    </div>
    <div class="col-md-3 hidebtnmobile" style="width: 425px;">
        <div class="col-md-8">
            @Html.ListBoxFor(m => m.SelectedVendor, Model.GetVendorList(user.idCompany, user.SiteSelection), new { data_placeholder = Resources.LanguageStrings.SelectVendors })
        </div>
        <div class="col-md-4">
            <button id="submitButton" class="btn large primary-bg" style="font-size: 12px;" onclick="selectAllComboItems('#SelectedVendor', false);return false;">@Resources.LanguageStrings.ClearAll</button>
        </div>
    </div>
    <div class="col-md-3 hidebtnmobile" style="width: 425px;">
        <div class="col-md-8">
            @Html.ListBoxFor(m => m.SelectedStaff, Model.GetStaffMembers(user.idCompany, user.SiteSelection), new { data_placeholder = Resources.LanguageStrings.SelectStaff })
        </div>
        <div class="col-md-4">
            <button id="submitButton" class="btn large primary-bg" style="font-size: 12px;" onclick="selectAllComboItems('#SelectedStaff', false);return false;">@Resources.LanguageStrings.ClearAll</button>
        </div>
    </div>
    <div class="col-md-4 hidebtnmobile">
        <button id=" add" class="btn large primary-bg button_float_right " style="font-size: 12px;" title="@Resources.LanguageStrings.AddWOTitle" onclick="location.href = '@Url.Action("AddWorkOrder")'">
        @Resources.LanguageStrings.Add</button>
        <button class="btn large primary-bg button_float_right btnPrint " style="font-size: 12px;" title="@Resources.LanguageStrings.PrintTitle">@Resources.LanguageStrings.MultiPrint</button>
        <button class="btn large primary-bg button_float_right " style="margin-right: 10px; font-size: 12px;" title="@Resources.LanguageStrings.MultiApprove" onclick=" ApproveWorkOrders(); return false;">@Resources.LanguageStrings.MultiApprove</button>
        <style type="text/css">
            .tableActions .btn {
                min-width: 45px;
                margin-right: 2px;
            }
        </style>
        <div class="tableActions">
            <button class="btn large primary-bg" onclick="copyTableText($('#WorkOrderList'));">Copy</button>
            <button class="btn large primary-bg" onclick="$('#WorkOrderList').tableToCSV();">CSV</button>
        </div>
    </div>
</div>

@Resources.languageString.ApproveOneOrAll
@Html.ListBoxFor(m=>m.SelectedVendor,Model.GetVendorList(user.idCompany,user.SiteSelection),new{data\u placeholder=Resources.LanguageStrings.SelectVendors})
@Resources.languageString.ClearAll
@Html.ListBoxFor(m=>m.SelectedStaff,Model.GetStaffMembers(user.idCompany,user.SiteSelection),新的{data\u placeholder=Resources.LanguageStrings.SelectStaff})
@Resources.languageString.ClearAll
@Resources.LanguageStrings.Add
@Resources.LanguageString.MultiPrint
@Resources.languageString.MultiApprove
.tableActions.btn{
最小宽度:45px;
右边距:2px;
}
复制
CSV
我用width元素做了很多尝试,但是没有成功。每当我把宽度从425增加到450,它就会把末尾的按钮带到我不想要的下一行

正确的使用方法是什么?我希望“全部清除”和“复制”按钮之间的间距减小


非常感谢您的帮助。

最好与css共享一个演示页面(也可以使用js FIDLE或stack)。您的
width
属性仅应用于包含该框的div。尝试将其作为样式参数添加到
ListBoxFor
函数中,例如
new{@style=“width:425px;”}
最好与css共享演示页面(也使用js小提琴或堆栈)。您的
width
属性仅应用于包含该框的div。尝试将其作为样式参数添加到
ListBoxFor
函数中,例如
new{@style=“width:425px;”}