我试图将两个按钮在页面中心彼此相邻放置,并在调整页面大小时使按钮保持静态。

<!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 */
}

这使您的按钮内联对齐。 (“并排”):)

10-04 11:26
查看更多