没有列表的子弹式列表

Ole*_*ers 2 css jquery

我有以下 html 代码

<div class="magicbullets">
Nice
awesome
cool
</div>
Run Code Online (Sandbox Code Playgroud)

我需要它表现得像

<div class="magicbullets">
<ul>
<li>nice</li>
<li>aweseome</li>
<li>cool</li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)

我可以环绕<ul></ul>内容,但我不能逐行修改内容本身(nice、awesome、cool)。我只需要选择使用 CSS 来实现我想要的。

我设法创建了所需的新行

.magicbullets {
     white-space: pre-line;
} 
Run Code Online (Sandbox Code Playgroud)

对于每个条目,但list-style-type没有列表就无法真正工作。

总结一下,它应该是这样的:

  • 好的
  • 惊人的
  • 凉爽的

这是使用纯 CSS可行还是需要某种客户端代码(JS、jQuery)或服务器代码(PHP)?

sol*_*sol 5

您可以使用 CSS 背景属性生成图案,然后将其放置在您需要的位置。

.magicbullets {
    white-space: pre-line;
    position: relative;
    margin-left: 1em;
} 

.magicbullets::before {
  position: absolute;
  content: "";
  display: block;
  height: 60px;
  width: 30px;
  top: 16px;
  left: -32px;
  background: radial-gradient(circle, black 10%, transparent 10%), 8px;
  background-size: 40px 20px;
}
Run Code Online (Sandbox Code Playgroud)
<div class="magicbullets">
Nice
awesome
cool
</div>
Run Code Online (Sandbox Code Playgroud)

您可以随意使用数字来获得子弹。