Solution 1 :

Please try and do some research – I promise it is super easy.

ul{
  max-width:700px;
  margin:auto;
  list-style: inside;
}
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>

The margin:auto property centres items, providing you have a width.

Solution 2 :

You could place it in a <div> container which is centered using margin:0; and its parent set to display:flex;

Let me know if that works or paste your code.

Your list items <li> needed to have their own closing tags each </li> even these little errors can cause an entire web page to not work also it’s just <br>

Code
<div class="list-container">
<ul>
<li>Stainless steel capacity: 0.5mm</li><br>
<li>Aluminum, copper, zinc, steel capacity: 0.8mm</li><br>
<li>Steel, Plastisol capacity: 0.8mm</li><br>
<li>Length: 310mm</li><br>
<li>Width: 320 - 610mm</li><br>
<li>Closing length: 210mm</li><br>
<li>Weight: 3.3kg</li><br>
</ul>
</div>


then in your head you will need to add this style…

<style>
        .list-container {
            display: flex;
            width: 100%;
        }

        .list-container ul {
            margin: auto;
        }
    </style>

If you are still having issues you can email me at [email protected]

Problem :

I want to centralise the below text but keep the text alignment to the left. i.e. I want to keep the left margin the same size for each line of text:

<li>Stainless steel capacity: 0.5mm<br />
<li>Aluminum, copper, zinc, steel capacity: 0.8mm<br />
<li>Steel, Plastisol capacity: 0.8mm<br />
<li>Length: 310mm<br />
<li>Width: 320 - 610mm<br />
<li>Closing length: 210mm<br />
<li>Weight: 3.3kg<br /></li>

Comments

Comment posted by j08691

Seems like CSS would work just fine here. What have you tried?

Comment posted by chriskirknielsen

Wrap your list in an inline-block container, that should do the trick.

Comment posted by Emma

Sorry I’m completely new to coding. Please could you explain how I would do this with the below code?

  • Stainless steel capacity: 0.5mm
  • Aluminum, copper, zinc, steel capacity: 0.8mm
  • Steel, Plastisol capacity: 0.8mm
  • Length: 310mm
  • Width: 320 – 610mm
  • Closing length: 210mm
  • Weight: 3.3kg
  • Comment posted by Lexan Flowers

    <div class="list-container"> <ul> <li>Stainless steel capacity: 0.5mm</li><br> <li>Aluminum, copper, zinc, steel capacity: 0.8mm</li><br> <li>Steel, Plastisol capacity: 0.8mm</li><br> <li>Length: 310mm</li><br> <li>Width: 320 - 610mm</li><br> <li>Closing length: 210mm</li><br> <li>Weight: 3.3kg</li><br> </ul> </div>

    By