1

I put within my css file the following rule :

.navbar-form .select2-container ul.select2-choices, .navbar-form .select2-container ul.select2-choices .select2-search-field input { max-width: auto !important; } 

Unfortunately, the rule is barred and in addition of that, this message was displayed :

Invalid property value

In brief, what value can I put ?

4
  • 1
    max-width can't be auto. It has to be some value. Maybe what you want is width:auto, or max-width:none Commented Feb 22, 2016 at 20:26
  • 1
    Please post more code. There isn't enough here to determine whatever it is you are trying to accomplish. "Auto" isn't a valid "Max-width" value. Commented Feb 22, 2016 at 20:26
  • i think i copied the entire rule. So i'd likethat input text takes the entire width Commented Feb 22, 2016 at 20:29
  • if you want it to take the entire width then it is width:100%;max-width:100% Commented Feb 22, 2016 at 20:36

2 Answers 2

3

Here are the valid values

none
- The width has no maximum value.

length
- See length for possible units.

percentage
- Specified as a percentage of containing block's width.

Src: https://developer.mozilla.org/en-US/docs/Web/CSS/max-width

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for using an MDN reference instead of w3schools. A much better resource IMO
1

Max-width cannot be set to "auto". See here, and scroll down to valid Property Values. For max-width, these include:

none : No maximum width (the default)

length : Define maximum width in px, cm, etc.

percent(%) : Define maximum width in percent of the containing block.

initial : Sets the property to its default/initial value.

Typically, max-width can be used together with a width property. So you can say "I want my div.container to have width:100%;, but I also want to 'cap' that width at 1024px, by also setting max-width:1024px;."

This is especially useful for controlling your styles across different devices/breakpoints.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.