http://jsbin.com/ofojis/edit#preview
http://jsbin.com/ofojis/edit#source
- Why is the top border of this inline element not displaying?
- Adding
float:leftpushes this inline element down and it renders
well. How doesfloat:leftactually push it down, isn’t it
supposed to push an element to the left? - Also, are you not supposed to use the margin property on inline
elements like<span>?
Technical explanation of how outline, border and padding are rendered in this example? ? 🙂
Because
<span>is aninlineelement, and the positioning ofinlineelements starts from the top-left of the padding (not counting the border and margin).float: leftappliesdisplay: inline-block, which means that it’s no longerinline. The positioning forinline-blockelements starts from the top-left of the margin.You can use
marginon a<span>but it won’t do anything useful 😛