html - css min-width does not work properly -
i'm trying position div centered in div code:
<div style="width:100%; height: 300px; background:red;"> <div style="margin:auto; min-width:50%; height:100%; background:green;">text</div> </div>
it results in big green div that's width 100%. expect 50% though. can tell me why css wont give 50% width , center it?
updated answer
<div style="width:100%; height: 300px; background:red; text-align: center"> <div style="min-width:50%; display: inline-block; height:100%; background:green;">text</div> </div>
Comments
Post a Comment