答案 0 :(得分:0)
尝试一下。我想这就是您想要的。
.grid-container {
display: grid;
grid-template-columns: 25% 73%;
grid-gap: 10px;
background-color: #2196F3;
padding: 10px;
}
.grid-container > div {
background-color: rgba(255, 255, 255, 0.8);
text-align: center;
font-size: 30px;
}
.item1,.item2,.item3,.item4
{
height:150px;
}
html
<div class="grid-container">
<div class="item1">1</div>
<div class="item2">2</div>
<div class="item3">3</div>
<div class="item4">4</div>
</div>
尝试一下此w3schools教程here
答案 1 :(得分:-1)
这是一个使用网格可以完成的简单示例。希望对您有所帮助。
.container {
display: grid;
grid-template-columns: 1fr 2fr;
}
<div class="container">
<img src="https://via.placeholder.com/200x200">
<div class="text">
<h1>Header</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vestibulum morbi blandit cursus risus at ultrices mi tempus imperdiet.</p>
</div>
<img src="https://via.placeholder.com/200x200">
<div class="text">
<h1>Header</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vestibulum morbi blandit cursus risus at ultrices mi tempus imperdiet.</p>
</div>
</div>