【发布时间】:2021-09-19 21:43:55
【问题描述】:
我正在尝试在我的模态页面中创建一个网格。我希望关闭按钮单独在一行上,标题/标题在它下面,也单独在一行上。
由于某种原因,我的关闭按钮和标题位于同一行。我以为我的网格模板行会将它们放在不同的行上,但它似乎无法正常工作。
.modal {
height: 100%;
width: 100%;
position: absolute;
top: 0;
background-color: rgba(255, 128, 213, 0.5);
display: grid;
justify-content: center;
align-items: center;
display: none;
}
.modal>.modalContent {
background-color: white;
height: 100%;
width: 75%;
display: grid;
grid-template-rows: 1fr 1fr auto 1fr;
align-items: center;
position: relative;
}
.closeButton {
position: absolute;
top: 0;
right: 14px;
font-size: 50px;
transform: rotate(45deg);
padding: 0%;
cursor: pointer;
background-color: none;
border-style: unset;
grid-row: 1 / 2;
}
.modalContent>.main {
display: grid;
grid-row: 3/4;
grid-template-columns: 1fr 1fr;
}
div>.modalTxt {
width: 80%;
}
.modalContent>div {
padding-left: 10%;
padding-right: 10%;
}
div>.modalImg {
width: 353px;
height: 447px;
}
#title {
background-color: #ff80d5;
font-family: Gill Sans, sans-serif;
text-align: left;
vertical-align: center;
color: white;
font-weight: 100;
block-size: 50px;
display: grid;
flex-wrap: wrap;
align-items: center;
padding-left: 2%;
grid-row: 2 / 3;
}
<div ID="modalAcidFish" class="modal">
<div class="modalContent" ID="modalAcidFishContent">
<div>
<h2 ID="title">Acid Fish</h2>
</div>
<div><span class="closeButton">+</span></div>
<div class="main"><img class="modalImg" ID="modalAcidFishImg" src="Images/Acid Fish 2.jpeg"></div>
<div class="main">
<p>Green was always one of my favorite colors. After seeing watching a woman on tv wear a bold green outfit, I wanted to make a piece inspired by this color. The first time I tried using green as the primary color in one of my works, the painting,
and the color did not come out so well. I sat on the idea of using green despite my first failed attempt. When I first painted some of the canvas, the green was a bit too heavy, so I wet a paper towel and decided to smear some of the paint around
which helped to creat an inkblot affect.
</p>
<p>The next component was thinking of what color paper to use. I dwelled on this for a while, and decided the orange and black printed paper worked perfectly. Not only did the colors pop, the print correleated well with the painted background. In order
to create balance, I thought it was best to keep the overall layout and design of the origami relatively simple, leading me to create two fishes "kissing" or facing each other.
</p>
</div>
</div>
</div>
【问题讨论】:
-
查看
grid-template-areas这将是按预期完成设计的最简单方法。