h2 { display: flex; align-items: center; } h2::after { content: ''; flex: 1; margin-left: 1rem; height: 1px; background-color: #000; }