Issues with the inline display of dropdown list and label in Asp.Net

I am currently having an issue with an asp.net dropdown list that has a css class with the following markup:

.form-control {
      display: block;
      width: 100%;
      height: 34px;
      padding: 6px 12px;
      font-size: 14px;
      line-height: 1.42857143;
      color: #555;
      background-color: #fff;
      background-image: none;
      border: 1px solid #ccc;
      border-radius: 4px;
      -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
              box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
      -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
              transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
    }

To align a label next to this dropdown, I added another css class:

.inlineControl {
    display: inline-block;
    vertical-align: middle;
}

The dropdown control includes both classes in its cssClass property, with inlineControl being last to override the form-control class's display: block. However, when viewing it in the browser, the label appears above the dropdown instead of beside it. Upon inspecting the developer tools f12, it shows that the inlineControl class is indeed overriding the form-control class and the display should be inline-block. The computed window also confirms this change.

The markup for the controls looks like this:

<div>
   <label>לקוח</label>
   <asp:DropDownList ID="comboClients" runat="server" CssClass="form-control inlineControl" DataTextField="ClientName" DataValueField="ClientId">

What might be causing the controls to still display as block and what steps can I take to correct this so they appear inline?

Answer №1

It seems like the issue lies with the width being set to 100%. By adjusting it to 90%, the content is now showing correctly.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Struggling to eliminate the scrollbar on a Material UI Dialog

I have a modal window that includes a keyboard, but I'm encountering some issues. Despite adding overflow:'hidden' as inline CSS, the scrollbar refuses to disappear. Furthermore, even when utilizing container-full padding-0 in Bootstrap, th ...

Adjust the positioning of divs to account for changes in scale caused

I have 3 div blocks arranged on a web page, with the first one bigger and located on the left side while the other two smaller ones are positioned on the right side. I want their relative positioning to remain fixed across all browsers and zoom levels. Cur ...

Establishing headings and frames for a collection of Essays

I have integrated a RSS Feed into my Vue.js application to display a series of articles. I want to organize these articles in a container similar to tweets on the left, with a heading labeled Latest Articles. However, when I use a tag in the template sect ...

Is it just me or does this radio button in IE11 look like a pair of googly eyes?

Recently, I noticed a strange issue on a website I'm working on with radio buttons. While everything looks fine in most browsers, in IE11 some of the radio buttons appear like googly eyes. Could this be a bug specific to IE11 or am I missing something ...

Inquiry about C# DataGrid Functionality

I am currently working with a data grid that is being bound to an array in the following manner: myDataGrid.DataSource = vals; myDataGrid.DataBind(); Although the first column displays correctly, I am now looking to add an additional colu ...

Selenium - Step-by-step guide to entering text and clicking a button

Today marks the beginning of my journey with selenium, but I seem to be encountering a hurdle when it comes to locating elements and inputting values in the first one while clicking the second. <input class="inputDefault-_djjkz input-cIJ7To" n ...

Why does React-Perfect-Scrollbar not work properly when the height of an element is not specified in pixels?

Currently, I am developing a chat application with React 18 for its user interface. The app includes a sidebar that displays user profiles. To ensure the app fits within the browser window height, I've made the list of user profiles scrollable when n ...

The color type input is not responding to the onChange event

I have been searching a lot and exploring answers on Stack Overflow, yet I have had no luck. I am trying to retrieve the color value when the color is changed in an input field. Here is the code I am using, could you please assist me in finding out why it ...

Div inexplicably stretches in height

Here is an example of some markup: <div class="account-picture"> <img src="http://i.imgur.com/Mcr3l.png"> </div> The div should be floated to the left and the image size is 128px x 128px. Below is the CSS that goes along with it: ...

Reorder List Items in Collapsible Accordion in Bootstrap 4

I previously attempted to implement the solution provided atHow do I change Bootstrap 3 column order on mobile layout?, however, it only works with bootstrap3. I am looking to rearrange the order of the navbar when it is collapsed on a small screen. Here ...

Using NextJs to pass a prop as a className

I'm having difficulty figuring out how to pass a prop to a className, and I'm questioning whether it's even possible. For instance, if the prop category is passed into the function as "category1", can I use styles.category in the ...

Hovering over one element in Jquery triggers actions on multiple elements simultaneously

I'm working on a project where I have multiple cards, and I've implemented a hover effect using jQuery to make the images inside the cards bigger. However, I'm facing an issue where hovering over one card triggers the effect on all the other ...

Utilize the design elements stored in the database within Django

I have a style stored in my database and I want to use it in a template, but I'm not sure how to do it. models.py class Post(models.Model): # ... body = models.TextField() # HTML style = models.TextField() # CSS # ... views.py ( ...

Variety of part ingredients

In my component, I have a button and include another component which also contains a button. How can I align these two buttons next to each other without using absolute positioning? When I try positioning them using absolute right and top values, the lay ...

What is the method for inserting or passing a city value as a result into the input field with the value attribute set

This code is functioning properly, but the city it generates needs to be registered in #city How can I pass the value #city into an input field? value="cityname" <input id="city" name="input" value="cityname" /> <script> $(document).read ...

How can I resolve the issue of Gmail flagging emails sent from my web server as potential phishing attempts?

I have configured my .net application to send account activation emails. The from address is set to "[email protected]" and the from name is "xyz," which represents our website's domain. Previously, there were no issues when using Google's ...

Utilize ASP to gather information from bulletin board systems

Hey there! I am a beginner in ASP programming and I am looking to extract data from a specific bbs link: http://sports.williamhill.com/bet/en-gb/betting/y/5/tm/Football.html. My plan is to click a button that will take me to the page above and extract th ...

Is it possible to modify the font size of all text that shares a particular font size?

Lately, I've been pondering on a question. A few years ago, I created a website using regular CSS and now I want to make some changes to the font sizes. While I know that CSS variables are the recommended solution for this situation, I'm curious ...

Exploring the Relative Positioning of Two div Elements

Can anyone assist me with finding and comparing the positions of two '<div>' tags using an if statement? I stumbled upon a suggestion in my research, which goes like this: var obstacle = $('#obstacle').css('left', &apo ...

Update the color of navigation items to reflect their active status

Here is the snippet of HTML code: <header> <nav> <a href="#" id="menu-icon"></a> <ul> <li><a href="#"">Home</a></li> <li><a href="#">About</a></li> & ...