开发者

What is the benefit to put ol, ul { list-style: none; } in css reset

开发者 https://www.devze.com 2022-12-19 10:40 出处:网络
What is the benefit to put ol, ul { list-style: none; } in css reset . While we only keep list style none
  1. What is the benefit to put ol, ul { list-style: none; } in css reset . While we only keep list style none in Navigation. Due to keep this in 开发者_JAVA百科content if we want normal style of "ordered list" and "unordered list" item then we need to define again.
  2. ok to put ul { list-style: none; } but what is the benefit for ol { list-style: none; }

Link of eric meyer reset


I would say there is no benefit. Put { list-style: none; } where you need it, most often in navigation as you already said.
Defining it to display bullets again is imho the wrong use (unless you want to change the bullet type of course).

And I guess ol is added to just cover all types of lists.


The benefit is to reduce all browsers to the same starting point. From there you can then define your lists how you actually want them because theoretically different browsers may have different defaults.

Remember than list-style is a composite property covering list-style-type, list-style-position and list-style-image. Also list-style-style for unordered lists covers circles, squares, etc but it also applies to ordered lists (roman, greek, etc).


  1. There might not be a benefit, if you're already at list-style: none;

  2. Same benefit as the first.

The point about having a CSS reset of all styles is that you cover all your bases. That doesn't mean you need all of the resets, nor is a global css reset necessarily the best thing to do (some beneficial style defaults are also reset).

It's kind of the nuclear option.


I believe some browsers have it as 'none' by default for <ul> which is probably why it is in the reset. You can of course change the reset to "default" to the 'disc' option and then set it to 'none' manually for navigation.

I expect it is set to 'none' in the reset because they also tend to remove padding from elements and when you remove the padding from a <ul> or <ol> the bullets will go out of the elements block.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号