Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ordered list doesn't increment in firefox 57

Tags:

html

css

firefox

I have an issue in Firefox 57 with ordered lists in html.

The html is dynamically generated, but an example looks like this:

<ol>
  <li>ashdg</li>
  <li>ashdg</li>
  <li>ashdg</li>
</ol>

It has the following CSS

ol{
    margin-top: 0px !important;
    margin-bottom: 0px !important;
    list-style-type: decimal !important;
    list-style-position: inside !important;
}

p, ul, ol {
    padding: 0;
    margin: 0;
    display: inline;
}

The firefox output

FireFox output

Chrome output

enter image description here

like image 336
Christian A Avatar asked Dec 23 '22 12:12

Christian A


2 Answers

2021 Update

The bug, where display: inline causes a reset of the order in ordered lists seems to be fixed in current Firefox Versions! (Tested in Firefox 94, but it is likely that it was fixed way earlier).

Original Answer

This is casued by display: inline, but I don't know why this resets the order of lists in Firefox. I would not say this is intuitive and expected, so in my opinion, it is a bug. If the inline property is not necessary, just remove the ol in your CSS. If it is necesary (because you want them to be in one line), there is a workaround using float instead of display: inline.

ol{
    margin-top: 0px !important;
    margin-bottom: 0px !important;
    list-style-type: decimal !important;
    list-style-position: inside !important;
}

p, ul, /* ol <-- remove this, if not necessary */ {
    padding: 0;
    margin: 0;
    display: inline;
}

/* add this, if necessary */
ol li {
    float: left;
}
<ol>
   <li>ashdg</li>
   <li>ashdg</li>
   <li>ashdg</li>
</ol>
like image 180
Matthias Seifert Avatar answered Dec 26 '22 00:12

Matthias Seifert


Just replace this::

p, ul, ol {
    padding: 0;
    margin: 0;
    display: inline;
}

by::

p, ul, ol {
    padding: 0;
    margin: 0;
}
like image 21
Sonia Avatar answered Dec 26 '22 02:12

Sonia