Ich habe Divs, die auf bestimmte Anzeigen eingestellt sind, um eine Tabelle nachzuahmen. Im Grunde möchte ich den Stil erreichen, der im Bild angezeigt wird, wenn eine Zeile ausgewählt ist. Ich habe Padding und Ränder versucht, aber es scheint nicht zu funktionieren. Hat jemand eine Idee, wie ich das machen kann?Abstand zwischen Zeilen
.table {
display: table;
}
.header {
display: table-header-group;
font-weight: bold;
}
.row {
display: table-row-group;
}
.cell {
display: table-cell;
border: 1px solid black;
padding: 5px;
}
.selected {
background: red;
margin: 20px;
border: 1px solid red;
border-radius: 10px;
}
<div class="table">
<div class="header">
<div class="cell">Header 1</div>
<div class="cell">Header 2</div>
</div>
<div class="row selected">
<div class="cell">Row 1 Cell 1</div>
<div class="cell">Row 1 Cell 2</div>
</div>
<div class="row">
<div class="cell">Row 2 Cell 1</div>
<div class="cell">Row 2 Cell 2</div>
</div>
<div class="row">
<div class="cell">Row 3 Cell 1</div>
<div class="cell">Row 3 Cell 2</div>
</div>
</div>
Wo ist der Code, den du ausprobiert hast? –
Was meinen Sie mit "wenn eine Zeile ausgewählt ist"? Können Sie uns Ihren HTML/CSS-Code zeigen? –
Alternativ mit 'table' statt' div'? Nein :( – nelek