How does one add additional elements to an existing grid, noting the requirement is they may span multiple cells?
Background:
- Assume using HTML5 and CSS3
- Grid created using div's, formatting using CSS "Grid"
- Grid is already created so want to add the additional blue rectangles overlaid visually onto the grid. The rectangles being Div's with CSS formatting to show them as a blue rectangle
Say start off with HTML/CSS per below. What additional HTML/CSS to add say the first blue rectangle in the first row:
HTML
<div className="wrapper">
<div className="box">Item 1</div>
<div className="box">Item 2</div>
<div className="box">Item 3</div>
<div className="box">Item 4</div>
<div className="box">Item 5</div>
<div className="box">Item 6</div>
<div className="box">Item 7</div>
<div className="box">Item 8</div>
<div className="box">Item 9</div>
</div>
CSS
.wrapper {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
.box {
border-radius: 5px;
border: 1px solid brown;
font-size: 150%;
height: 120px;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…