Languages

How to remove left margin with CSS or HTML when I use UL element?

2 points
Asked by:
Marcin
19550

 Is there simple way how to remove left margin from unordered list?

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<body>
  <ul style="border: 1px solid red">
    <li>a</li>
    <li>b</li>
    <li>c</li>
  </ul>
</body>
</html>
1 answer
2 points
Answered by:
Marcin
19550

padding: 0 for ul element should solve the problem

Check the link: https://dirask.com/posts/CSS-remove-UL-list-left-margin-1AvbzD

or below example:

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
  <style>

    ul {
      	padding: 0;  /* <----------------------- required */
    }
    
    li {
      	list-style-position: inside;  /* <------ optional */
    }

  </style>
<body>
  <ul style="border: 1px solid red">
    <li>a</li>
    <li>b</li>
    <li>c</li>
  </ul>
</body>
</html>

 

0 comments Add comment
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join