<html> <head> <style type='text/css'> div { border:1px solid #000; min-width: 50%; } </style> </head> <body> <div>This is some text. </div> </body> </html>
I believe the div should be 50 percent of the page, unless, for some reason, the text inside the div makes it larger. However, the border around the div stretches across the entire page width. This occurs in both IE and Firefox.
Suggestions?
If you provide
absolutepositioning to the element, it will be50%in Firefox. However, IE doesn’t like themin-widthormin-heightattributes, so you will have to define width as50%also for it to work in IE.