I have been browsing through various posts on Stack Overflow regarding this issue, but I haven't found a solution that works for me yet. I've tried using the following CSS code to vertically align checkboxes and their labels:
body {
font-family: "lucida grande",tahoma,verdana,arial,sans-serif;
font-size: 11px;
margin: 0;
padding: 0;
}
fieldset {
line-height: 100%;
}
label {
display: inline-block;
vertical-align: baseline;
}
You can view the full HTML code here.
In Safari (5.0.3) and Firefox (3.6.13) on Mac OS X, the checkbox / label pairs are vertically centered correctly. However, in Chrome on Mac OS X, the checkboxes appear slightly higher. On Windows OS, the checkboxes and labels are aligned to the bottom across browsers such as Firefox, Safari, Chrome, and Internet Explorer 8.
Can someone please explain why these discrepancies occur between different browsers and operating systems, and provide a solution to address them?
Update
A workaround to align checkboxes with labels in Chrome on Mac is as follows:
input[type=checkbox] {
position: relative;
top: 1px;
}
Now, I need to implement conditional statements based on the operating system and browser.