Html 如何水平对齐两个按钮

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8346236/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 11:46:52  来源:igfitidea点击:

How to align two buttons horizontally

htmlcss

提问by Jensen

How do I make two button aligned horizontally in a div? I want no space between the two buttons.

如何使两个按钮在 div 中水平对齐?我希望两个按钮之间没有空格。

采纳答案by Savas Vedova

Well, they are by default aligned. Just check thiscode snippet and you'll understand better :) Just make sure to leave no white space between the buttons.

好吧,它们默认是对齐的。只需检查代码片段,您就会更好地理解:) 只需确保按钮之间没有空格。

回答by Leo

Float the buttons and add overflow: hiddento your container : http://jsfiddle.net/SdhQw/

浮动按钮并添加overflow: hidden到您的容器中:http: //jsfiddle.net/SdhQw/

回答by Daniel A. White

You could float them.

你可以漂浮它们。

div button {
   float: left;
   margin: 0;
}