Skip to content

"Broken" Box-Model #168

@dmcass

Description

@dmcass

I'm curious about the reasoning for using the word "broken" in the definition of this rule. While I understand that setting something like the below could cause confusion to a newcomer to css, anyone who has experience will understand how the box-model works using the default box-sizing: border-box.

/* Throws box-model warning */
.selector {
    width: 89px;
    height: 89px;
    padding: 10px;
    border: 1px solid #000;
}

By the definition of the CSS specification, this is not "broken." The padding and the border are intended to be included in the given width and height of the element, meaning that the .selector element will be 100px in width and height total.

Is the reasoning for this to remove the need for basic addition and subtraction? Or perhaps to assist newcomers in understanding how the box-model works by default?

My only issue with this rule is the wording; in the same way that the rule may assist those who are unfamiliar with the default box-model, it can hurt them by making them think that no browsers follow the spec correctly by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions