我有一个简单的用例:项目标题和描述。标题应出现在说明上方,我希望标题确定整个列的宽度,也适用于“说明”行。
CSS 网格可以实现这一点吗?如果可以,如何实现?
这是所需的输出:
这就是代码,基本上是:
.grid-container {
display: grid;
grid-template-columns: 1fr;
}
Run Code Online (Sandbox Code Playgroud)
<div class="grid-container">
<div class="A">
DIV A contains the TITLE
</div>
<div class="B">
DIV B has much more text but I want its text to wrap to the width of div.A (no cut of words, just wrapping)
</div>
</div>
Run Code Online (Sandbox Code Playgroud)