Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7998893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:20:42+00:00 2026-06-04T15:20:42+00:00

When I reduce the width of my browser window, select elements within the fieldset

  • 0

When I reduce the width of my browser window, select elements within the fieldset does not reduce in size despite the max-width command:

<fieldset style="background:blue;">
<select name=countries style="max-width:90%;">
 <option value=gs>South Georgia and the South Sandwich Islands</option>
</select>
</fieldset>

However, this works perfectly outside fieldset element. How do I make the select elements shrink to the max-width (percentage) within the fieldset?

Note: I have tested both Firefox 12.0 and Google Chrome. I am now sure that it is a cross-browser problem.

Clarification: Please refer to this example and note the difference between the behaviour of a select element inside a fieldset and another outside the fieldset. What I want to achieve is for the select element within the fieldset to behave like the one outside the fieldset element.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:20:43+00:00Added an answer on June 4, 2026 at 3:20 pm

    The problem

    This isn’t possible, at least if you only use max-width (see below for solution). <select>s are always a little bit tricky to style, as they’re interactive content elements and form control elements. As such, they have to follow some implicit rules. For one, you cannot make a select less wide than one of its options when using max-width. Think of the following scenario:

    +------------------------------------+-+
    |Another entry                       |v|
    +------------------------------------+-+
    |Another entry                         |
    |Select box, select anything, please   |
    |Another entry                         |
    |Another entry                         |
    +------------------------------------+-+
    

    Let’s say that you want to squeeze this <select> – what will happen? The select’s width will get lesser, until…

    +------------------------------------+-+   +-----------------------------------+-+
    |Another entry                       |v|   |Another entry                      |v|
    +------------------------------------+-+   +-----------------------------------+-+
    |Another entry                         |   |Another entry                        | 
    |Select box, select anything, please   |-->|Select box, select anything, please  | 
    |Another entry                         |   |Another entry                        | 
    |Another entry                         |   |Another entry                        | 
    +------------------------------------+-+   +-----------------------------------+-+ 
                                                       |
               +---------------------------------------+
               v
    +----------------------------------+-+   +---------------------------------+-+
    |Another entry                     |v|   |Another entry                    |v|
    +----------------------------------+-+   +---------------------------------+-+
    |Another entry                       |   |Another entry                      | 
    |Select box, select anything, please |-->|Select box, select anything, please| 
    |Another entry                       |   |Another entry                      | 
    |Another entry                       |   |Another entry                      | 
    +----------------------------------+-+   +---------------------------------+-+ 
    

    And then the process will stop, as the <option>s wouldn’t fit anymore. Keep in mind that you can’t style <option>s or at least only a little bit (color, font-variant) without getting some nasty quirks. However, the border-box can be changed, if the select is prepared correctly:

    The solution

    Use a width value on the select. Yep, it’s easy as that:

    <fieldset style="background:blue;">
     <select name=countries style="width:100%;max-width:90%;">
      <option value=gs>South Georgia and the South Sandwich Islands</option>
     </select>
    </fieldset>
    

    Why does this work? Because the option will now recognize the width of the select correctly and won’t force the select to have a implicit min-width. Notice that the width is absurd, as it is more than the max-width. Most browsers won’t care and use the max-width in this case, as it provides an upper bound.

    JSFiddle Demo (works in FF12, Chrome 18, IE9, Opera 11.60)

    Edit

    Wrapper based solution, this won’t change the original width:

    <fieldset style="background:blue;">
    <div style="display:inline-block;max-width:90%;"> <!-- additional wrapper -->
     <select name=countries style="width:100%">
      <option value=gs>South Georgia and the South Sandwich Islands</option>
     </select>
    </div>
    </fieldset>
    

    JSFiddle Demo (works in browsers listed above)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I reduce the textbox width without using classes? <input type=text maxlength=5 style=3px/>
I'm writing a style sheet, and I want to display three elements horizontally (width=33%)
I have a menu that works on large screens but when the browser size
While trying to reduce the HTML size of a web page, I've come across
CSS #header { width:90%; } #bakeryintro { width:40%; } .bakeryintro1 { font-size:350%; } .bakeryintro2
I recently encountered with this question: How to reduce this expression: s>73?61:60; . The
I am trying to parallel a classic map-reduce problem (which can parallel well with
Map Reduce is a pattern that seems to get a lot of traction lately
I am trying to reduce some code here. I will explain how I have
I have this as my CSS styling. My #pg_wrap is not centering with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.