bootstrap-4 - 如何在 Bootstrap 中实现以下布局?
解决方案
干得好...
您只需要更改 CSS 即可获得所需的结果(更改颜色、字体、宽度、高度等),但结构已设置。如果需要,您还可以更改 Bootstrap 类前缀(当前设置为col-sm-
)。
.row {
width: 25vw;
height: 18vh;
}
#price {
color: #000099;
font-size: 3vw;
font-weight: 700;
}
#days {
color: white;
font-size: 2.2vw;
background-color: #000099;
}
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Document</title>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl' crossorigin='anonymous'>
</head>
<body>
<div>
<div class='row'>
<div class='col-sm-9 d-flex justify-content-center align-items-center' id='price'>$16,000</div>
<div class='col-sm-3 d-flex justify-content-center align-items-center text-center' id='days'>63<br> Days</div>
</div>
</div>
</body>
</html>
推荐阅读
- python - 从 db 中获取数据到列表中,用括号 [row1],[row2] python
- ansible - Ansible ssh 连接失败并显示“无法登录:连接被拒绝”
- python - 如何在 python 中为多个模块实现日志记录
- java - Spring Boot @Scheduled fixedDelay 在一段时间后停止工作
- java - 编译基于 Cucumber JUnit 的运行器类
- excel - VBA 将超链接的一部分替换到同一工作簿中的另一个工作表
- javascript - 如何暂停当前正在使用 getusermedia 录制的录制文件?
- azure - 如何正确地将 Azure CDN 端点映射到 blob 存储容器中的 Angular 7 项目
- jquery - 数据表在第二页不起作用
- javascript - 如何从 Node.js 修复 Heroku 网络部署错误(例如:H10)?