I would like to understand a little how css fields work with div and child content.
If I try this ...
<div style="clear: both; margin-top: 2em;"> <input type="submit" value="Save" /> </div>
... the "Save" button is located directly opposite the user role (margin failure):
Margin Fail :( http://img697.imageshack.us/img697/8459/nomargin.jpg
If I changed it to this ...
<div style="clear: both;"> <input style="margin-top: 2em;" type="submit" value="Save" /> </div>
... there is a gap between the "Save" and "User Role" buttons (winning margin):
Margin Win :) http://img20.imageshack.us/img20/1973/yesmargin.jpg
Questions:
Can someone explain what I'm watching? Why not margin divto bring inputdown? Why should I put margin on input? There must be some fundamental css law that I don't understand.
div
input
, div , " ". , select, div, . , , . div float, .. , , 2em- , "". -, , .
select
submit, , , div.
submit
. , - ? . , padding? :
padding
<div style="clear: both; padding-top: 2em;"> <input type="submit" value="Save" /> </div>
. :
, , , . :
<div>one</div> <div>two</div>
:
div { margin: 1em; }
2em. . 8.3.1 :
:block . . , . , . . , , .
, , , , , div, (), , div.
, , , .
, , .
, tbe, . , , .
DIV. DIV , . . :
. , . :
Now you set the marker of the children. This will have a different result. Setting this child does not affect the parent (DIV).