html - 消除 3 个不同 div 类之间的差距
问题描述
你好我只是困惑任何人帮助我我试图消除文本之间的这些差距但没有完成请检查代码并使用 CSS 提供工作代码。请帮我消除间隙并将其放在中间。
#DIV_1 {
background-position: 50% 50%;
bottom: 200px;
box-sizing: border-box;
cursor: pointer;
height: 212.938px;
left: 0px;
position: relative;
right: 0px;
text-align: center;
top: -30px;
width: 270.391px;
perspective-origin: 86.6875px 106.469px;
transform-origin: 86.6875px 106.469px;
background: rgba(0, 0, 0, 0) url("https://psdstar.com/wp-content/uploads/2018/06/hd-3d-free-Lotus-Flower-275x155.jpg") no-repeat scroll 50% 50% / auto padding-box border-box;
border-radius: 6px 6px 6px 6px;
font: normal normal 400 normal 16px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
overflow: hidden;
}
/*#DIV_1*/
#DIV_1:after {
box-sizing: border-box;
cursor: pointer;
text-align: center;
font: normal normal 400 normal 16px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
}
/*#DIV_1:after*/
#DIV_1:before {
box-sizing: border-box;
cursor: pointer;
text-align: center;
font: normal normal 400 normal 16px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
}
/*#DIV_1:before*/
#H3_2 {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
height: 130px;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
width: 260.391px;
column-rule-color: rgb(255, 255, 255);
perspective-origin: 86.6875px 65px;
transform-origin: 86.6875px 65px;
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 32px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
margin: 0px;
outline: rgb(255, 255, 255) none 0px;
padding: 68px 0px 25px;
}
/*#H3_2*/
#H3_2:after {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
column-rule-color: rgb(255, 255, 255);
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 32px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
}
/*#H3_2:after*/
#H3_2:before {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
column-rule-color: rgb(255, 255, 255);
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 32px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
}
/*#H3_2:before*/
#H4_3 {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
height: 20px;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
width: 260.391px;
column-rule-color: rgb(255, 255, 255);
perspective-origin: 86.6875px 10px;
transform-origin: 86.6875px 10px;
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 17px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
margin: px 0px 18px;
outline: rgb(255, 255, 255) none 0px;
}
/*#H4_3*/
#H4_3:after {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
column-rule-color: rgb(255, 255, 255);
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 17px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
}
/*#H4_3:after*/
#H4_3:before {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
column-rule-color: rgb(255, 255, 255);
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 17px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
}
/*#H4_3:before*/
#A_4 {
bottom: 0px;
box-sizing: border-box;
color: rgb(255, 255, 255);
display: block;
height: 30px;
left: 0px;
position: relative;
right: 0px;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
top: 0px;
width: 104.031px;
z-index: 10;
column-rule-color: rgb(255, 255, 255);
perspective-origin: 52.0156px 15px;
transform-origin: 52.0156px 15px;
caret-color: rgb(255, 255, 255);
background: rgba(0, 0, 0, 0) linear-gradient(to left, rgb(134, 201, 168), rgb(161, 201, 103)) repeat scroll 0% 0% / auto padding-box border-box;
border: 0px none rgb(255, 255, 255);
border-radius: 30px 30px 30px 30px;
font: normal normal 400 normal 20px / 30px Arial, Abel-Regular, Helvetica;
list-style: none outside none;
margin: 0px 75.6875px 0px 75.6719px;
outline: rgb(255, 255, 255) none 0px;
transition: all 0.2s ease-in-out 0s;
}
/*#A_4*/
#A_4:after {
box-sizing: border-box;
color: rgb(255, 255, 255);
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
column-rule-color: rgb(255, 255, 255);
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 20px / 30px Arial, Abel-Regular, Helvetica;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
}
/*#A_4:after*/
#A_4:before {
box-sizing: border-box;
color: rgb(255, 255, 255);
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
column-rule-color: rgb(255, 255, 255);
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 20px / 30px Arial, Abel-Regular, Helvetica;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
}
/*#A_4:before*/
#DIV_1 {
background-position: 50% 50%;
bottom: 200px;
box-sizing: border-box;
cursor: pointer;
height: 212.938px;
left: 0px;
position: relative;
right: 0px;
text-align: center;
top: -30px;
width: 270.391px;
perspective-origin: 86.6875px 106.469px;
transform-origin: 86.6875px 106.469px;
background: rgba(0, 0, 0, 0) url("https://psdstar.com/wp-content/uploads/2018/06/hd-3d-free-Lotus-Flower-275x155.jpg") no-repeat scroll 50% 50% / auto padding-box border-box;
border-radius: 6px 6px 6px 6px;
font: normal normal 400 normal 16px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
overflow: hidden;
}
/*#DIV_1*/
#DIV_1:after {
box-sizing: border-box;
cursor: pointer;
text-align: center;
font: normal normal 400 normal 16px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
}
/*#DIV_1:after*/
#DIV_1:before {
box-sizing: border-box;
cursor: pointer;
text-align: center;
font: normal normal 400 normal 16px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
}
/*#DIV_1:before*/
#H3_2 {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
height: 130px;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
width: 260.391px;
column-rule-color: rgb(255, 255, 255);
perspective-origin: 86.6875px 65px;
transform-origin: 86.6875px 65px;
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 32px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
margin: 0px;
outline: rgb(255, 255, 255) none 0px;
padding: 68px 0px 25px;
}
/*#H3_2*/
#H3_2:after {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
column-rule-color: rgb(255, 255, 255);
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 32px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
}
/*#H3_2:after*/
#H3_2:before {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
column-rule-color: rgb(255, 255, 255);
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 32px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
}
/*#H3_2:before*/
#H4_3 {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
height: 20px;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
width: 260.391px;
column-rule-color: rgb(255, 255, 255);
perspective-origin: 86.6875px 10px;
transform-origin: 86.6875px 10px;
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 17px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
margin: px 0px 18px;
outline: rgb(255, 255, 255) none 0px;
}
/*#H4_3*/
#H4_3:after {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
column-rule-color: rgb(255, 255, 255);
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 17px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
}
/*#H4_3:after*/
#H4_3:before {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
column-rule-color: rgb(255, 255, 255);
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 17px / normal Arial, Abel-Regular, Helvetica;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
}
/*#H4_3:before*/
#A_4 {
bottom: 0px;
box-sizing: border-box;
color: rgb(255, 255, 255);
display: block;
height: 30px;
left: 0px;
position: relative;
right: 0px;
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
top: 0px;
width: 104.031px;
z-index: 10;
column-rule-color: rgb(255, 255, 255);
perspective-origin: 52.0156px 15px;
transform-origin: 52.0156px 15px;
caret-color: rgb(255, 255, 255);
background: rgba(0, 0, 0, 0) linear-gradient(to left, rgb(134, 201, 168), rgb(161, 201, 103)) repeat scroll 0% 0% / auto padding-box border-box;
border: 0px none rgb(255, 255, 255);
border-radius: 30px 30px 30px 30px;
font: normal normal 400 normal 20px / 30px Arial, Abel-Regular, Helvetica;
list-style: none outside none;
margin: 0px 75.6875px 0px 75.6719px;
outline: rgb(255, 255, 255) none 0px;
transition: all 0.2s ease-in-out 0s;
}
/*#A_4*/
#A_4:after {
box-sizing: border-box;
color: rgb(255, 255, 255);
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
column-rule-color: rgb(255, 255, 255);
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 20px / 30px Arial, Abel-Regular, Helvetica;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
}
/*#A_4:after*/
#A_4:before {
box-sizing: border-box;
color: rgb(255, 255, 255);
text-align: center;
text-decoration: none solid rgb(255, 255, 255);
column-rule-color: rgb(255, 255, 255);
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 20px / 30px Arial, Abel-Regular, Helvetica;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
}
/*#A_4:before*/
<div id="DIV_1">
<h3 id="H3_2">
2000
</h3>
<h4 id="H4_3">
Free Templates
</h4> <a href="https://psdstar.com/new-wallpapers/" rel="nofollow" id="A_4">More</a>
我无法在此处添加长 CSS 代码,因此请检查此 urlv
解决方案
如果要将文本居中到 div 的中间,请删除您在其上设置的所有填充/边距。然后将 flexbox 添加到您的父 div:
display: flex;
justify-content: center;
align-items: center;
推荐阅读
- c# - 从 C# 运行 tabcmd 命令时 Process.Start() 未完成
- objective-c - 如何从代码在 SceneKit 中设置基于物理的渲染?
- jquery - 无法使用 jQuery.toggle() 以编程方式切换(仅关闭)Highchart 的默认上下文菜单
- go - 如何在 Go 中自动生成 Avro 模式?
- java - 提取 .jar 时如何播放音频文件?
- c# - 在 ASP.NET 中使用 MySqlCommand 的 MySQL 语法错误
- r - 在 r 中使用 as.numeric() 时值会发生变化
- c# - 从 C# 中的 SQL Server 参数获取字节数组
- unit-testing - Karma Jasmine:相同的函数名称,两个不同的源文件
- api - HomeBridge eWeLink WebSocketClient:错误'0'(错误:意外的服务器响应(200))