html - CSS 网格边距太大,我需要它们来缩放
问题描述
我的代码包括 4 个框,它们应该连接到页面的 4 个角。我正在使用 CSS 网格布局。但是右边和底部的边距太大,我看不到这样做的代码。我有一个完成所有工作的 CSS 文件,以及一个由 CSS 文件操作的索引页面。如何让这个网格布局按比例缩放?
blocks.css--> body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
display: grid;
grid-template-columns: 8ch auto;
grid-template-rows: 200px 200px;
row-gap: 10px;
}
/* blocks
#four
{
border-color: yellow;
border-style: solid;
border-width: 5px;
width: 25%;
text-align: center;
grid-column: 1 / 2;
grid-row: 2;
}
#three{
border-color: orange;
border-width: 5px;
border-style: solid;
width: 25%;
grid-column: 1/ 2;
grid-row: 1;
}
#one{
border-color: blue;
border-style: solid;
border-width: 5px;
width: 25%;
grid-column: 2 / 2;
grid-row: 2;
}
#two {
border-color: green;
border-style: solid;
border-width: 5px;
text-align: center;
vertical-align: top;
width: 25%;
}
#link {
background-color: blue;
color: white;
text-align: center;
width: 25%;
}
index.htm-->-->index.htm-->
<!DOCTYPE html>
<html>
<head>
<title>Blocks</title>
<link type="text/css" rel="stylesheet" href="blocks.css">
</head>
<body>
<div id="one">
Turns out you have a really fun time if you
go to work every day and focus on being
silly and funny and happy! - Hannah Murray
</div>
<div id="two">
All you need in this life is ignorance and confidence,
and then success is sure. - Mark Twain
</div>
<div id="three">
Well, if crime fighters fight crime and fire fighters
fight fire, what do freedom fighters fight? They never
mention that part to us, do they? - George Carlin
</div>
<div id="four">
Great minds discuss ideas; average minds discuss events;
small minds discuss people. - Eleanor Roosevelt
</div>
<p id="link">
<a href="https://www.brainyquote.com/" target="_blank">
Brainy Quote
</a>
</p>
</body>
</html>
解决方案
推荐阅读
- sql - 合并语句插入数据与选择语句 Hana DB
- machine-learning - 如何使用 SKlearn KMeans 模型对未来数据进行编码
- css - 更改为 Bootstrap 默认 Col min-width 会影响响应式设计
- jquery - Jquery输入类型切换功能
- jolt - 来自数组的 JOLT 转换
- delphi - 如何在运行时控制视觉控件的排列?
- sql - 在 VBA 中出现“预期:语句结束”错误
- javascript - 如何在控制台上从 utf 代码编写“键帽数字一个”=1️⃣?
- html - 无法显示此版本的引导程序的日期时间选择器
- ios - 应用程序在应用商店被拒绝,因为苹果登录没有发生