How to align checkboxes and their labels consistently cross-browsers

前端 未结 30 2262
有刺的猬
有刺的猬 2020-11-22 05:56

This is one of the minor CSS problems that plagues me constantly. How do folks around Stack Overflow vertically align checkboxes and

30条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 06:13

    I don't like relative positioning because it makes element rendered above everything else on its level (it can get on top of something if you have complex layout).

    I've discovered that vertical-align: sub makes checkboxes look good enough aligned in Chrome, Firefox and Opera. Can't check Safari since I don't have MacOS and IE10 is slightly off, but I've found it to be good enough solution for me.

    Another solution might be to try and make specific CSS for every browser and fine-tune it with some vertical-align in %/pixels/EMs: http://css-tricks.com/snippets/css/browser-specific-hacks/

提交回复
热议问题