I have a list containing multiple <li>
elements that I need to add margin between each one.
Which of the following options is the best choice? Why is it superior to the other option?
li:not(:last-child) { margin-bottom: 5px; }
or
li:nth-child(n+2) { margin-top: 5px; }
This website indicates that the :not
selector has better browser support compared to :nth-child
. (as :nth-child
does not work in FF3.) Since I am aiming for broad browser compatibility, I seek advice from this knowledgeable community. Are there any specific reasons why one option should be preferred over the other?