xerox02 Posted July 13, 2010 Share Posted July 13, 2010 How do I align checkboxes horizontally? Also, if the amount of checkboxes I have exceeds the width or height of a div, how can I set it up so that it will go to the next column or next row. Quote Link to comment https://forums.phpfreaks.com/topic/207569-how-do-i-align-checkboxes-horizontally/ Share on other sites More sharing options...
haku Posted July 13, 2010 Share Posted July 13, 2010 float them all left. They will automatically wrap. Quote Link to comment https://forums.phpfreaks.com/topic/207569-how-do-i-align-checkboxes-horizontally/#findComment-1085219 Share on other sites More sharing options...
xerox02 Posted July 13, 2010 Author Share Posted July 13, 2010 float them all left. They will automatically wrap. That doesn't seem to work : <div id="cat"> <input type="checkbox" name="option3" value="Cheese"> Cheese<br> <input type="checkbox" name="option3" value="Cheese"> Cheese<br> <input type="checkbox" name="option3" value="Cheese"> Cheese<br> <input type="checkbox" name="option3" value="Cheese"> Cheese<br> <input type="checkbox" name="option3" value="Cheese"> Cheese<br> <input type="checkbox" name="option3" value="Cheese"> Cheese<br> </div> #cat { float: left; width:100 px; height:50 px; } Quote Link to comment https://forums.phpfreaks.com/topic/207569-how-do-i-align-checkboxes-horizontally/#findComment-1085222 Share on other sites More sharing options...
haku Posted July 13, 2010 Share Posted July 13, 2010 You have two problems here: 1) You aren't floating the checkboxes left. You are floating the container they reside within left. 2) Even if you float the checkboxes left, the text you have with them will be not go with them. HTML: <div class="form-checkbox"><input type="checkbox" name="option3" value="Cheese"> Cheese</div> <div class="form-checkbox"><input type="checkbox" name="option3" value="Cheese"> Cheese</div> <div class="form-checkbox"><input type="checkbox" name="option3" value="Cheese"> Cheese</div> CSS: .form-checkbox { float:left; } Quote Link to comment https://forums.phpfreaks.com/topic/207569-how-do-i-align-checkboxes-horizontally/#findComment-1085327 Share on other sites More sharing options...
xerox02 Posted July 13, 2010 Author Share Posted July 13, 2010 You have two problems here: 1) You aren't floating the checkboxes left. You are floating the container they reside within left. 2) Even if you float the checkboxes left, the text you have with them will be not go with them. HTML: <div class="form-checkbox"><input type="checkbox" name="option3" value="Cheese"> Cheese</div> <div class="form-checkbox"><input type="checkbox" name="option3" value="Cheese"> Cheese</div> <div class="form-checkbox"><input type="checkbox" name="option3" value="Cheese"> Cheese</div> CSS: .form-checkbox { float:left; } Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/207569-how-do-i-align-checkboxes-horizontally/#findComment-1085379 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.