Reputation: 2513
I'm trying to put a simple checkbox inline to the left of a header, i've tried to add the inline css as below but it still does align.
<input type="checkbox" style="display:inline"/><h3>Header Text</h3>
I have a list that i would like the user to select, hence why i would like checkbox next to each one.
Upvotes: 1
Views: 3208
Reputation: 309
h3
tag takes whole width you have to set the CSS style to h3
no need to set for checkbox.
The following code will help you
<input type="checkbox"/><h3 style="display:inline">Header Text</h3>
Upvotes: -1
Reputation: 24559
The h3 element is a block element by default (i.e. 100% width, so it won't fit anything else on that line)
Alter it to inline-block and you'll see that it should work fine (it also means that you can remove the inline styling of the checkbox, as well):
h3 {
display: inline-block;
}
<input type="checkbox" />
<h3>Header Text</h3>
Upvotes: 5