Dysan Posted June 12, 2008 Share Posted June 12, 2008 hi, the following code displays a div 100x100 in Internet Explorer, but not in FireFox (108x108). How do I get it to display at 100x100 in both browsers? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style> body { MARGIN: 18px; PADDING: 0px; } div { WIDTH: 100px; HEIGHT: 100px; BORDER: 4px solid rgb(0,0,0); } </style> </head> <body> <div></div> </body> </html> Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 12, 2008 Share Posted June 12, 2008 yeah, borders are treated differently...if only they would all follow the same box model something like this hacks it: div { WIDTH: 92px !important; /* Most browsers use this */ HEIGHT: 92px !important; /* Most browsers use this */ BORDER: 4px solid rgb(0,0,0); WIDTH: 100px; /* IE use this */ HEIGHT: 100px; /* IE use this */ } IE doesn't honor the !important Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.