gpt4 book ai didi

html - 在 div 内的 css 中将内容对齐?

转载 作者:太空宇宙 更新时间:2023-11-04 08:04:14 24 4
gpt4 key购买 nike

如何对齐 <span id="milliseconds">00</span>向右?

请看下面的工作代码:

@font-face {
font-family: "Digi";
src: url("fonts/ds-digib.ttf");
}

body {
font-family: Arial;
font-size: 80px;
font-weight: bold;
padding: 40px 0;
}

#container {
display: flex;
flex-direction: row;
justify-content: space-around;
}

#splits {
font-size: 40px;
padding: 0px;
font-weight: normal;
}

#clock {
border: 2px solid #000;
border-radius: 20px;
box-sizing: border-box;
height: 250px;
margin: 0 auto;
padding: 18px 0;
width: 245px;
}

#sphere {
border: 2px solid #000;
border-radius: 20px;
box-sizing: border-box;
font-family: "Digi";
font-size: 80px;
height: 210px;
margin: 0 auto;
padding: 35px 0 0 5px;
position: relative;
width: 220px;
}

#digits {
display: flex;
flex-direction: column;
}
#digits-milliseconds {
font-size: 35px;
}
.leash {
background: rgb(204, 84, 87);
border: 2px solid rgb(134, 59, 61);
height: 50px;
margin: 0 auto;
width: 120px;
}

.leash-top {
border-bottom: 0;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}

.leash-bottom {
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
border-top: 0;
height: 270px;
padding-top: 50px;
}

.hole {
background: #fff;
border: 2px solid rgb(134, 59, 61);
border-radius: 100%;
height: 20px;
margin: 0 auto 50px;
width: 20px;
}

.number {
display: inline-block;
width: 16px;
margin-right: 8px;
}

.btn {
border: 0;
border-radius: 100%;
bottom: 10px;
color: #fff;
cursor: pointer;
height: 50px;
outline: 0;
position: absolute;
width: 50px;
}

.btn.start,
.btn.stop {
left: 10px;
}

.btn.reset,
.btn.split {
right: 10px;
}

.btn.start {
background: #5fca5f;
}
.btn.stop {
background: #f14949;
}
.btn.reset {
background: #908e8e;
}
.btn.split {
background: #0851ab;
}
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Chronometer</title>
<link rel="stylesheet" href="styles.css">
</head>

<body>
<div id="container">
<div id="splits">
<strong>Splits</strong>
<ol id="split-times">
</ol>
</div>
<div class="watch">
<div class="leash leash-top"></div>
<section id="clock">
<div id="sphere">
<div id="digits">
<div>
<span id="minDec" class="number">0</span>
<span id="minCen" class="number">0</span>
<span>:</span>
<span id="secDec" class="number">0</span>
<span id="secCen" class="number">0</span>
</div>
<div id="digits-milliseconds">
<span id="milliseconds">00</span>
</div>
</div>
<button id="btnLeft" class="btn start">START</button>
<button id="btnRight" class="btn reset">RESET</button>
</div>
</section>
<div class="leash leash-bottom">
<div class="hole"></div>
<div class="hole"></div>
<div class="hole"></div>
</div>
</div>
</div>

<script src="chronometer.js" type="text/javascript"></script>
<script src="main.js" type="text/javascript"></script>

</body>

</html>

最佳答案

#milliseconds{
display: block;
text-align: right;
}

关于html - 在 div 内的 css 中将内容对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46785628/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com