Setting an element to an absolute position causes it to ignore the minimum and maximum width in CSS

As if the width properties do not even exist. I tried using min or max, but that didn't work either.

ul {
    background: #333;
    color: #fff;
    min-height: 20px;
    position: absolute; top: 95px; left: 0;
    min-width: 230px; max-width: 460px;
}
+5
source share
1 answer

Position: The absolute element will select only the minimum width.

Solution: you can try; 1. Set the current position of the element "ul": relative, the parent element of this "ul" is also relative. Then use "Top: ## px, Left: ## px or etc" to resize it.

+4
source

All Articles