<div>
<p>some text before</p>
<input type="checkbox"/> checkbox 1<br/>
<input type="checkbox"/> checkbox 2<br/>
<p>some text after</p>
</div>
Tuesday, September 18, 2007
fixing IE checkbox padding/margin
Support for CSS is built in to every modern browser so theoretically we shouldn't have to deal with too many layout issues. Unfortunately, a lot of browser specific quirks still exist.
One I've dealt with recently is getting a checkbox to line up exactly to the left of a div. Setting the left margin and padding did not work in IE and I was going to try really drastic measures like setting float or absolute positioning until I found a really easy solution. To fix the extra padding for checkboxes in IE, we just need to give the checkbox a fixed width.
I've summarized the results in the table with some screenshots. The markup I want to style is:
22 comments:
Thx ^^
Nice solution
Thanks for the tip Dave, saved me a lot of head-scratching.
thank you, it helped me.
большое спасибо
Thanks for the solution. It's frustrating to make things look the same in different browsers sometimes. Then pages like this are very helpful.
thanks david, much appreciated, i was wondering what was going on with IE, now i have to stop asp.net rendering tables around checkbox lists... uggh
Thanks for that, its been bugging me for ages!!
thanx
GREAT Thanks!
That worked for me, thanks!
Thanks - a similar problem was infuriating me. I wanted to align things vertically, and after reading your post, I tried setting the height of the checkbox. Tada! It works! :)
Thanks, this helped a lot... FYI 12px works better for radio boxes for me...
Thanks for posting, very nice solution! You saved me from ripping out the last hair :)
Thank you buddy , very much appreciated !
This is very useful!
Wow, it seems I tried everything else except that. Thanks a lot!
dlee is wiener
Thanks,,Thanks,,Thanks,,Thanks,,Thanks,, :) :D :PThanks,,Thanks,,Thanks,,Thanks,,Thanks,, :) :D :PThanks,,Thanks,,Thanks,,Thanks,,Thanks,, :) :D :PThanks,,Thanks,,Thanks,,Thanks,,Thanks,, :) :D :PThanks,,Thanks,,Thanks,,Thanks,,Thanks,, :) :D :PThanks,,Thanks,,Thanks,,Thanks,,Thanks,, :) :D :PThanks,,Thanks,,Thanks,,Thanks,,Thanks,, :) :D :P
Just want to add that this is cross-browser solution (tested in FF3-4, latest webkit, IE7-9).
Thanks, fixed height and width in css on the checkbox solved my problem.
Thanks a ton.... it helps...
thanks a bunch. IE11 still has this problem and this saved me some headache
Post a Comment