/ Gists / Flex / Grid with border-bottom on each row
On gists

Flex / Grid with border-bottom on each row

CSS CSS trick

example.html Raw #

<!-- 

https://jsbin.com/rekekomexa/1/edit?html,css,output

-->

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  
  <h3>GRID</h3>
  <section class="grid">
    <div>AAA</div><div>AAA</div>
	<div class="line"></div>
    <div>BBB</div><div>BBB</div>
	 <div class="line"></div>
    <div>CCC</div><div>DDD</div>
	 <div class="line"></div>
  </section>
  
  
  <h3>FLEX</h3>
  <section class="flex">
    <div>AAA</div><div>AAA</div>
	<div class="line"></div>
    <div>BBB</div><div>BBB</div>
	<div class="line"></div>
    <div>CCC</div><div>DDD</div>
	<div class="line"></div>
  </section>

</body>
</html>

style.css Raw #



.grid {
  padding: 1rem;
  background: #ddd;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.grid > * {
  background: coral;
  padding: .5rem;
}

.grid > .line {
	grid-column: 1 / -1;
	height: 1px;
	padding: 0;
	background: black;
}



.flex {
  padding: 1rem;
  background: #ddd;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.flex > * {
  background: limegreen;
  padding: .5rem;
  width: calc(50%  - 1.5rem);
}


.flex > .line {
	width: 100%;
	height: 1px;
	padding: 0;
	background: black;
}