Ask Your Question
2

How come min-width cannot be overridden by max-width?

asked 2021-07-10 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-02-20 10:00:00 +0000

bukephalos gravatar image

This is because both min-width and max-width are used to set the boundaries of a container's width.

Min-width sets the minimum width of the container and ensures that it will always be at least that wide, even if the content inside is smaller.

On the other hand, max-width sets the maximum width of the container and ensures that it will never be wider than that, even if the content inside is larger.

So, if both min-width and max-width are used on the same container, they will set the boundaries of its width, and they cannot override each other.

For example, if min-width is set to 500px and max-width is set to 600px, then the container will have a width of at least 500px but will never exceed 600px, regardless of the browser or screen size.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-07-10 11:00:00 +0000

Seen: 9 times

Last updated: Feb 20 '22