0

It is supposed you can not give a margin top to a inline level element, but I dont have problems here: http://jsfiddle.net/FYUtm/ why?

<label style="margin-left: 40px; display: inline">foobar</label>
tirenweb
  • 30,963
  • 73
  • 183
  • 303
  • without seeing you code, maybe you have a collapsing margin issue. `margin-bottom` on the previous element, and `margin-top` on the element you are talking about. – Mark Aug 12 '13 at 09:56
  • Sorry, I did not see that margin-LEFT, I voted to close the question – tirenweb Aug 12 '13 at 10:02
  • no. don't close the question. maybe other people might benefit from it. – Ali Çarıkçıoğlu Aug 12 '13 at 10:07
  • You don't need to vote to close, you can just delete the question. @AliCarikcioglu benefit from it in what way? It's a typo as the OP has pointed it, there is no problem to solve here. – James Aug 12 '13 at 10:08
  • there is an answer below, that people might benefit. – Ali Çarıkçıoğlu Aug 12 '13 at 10:10
  • possible duplicate of [Why does this CSS margin-top style not work?](http://stackoverflow.com/questions/9519841/why-does-this-css-margin-top-style-not-work) – Mr_Green Aug 12 '13 at 10:17

1 Answers1

2

Vertical margins do not affect inline elements, as stated in the Box Model specification, section 8.3:

Margin properties specify the width of the margin area of a box. The 'margin' shorthand property sets the margin for all four sides while the other margin properties only set their respective side. These properties apply to all elements, but vertical margins will not have any effect on non-replaced inline elements.

rid
  • 61,078
  • 31
  • 152
  • 193