Jump to content

Default margins and padding for <li> elements? Ignore or overwrite?


Recommended Posts

When I look at <li> elements of an <ol>...</ol> then the space gaps between the <li> lines are more than the "usual" line-height defined in <body> or parent elements.

No special, additional margin or padding values are assigned in CSS.

So I guess there is a default built-in margin-bottom or margin-top or padding-bottom or padding-top value.

What is it?

How can I tell the browser rendering engine to ignore these default built-in values for <li> elements?

Or how do I overwrite them by my own values?




Link to comment
Share on other sites

They are different depending on what browser you use. That is why devs use reset, or normalize css to make it consistent cross browser.

To style a element specifically, say the ul and li for a menu for instance, you would zero margin, padding, list-style-type, text-indent, but make sure it is for the menu only, by using unique identifier id, class or because it is menu only, those ul and li elements within nav element, you then preserve the original styling for unordered listing for future use.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...