Sun, 2015-05-17 06:51
Consider the following two lines:
<button id="inputButton">Add text</button> <div id="aDiv" style="float:right; margin-left:-9em">4th div</div>
I am trying to get the div to appear on the same line as the button, to the right of the button, not that far away from the button.
float:right gets it on the same line, but at the other end of the line. Far away from the button, which is left justified.
My lame attempt to move the div by aadjusting margin-left did not work.
Can someone show me how to snuggle that div next to the button?
Sun, 2015-05-17 19:48
#1
Have you considered the display property?
See also MDN Display.
For example:
<button id="inputButton">Add text</button> <div id="aDiv" style="display:inline-block;"> 4th div </div>
cheers,
gary
Sun, 2015-05-17 20:57
#2
Thanks, that did it!
And thanks for the links to tutorials