1

Ideally I'd like to solve this problem with pure CSS, but I'd imagine this likely needs JS to be solved

I have a long unordered list, with bullets between them, which looks like this: enter image description here

I have styled it like this:

.names li:not(:last-child):after {
    font-weight: lighter;
    content: "\25CF";
    color: #C70039;
}

.names ul li { display: inline; white-space: pre; }
.names ul li:last-child:after { content: ""; }

.names {
    margin-right: 15%;
    margin-left: 15%;
    padding: 0;
    text-align: justify;
    display: inline-block;
}

.names li {
    display: inline;
}

How can I stop the bullets appearing at the edge like that? Keeping in mind it needs to be responsive

azr481
  • 45
  • 1
  • 6

1 Answers1

1

Remove the padding from the <ul>, and set the overflow to hidden. Use ::before on all list items to display the red dot, and also set a fixed width of 1em to the ::before. Now use position: relative and left: -1em on the <li> items to hide the red dot on the left side.

.names li::before {
  display: inline-block;
  width: 1em;
  font-weight: lighter;
  content: "\25CF";
  color: #C70039;
}

.names ul {
  padding: 0;
  overflow: hidden;
}

.names ul li {
  position: relative;
  left: -1em;
  display: inline;
  white-space: pre;
}

.names {
  margin-right: 15%;
  margin-left: 15%;
  padding: 0;
  text-align: justify;
  display: inline-block;
}
<div class="names">
  <ul>
    <li>Calvin Manning</li>
    <li>Zachariah Little</li>
    <li>Stephanie Lowery</li>
    <li>Tori Lynn</li>
    <li>Lucas Hogan</li>
    <li>Tristian Thornton</li>
    <li>Madison Preston</li>
    <li>Azul Robertson</li>
    <li>Ulises Pruitt</li>
    <li>Jayleen Roth</li>
    <li>Aylin Burgess</li>
    <li>Lukas Roman</li>
    <li>Aden Crawford</li>
    <li>Alexzander Fitzgerald</li>
    <li>Gustavo Dyer</li>
    <li>Allyson Gates</li>
    <li>Tia Munoz</li>
    <li>Ignacio Mcconnell</li>
    <li>Blaze Shelton</li>
    <li>Quentin Hebert</li>
    <li>Kirsten Bowen</li>
    <li>Ryan Nelson</li>
    <li>Giovanny Rowland</li>
    <li>Audrey Costa</li>
  </ul>
</div>
Ori Drori
  • 183,571
  • 29
  • 224
  • 209