Place a button right aligned

后端 未结 11 1532
礼貌的吻别
礼貌的吻别 2020-12-22 15:56

I use this code to right align a button.

11条回答
  •  时光取名叫无心
    2020-12-22 16:21

    Which alignment technique you use depends on your circumstances but the basic one is float: right;:

    
    

    You'll probably want to clear your floats though but that can be done with overflow:hidden on the parent container or an explicit

    at the bottom of the container.

    For example: http://jsfiddle.net/ambiguous/8UvVg/

    Floated elements are removed from the normal document flow so they can overflow their parent's boundary and mess up the parent's height, the clear:both CSS takes care of that (as does overflow:hidden). Play around with the JSFiddle example I added to see how floating and clearing behave (you'll want to drop the overflow:hidden first though).

提交回复
热议问题