Reputation: 95
How to style this div both with a min-width and width
css
#diva {
position: relative;
margin: 0 auto;
min-width: 75px;
width: auto;
height: 50px;
padding: 4px;
color: white;
background-color: red;
}
html
<div id="diva">
hello
</div>
When i set width to auto, this div occupies the full page width.
Upvotes: 0
Views: 578
Reputation: 567
display:inline-block;
Just add display:inline-block; to the styles for the div. That should work :)
Upvotes: 1