-
Notifications
You must be signed in to change notification settings - Fork 19.8k
Description
What problem does this feature solve?
At present, if a component can be set width/height and border and/or pending and left/right/top/bottom, the behavior is not consistent and not straight forward.
Basically, there three box models:
The name of the third one half-border-box is what I made just now. this box model seems to be not straight forward but it is the default behavior of HTML canvas, and widely used in echarts. Consider various graphic (e.g., polygon), content box or border box need complicated calculation but half-border-box is simple and work well in the most cases.
But when we set width/height and border and/or pending and left/right/top/bottom to a "container" or "component", the half-border-box seems to be not easy to understand. Since CSS box model only use border-box and content-box, the half-border-box probably makes users feel it is a bug.
Consider the case below:
Padding follows content-box/border-box rule (in echarts). But border follows half-border-box rule.
BTW, at present in echarts, there are inconsistent:
- if user set
left: 0, top: 0gridandtitleshow half of left-top bordervisualMapandtreemap.breadcrumbshow full border
BTW, at present in echarts, there are facts (just for the record):
titlelegendvisualMaptimelinecan setpendingtitlelegendgridvisualMaptoolbox(and the futurethumbnail) can setbordergridvisualMap(and the futurethumbnail) can setwidth/heightof the container, while the others calculate content according to their content.
What does the proposed API look like?
- For component / container that can set
width/heightandborderand/orpendingandleft/right/top/bottom, useborder-boxrules rather thanhalf-border-box. Component likethumbnailis always placed on the corner and has border, which makes this issue obvious. - Border should not overlay the content.

