[英]Keep html buttons at the top of a div
The html buttons behave very diferently in firefox and chrome. html按钮在firefox和chrome中的表现非常不同。 Take this example http://jsfiddle.net/nuu1bfe2/ .
以这个例子http://jsfiddle.net/nuu1bfe2/为例。
<div>
<button>hi</button>
<button>hi<br/>you, there</button>
</div>
In firefox they are placed in the bottom of the parent but in chrome they are placed in the top. 在firefox中,它们被放置在父级的底部,但是在chrome中它们被放置在顶部。 How do I make sure that the buttons are always placed in the top.
如何确保按钮始终位于顶部。
You can use vertical-align: top
: 你可以使用
vertical-align: top
:
The vertical-align CSS property specifies the vertical alignment of an inline or table-cell box.
vertical-align CSS属性指定内联或表格单元格框的垂直对齐方式。
top
最佳
Align the top of the element and its descendants with the top of the entire line.
将元素及其后代的顶部与整条线的顶部对齐。
div button { vertical-align: top; }
<div> <button>hi</button> <button>hi <br/>yuo, there</button> </div>
Reference 参考
<style type="text/css">
button{
vertical-align:top;
}
</style>
Add css in your html. 在你的HTML中添加css。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.