【发布时间】:2021-12-22 12:43:46
【问题描述】:
如何使父 div (graybox5) 和子 div (outlinebox5) 高度响应,以便灰色和轮廓框始终很好地适合文本?请参阅随附的屏幕截图以了解它现在的样子,您将在框 (div) 的下半部分看到所有额外的空间。我不想要那么多额外的空间,我希望灰色框和轮廓框能很好地环绕文本。
#graybox5 {
width: 100%;
min-height: 375px;
position: relative;
background-color: #F6F6F6;
margin: 20px;
}
#outlinebox5 {
width: 100%;
height: 100%;
position: absolute;
border: 1px solid #252527;
top: -10px;
left: -10px;
z-index: 10;
}
<body>
<div id="graybox5">
<div id="outlinebox5">
<p style="text-align: left; font-weight: 800; margin:20px;">
We were somewhere around Barstow on the edge of the desert when the drugs began to take hold. I remember saying something like I feel a bit lightheaded maybe you should drive. And suddenly there was a terrible roar all around us and the sky was full of what looked like huge bats, all swooping and screeching and diving around the car, which was going about 100 miles an hour with the top down to Las Vegas. And a voice was screaming Holy Jesus! What are these goddamn animals?
</p>
</div>
</div>
</body>
【问题讨论】:
标签: html css parent responsiveness