Chris Abrams
Chris Abrams

Reputation: 42420

Setting element to position absolute causes it to ignore min and max width in CSS

It is as if the width properties are not even there. I have tried just using min or max but that did not work either.

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

Upvotes: 5

Views: 10114

Answers (1)

Jonath Lee
Jonath Lee

Reputation: 46

Position: absolute will make the element choose the min-width only.

Solution: You can try to; 1. Set the current "ul" element's position:relative, the the parent element of this "ul" to to relative as well. Then use the "Top:##px, Left:##px or etc" to change it's size.

Upvotes: 3

Related Questions