Question

I have some labels aligned horizontically with textboxes and dropdown lists. A gap appears between the dropdowns and the textboxes. If I inspect element it shows me the css file of the portal which does not include information of what is causing the gap/vertical space which I would like to reduce. What I want is to override those settings on the module level.

On the screenshot, I highlight the style with the 'web developer' tool on firefox. The gap between the dropdown list appears.

the gap between the dropdown list appears

 <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>

My styles:

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;
}

Clicking on the Display Style information I get the following:

/* 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;
}
Was it helpful?

Solution

I have fixed it by adding the following

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top