我在每个按钮周围放置一个div,并将它们设置为内联。他们只是想堆叠,因为我一直试图把它们集中起来。如何垂直居中按钮?
这是我的HTML:
body{
\t background-color:black;
}
#light{
\t margin-left:50%;
\t margin-right:70%;
}
#dark{
\t margin-left:50%;
\t margin-right:50%;
\t display:inline-block;
}
\t
h3{
\t color:white;
\t font-family:Courier New;
\t font-size:24px;
\t margin-left:500px;
}
<!DOCTYPE html>
<html>
<head>
<title>question reality.</title>
<link rel="stylesheet" type="text/css" href="intro page.css">
</head>
<body>
<h3>make your choice.</h3>
<div id="light"><button>Light</button></div>
<div id="dark"><button>Dark</button></div>
</body>
</html>
这是什么这个东西是做撷取画面:
使用文本对齐:中心财产代替保证金的左,右,并给予尝试 –
请参考此链接:https://stackoverflow.com/questions/396145/how-to-vertically-center-a-div-for-all-browsers。它有一个更好的方式来处理这个问题。 – Sujith
可能重复[如何垂直居中所有浏览器的div?](https://stackoverflow.com/questions/396145/how-to-vertically-center-a-div-for-all-browsers) – NewUser