Rather than using images, you could use `repeating-linear-gradient` to create the dots you're after instead? It should resize better. .dot-text { display: flex; font-size: 2rem; /*You'll probably want to do some calcs here to size this custom property with your font size */ --dot-size: 4px; --dot-spacing: 6px; } .dot-text:after { content: " "; flex-grow: 1; background-image: repeating-linear-gradient(90deg, gray 0, gray var(--dot-size), transparent var(--dot-size), transparent calc(var(--dot-spacing) + var(--dot-size))); background-repeat: no-repeat; background-position: bottom 0.45rem left 0.5rem; background-size: 100% var(--dot-size); }
This is some text
Edited to add: To apply different sizes e.g. in your example, set custom properties in the parent element .outer { color: #000; } .outer a { text-decoration: none; color: inherit; } .outer [class^="heading"] { margin-block: 0; font-weight: 400; border-left-width: 4px; border-left-style: solid; display: flex; } .heading1 { --dot-size: 4px; font-size: 23px; line-height: 34px; border-left-color: #000; padding-left: 10px; } .heading2 { --dot-size: 3px; font-size: 19px; line-height: 28px; border-left-color: #006da3; padding-left: 10px; color: #006da3; margin-left: 15px; } .heading3 { --dot-size: 2px; font-size: 17px; line-height: 25px; border-left-color: #2690cd; padding-left: 10px; margin-left: 30px; } .outer [class^="heading"]:after { content: ""; --dot-spacing: calc(var(--dot-size) * 1.5); flex-grow: 1; background-image: repeating-linear-gradient(90deg, gray 0, gray var(--dot-size), transparent var(--dot-size), transparent calc(var(--dot-spacing) + var(--dot-size))); background-repeat: no-repeat; background-position: bottom 0.5rem left 0.5rem; background-size: 100% var(--dot-size); }