How do I align the 'checkbox' horizontally (even) with the text line? See attached image. Here's the line of code: <input type="checkbox" name="checkbox" value="check" id="agree"/> By uploading a file... Code (markup):
Thanks for your replies. Gary's suggestion worked great, thanks. Can anyone suggest how I can make the actual checkbox look more interesting? Thanks
To change the look of the checkbox, you "cloak" it by setting the actual checkbox to "display: none;" in the CSS, and attaching a proper container to it (normally a label, as they can be linked to the checkbox, and there fore inherit the ":checked" trait. Something like this, perhaps: <input type="checkbox" name="important_checkbox" id="important_checkbox"><label for="important_checkbox">This is a label <span class="mock_checkbox"></span></label> Code (markup): Then you style it something like this: #important_checkbox { display: none; } #important_checkbox + label span { border-radius: 50%; border: 1px solid black; background: blue; width: 1em; height: 1em; margin-left: 1em; display: inline-block; vertical-align: middle; } #important_checkbox:checked + label span { background: green; } Code (markup): You can see this very simple example here: https://jsfiddle.net/mzuc64cz/ You can of course use FontAwesome or images to provide even more fancy versions of the checkbox itself, you can also make proper empty boxes and checkmarked boxes using only CSS. There are plenty of tutorials and examples if you google "fancy checkboxes using only CSS" or similar terms.
Some advice? While @PoPSiCLe's examples are a good approach, I'd suggest hiding them behind a media query so that legacy browsers that can't handle :checked still get something functional. This query: @media (min-width:1px) { Code (markup): Works great for targeting modern browsers only. You can then let legacy browsers get the plain-Jane checkbox.