You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

实现响应式项目符号文本区块(纯HTML/CSS,无Bootstrap)

Got it, let's fix that text overlapping issue for your bullet-point content block. The problem with your current <span> setup is that spans are inline elements by default—they don't respect line breaks or proper spacing, which causes the overlap. Here's a clean, pure HTML/CSS solution that avoids Bootstrap and gives you the bullet-point layout you want:


This is the most semantic approach since it’s a list of items, and browsers handle the core bullet logic natively.

HTML:

<div class="bullet-container">
  <ul>
    <li>Hello Hello Hello</li>
    <li>Hello Hello Hello</li>
    <li>Hello Hello Hello</li>
    <li>Short text example</li>
    <li>This is a much longer item that should wrap onto multiple lines without overlapping with the bullet or other list entries</li>
  </ul>
</div>

CSS:

.bullet-container ul {
  list-style-type: disc; /* Swap with 'circle' or 'square' for different bullet styles */
  padding-left: 1.8rem; /* Creates space between the bullet and text */
  margin: 0;
}

.bullet-container li {
  margin-bottom: 0.6rem; /* Adds vertical space between list items */
  line-height: 1.5; /* Improves readability for wrapped text */
  word-wrap: break-word; /* Ensures long words don’t overflow the container */
}

Solution 2: Custom Div-Based Block (Full Bullet Control)

If you want total control over the bullet’s appearance (like custom color, size, or even an icon), use divs with CSS pseudo-elements.

HTML:

<div class="custom-bullet-container">
  <div class="bullet-item">Hello Hello Hello</div>
  <div class="bullet-item">Hello Hello Hello</div>
  <div class="bullet-item">Hello Hello Hello</div>
  <div class="bullet-item">Short text example</div>
  <div class="bullet-item">This is a much longer item that should wrap onto multiple lines without overlapping with the bullet or other entries</div>
</div>

CSS:

.custom-bullet-container {
  padding-left: 1.8rem;
}

.bullet-item {
  position: relative;
  margin-bottom: 0.6rem;
  line-height: 1.5;
  word-wrap: break-word;
  padding-left: 0.9rem; /* Space between custom bullet and text */
}

.bullet-item::before {
  content: "•"; /* Use any character/emoji here (e.g., "🔹" for a blue diamond) */
  position: absolute;
  left: 0;
  color: #2d3748; /* Custom bullet color */
  font-size: 1.3rem; /* Custom bullet size */
}

Why This Fixes the Overlap

Both setups use block-level elements (<li> or <div>) which automatically wrap onto new lines when content exceeds the container width. The padding, margin, and line-height properties ensure consistent spacing between bullets, text, and items—no more overlapping, even for long or short content.

内容的提问来源于stack exchange,提问作者user7482719

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 03:45:33