What is the best way to have WebForms ComboBox's width reach to the end of the content

Brian Tan 40 Reputation points
2023-11-13T21:42:35.8733333+00:00

I am currently working with WebForm's ComboBox and I am trying to make it reach to the end of the content.

I currently have the CSS looking like this

.CustomComboBoxStyle .ajax__combobox_textboxcontainer input {     
	background-color: #ADD8E6;     
	border: solid 1px Blue;     
	border-right: 0px none;     
	width: 100%; 
}

but the combobox doesn't reach all the way despite the width being 100%.

How can I make the combo box reach to the end of the content?

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,451 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. XuDong Peng-MSFT 10,426 Reputation points Microsoft Vendor
    2023-11-14T03:55:37.34+00:00

    Hi @Brian Tan,

    As far as I know, this problem may occur due to borders or paddings and margins between page elements. You can try to cancel the element width limit by setting max-width:none;.

    .CustomComboBoxStyle {
        width: 1000px;
    }
    
    .CustomComboBoxStyle input {
        max-width: none;
        background-color: #ADD8E6;
        border: solid 1px Blue;
        width: 100%;
    }
    
    <div class="CustomComboBoxStyle">
    <input type="text" id="CustomInput" name="CustomInput">
    </div>
    

    Result:

    thumbnail_image001

    Best regards,

    Xudong Peng


    If the answer is the right solution, please click "Accept Answer" and kindly upvote. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.