Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a bullet list align with text in css?

Tags:

css

list

enter image description here

The image demonstrates the problem. I want the bullet list to be aligned with the text, not indented.

This must be modified in css i guess, because source is:

            <p>This is a test :)</p>  <ul>  <li>Test1</li>  <li>Test2</li>  <li>Test3</li>  <li>Test4</li>  </ul>  <p><strong>Bla bla</strong></p>  <p><strong>Dette er en test</strong></p>  <p><strong><span class="Apple-style-span" style="font-weight: normal;"><strong>Dette er en test</strong></span></strong></p>  <p><strong>Dette er en test</strong></p>  <p><strong><span class="Apple-style-span" style="font-weight: normal;"><strong>Dette er en test</strong></span></strong></p>         </div>  

So how can I remove the padding/margin from left in this bull list? I tried margin: 0; padding: 0; did not work out

like image 369
Karem Avatar asked Sep 22 '11 14:09

Karem


People also ask

How do you center align a list in CSS?

Just give the list centered text (e.g. ul. nav { text-align: center; } ) and the list items inline-block (e.g. ul. nav li { display: inline-block; } ). If you want to do it with margin for whatever reason, look into width: fit-content; .

Can you align text in CSS?

Center Align Text To just center the text inside an element, use text-align: center; This text is centered.


2 Answers

Apply padding-left: 0 and change the list style position to inside:

ul  {   padding-left: 0; } ul li {    list-style-position: inside; } 

Example link http://jsfiddle.net/vF5HF/

like image 97
NicolaPasqui Avatar answered Oct 04 '22 05:10

NicolaPasqui


ul {     margin-left: 0;     padding-left: 0; } li {     margin-left: 1em; } 
like image 36
Dennis Traub Avatar answered Oct 04 '22 05:10

Dennis Traub