CSS: Control space between bullet and li
Put its content in a span
which is relatively positioned, then you can control the space by the left
property of the span
.
li span {
position: relative;
left: -10px;
}
<ul>
<li><span>item 1</span></li>
<li><span>item 2</span></li>
<li><span>item 3</span></li>
</ul>
How is it possible to modify the gap between a bullet and its list text?
The only way I've been able to achieve this [decreasing the native browser rendered spacing of the li] is by adding additional markup to your li
and setting a negative margin.
As an example:
Markup:
<ul>
<li>
<span>This is the text</span>
</li>
</ul>
CSS
li span { margin-left: -10px; }
This could add quite a bit of extra unnecessary markup for such a small requirement. You'd be better of using a background image on your li
element which offers better position control without all the extra markup.
CSS - space between the bullet and the list without padding the list
Have you considered using a pseudo element?
This process can offer complete control over the bullets position and shape.
li {
list-style: none;
position: relative;
}
li::before {
content: '•';
position: absolute;
left: -30px;
}
<ul class="list">
<li>A</li>
<li>B</li>
<li>C</li>
</ul>
Remove space of the bullet when list-style-type: none is used
Use list-style-position:inside
li.title {
list-style-type: none;
margin-left: 0;
padding-left: 0;
}
ul {
list-style-position: inside
}
<ul>
<li class="title">Title</li>
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
Spacing between bullet list rows
Add top
and bottom
padding to the li
s, like so:
ul li { padding: 5px 0px; }
And take out that crazy looking <p />
tag.
Demo: http://jsfiddle.net/aFED2/
Related Topics
Margin-Top Percentage Does Not Change When Window Height Decreases
Make Text in Select Element Wrap When Too Long
Nginx Failing to Load CSS and Js Files (Mime Type Error)
Why Selecting by Id Is Not Recommended in CSS
Create Line After Text with CSS
How to Display CSS3 Columns on Ie
Different Behaviours of Treating \ (Backslash) in the Url by Firefox and Chrome
Page-Break-* Doesn't Work on Google Chrome
Why Doesn't Font Awesome Work in My Shadow Dom
Css3Pie in MVC, Where to Place the Pie.Htc File
Gradient Over Instagram Svg of Fontawesome 5
Input[Type=Number] Placeholder Color in Ff29+
How to Increase the Bullet Size in a Li
Make a CSS Triangle/Arrow Grow When Its Parent Div Is Resized
Set the Width of Select2 Input (Through Angular-Ui Directive)