- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
所以我有两个按钮,我希望它们间隔均匀。我花了几个小时寻找解决方案,但找不到,所以我需要一些帮助。我的代码如下。
<!DOCTYPE html>
<html lang="en">
<head>
<title>Moocraft's Tic-Tac-Toe</title>
<style type="text/css">
.hv-center {
position: absolute;
top: 50%;
left: 50%;
-moz-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
.playerChoose {
background: #0000ff;
background: linear-gradient(#0000ff, #6b6bff);
border-radius: 5px;
padding: 8px 20px;
color: #ffffff;
display: inline-block;
font: normal bold 24px/1 "Calibri", sans-serif;
text-align: center;
text-shadow: 1px 1px #000000;
}
</style>
</head>
<body style="text-align: center;">
<div id="gameTypePick" style="" class="hv-center">
<button id="randomPlayer" class="playerChoose">
<h1>Random Person</h1>
</button>
<button id="friendPlayer" class="playerChoose">
<h1>Friend</h1>
</button>
</div>
</body>
</html>
无论设备大小如何,我都希望两个按钮均匀分布。如果有人能帮助我,那就太好了!
我试过使用 flex space-between、百分比、垂直高度/宽度。什么都没用。
最佳答案
您可以忽略 hv-center
的样式并尝试这些 flexbox属性:
#gameTypePick {
display: flex;
justify-content: space-evenly; /* Equal gap between elements */
align-items: center; /* Vertical alignment */
height: 100vh; /* You can use height: 100% of the parent container */
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Moocraft's Tic-Tac-Toe</title>
<style type="text/css">
.playerChoose {
background: #0000ff;
background: linear-gradient(#0000ff, #6b6bff);
border-radius: 5px;
padding: 8px 20px;
color: #ffffff;
display: inline-block;
font: normal bold 24px/1 "Calibri", sans-serif;
text-align: center;
text-shadow: 1px 1px #000000;
}
</style>
</head>
<body style="text-align: center;">
<div id="gameTypePick" style="" class="hv-center">
<button id="randomPlayer" class="playerChoose">
<h1>Random Person</h1>
</button>
<button id="friendPlayer" class="playerChoose">
<h1>Friend</h1>
</button>
</div>
</body>
</html>
关于html - 如何均匀间隔div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57939757/
我需要在半径R的圆内生成一个均匀随机点。 我意识到,通过在区间 [0 ... 2π) 中选择均匀随机的角度,并在区间 (0 ... R) 中选择均匀随机的半径,我最终会得到更多的点朝向中心,因为对于两
我想在一个正方形内生成 N 个点(均匀地)。我怎样才能做到这一点? 最佳答案 非常酷的问题,比我想象的要困难得多,但这就是想法。有关于 n 边形的论文,但我只会做正方形。因此,圆的均匀分布是一个常见问
考虑以下示例: import itertools import numpy as np a = np.arange(0,5) b = np.arange(0,3) c = np.arange(0,7)
SQL Server 将一组值分成 5 组,每组的 sum(count) 应该均匀分布。 表仅包含 2 列 rid 和 count。 create table t1(rid int, count in
我有以下简单的 HTML。 A B C 和 CSS: ul { width: 100%; display: flex; flex-direction:
我是一名优秀的程序员,十分优秀!