html - 在页面中心彼此相邻的位置按钮

标签 html css

我尝试将两个按钮并排放置在页面中央,并在您调整页面大小时使按钮保持静态。

<!doctype html>
<html lang="en">

<head>
<style>
#button1{
width: 300px;
height: 40px;

}
#button2{
width: 300px;
height: 40px;
}
</style>

<meta charset="utf-8">
<meta name="Homepage" content="Starting page for the survey website ">

 <title> Survey HomePage</title>
</head>
<body>

<img src="kingstonunilogo.jpg" alt="uni logo" style="width:180px;height:160px">
 <button type="button home-button" id="button1" >Home</button>
 <button type="button contact-button" id="button2">Contact Us</button>
</body>
 </html>

最佳答案

您可以将此样式添加到您的按钮:

#button1 , #button2 {
display:inline-block;
/* additional code */
}

这会将您的按钮对齐。 ('并排'):)

关于html - 在页面中心彼此相邻的位置按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27671709/

相关文章:

html - 在我们的网站上选中后复选框不显示

css - 将 src 图像隐藏在 <img> 元素中,但显示其背景图像

javascript - 在 D3.JS 中创建元素 block 的最佳方法是什么

html - 最小可行图标代码

css - 将图像添加到 svg 圆圈的底部

html - CSS:在div-container的底部放置一个div-container

javascript - 取消隐藏单选按钮选择上的 Div 标签

html - 添加自定义字体系列并应用于正文时不在 mac safari 上显示字体

html - 为什么 100% 等于 150 像素?

html - 如何设置有序列表的第一个和第二个 child 具有相同的缩进?