skip to Main Content

I want a right-aligned list

<ol>
  <li>Debian</li>
  <li>Ubuntu</li>
  <li>Mint</li>
  <li>elementaryOS</li>
  <li>RedHat</li>
  <li>Fedora</li>
  <li>Slackware</li>
</ol>

2

Answers


  1. try:
    li{
    float:right
    }
    in your css stylesheet

    Login or Signup to reply.
  2. You can achieve this using css and adding the text-align: right; property. To have the bullets follow, we need them to follow the text and being set to inside. That is done with list-style-position: inside;

    ol, ul
    {
        text-align: right;
        list-style-position: inside;
    }
    <ol> 
      <li>Debian 
        <ul> 
          <li>Ubuntu</li> 
          <li>Mint</li> 
          <li>elementaryOS</li>
        </ul> 
       </li> 
       <li> RedHat 
        <ul> 
          <li>Fedora</li>
        </ul>
      </li>
      <li>Slackware</li>
    </ol>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search