我有一些标签与文本框和下拉列表对齐。下拉列表和文本框之间出现间隙。如果我检查元素,它会向我显示门户网站的css文件,其中不包含导致我希望减少的间隙/垂直空间的信息。我想要的是在模块级别上覆盖这些设置。
在屏幕截图中,我通过“网络开发者”突出显示了这种风格。 firefox上的工具。显示下拉列表之间的差距。
<div class="ColOne">
<asp:Label ID="lblCategory" runat="server" Text="Category" CssClass="labelStyle" style="position: relative"></asp:Label>
</div>
<div >
<asp:DropDownList ID="ddlCategory" runat="server" DataSourceID="sqlCategories" DataTextField="Name" DataValueField="CategoryID" AutoPostBack="True"></asp:DropDownList>
</div>
<div class="ColOne">
<asp:Label ID="lblSubCategory" runat="server" Text="Sub Category" CssClass="labelStyle"></asp:Label>
</div>
<div >
<asp:DropDownList ID="ddlSubCategory" runat="server" DataSourceID="sqlSubCategory" DataTextField="Name" DataValueField="SubCategoryID"></asp:DropDownList>
</div>
我的风格:
div.ColOne {
width: 150px;
float: left; /* to place the column next to the other*/
padding-left: 0px;
padding-top: 12px;
clear: none;
}
div.ColEmpty {
margin-top:0;
}
点击显示样式信息,我得到以下信息:
/* Line 28 */
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, caption, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video
{
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
border-top-width: 0px;
border-right-width-value: 0px;
border-bottom-width: 0px;
border-left-width-value: 0px;
border-top-style: none;
border-right-style-value: none;
border-bottom-style: none;
border-left-style-value: none;
border-image-source: none;
border-image-slice: 100% 100% 100% 100%;
border-image-width: 1 1 1 1;
border-image-outset: 0 0 0 0;
border-image-repeat: stretch stretch;
font-family: inherit;
font-style: inherit;
font-variant: inherit;
font-weight: inherit;
font-size: inherit;
line-height: inherit;
font-size-adjust: inherit;
font-stretch: inherit;
}
答案 0 :(得分:0)
我已通过添加以下
修复了它div.ColEmpty input[type="text"], select, textarea {
margin-top:0;
position: relative;
line-height:0px;
top: 2px;
margin-bottom: 0px;
}
<div class="ColEmpty">
<asp:DropDownList ID="ddlSubCategory" runat="server" DataSourceID="sqlSubCategory" DataTextField="Name" DataValueField="SubCategoryID"></asp:DropDownList>
</div>