html - 问题在复选框中间居中文本
问题描述
我试图将文本置于复选框中间,但文本位于顶部。
我将在这里留下完整的代码
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<head>
<style>
input {
display: inline-block;
vertical-align: top;
padding-left: 25px;
position: relative;
}
input {
position: absolute;
left: 0;
top: 0;
}
</style>
</head>
<body>
<input class="w3-check" type="checkbox"><span>text</span></input>
</body>
</html>
如您所见,文本未居中,我该怎么办?
解决方案
这里是。
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<head>
<style>
.w3-check,
.w3-radio {
vertical-align: top;
top: unset;
}
.w3-check span,
.w3-radio span {
vertical-align: middle;
}
</style>
</head>
<body>
<input class="w3-check" type="checkbox"><span>text</span></input>
</body>
</html>
推荐阅读
- node.js - 本机库绑定文件 - 路径不正确
- java - Android Studio 井字游戏
- oracle - 现有 Oracle RDS 数据库的逆向工程 CLI
- java - 多线程模式下的快速文件处理
- amazon-web-services - 无法连接到 EC2 实例
- asp.net-core - 在 asp.net core razor 页面中使用带有部分视图的 DI
- android - Android 应用程序的数据库控制模型
- python - 如何在python中从用户那里获取二维列表?
- kiwi-tcms - 在 docker 项目中配置 Postgre DB
- r - 如何使 scale_y_reverse 与 scale_y_time 一起工作