Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using box-sizing: inherit in the Universal Selector #41213

Open
MohamadSalman11 opened this issue Feb 7, 2025 · 0 comments
Open

Using box-sizing: inherit in the Universal Selector #41213

MohamadSalman11 opened this issue Feb 7, 2025 · 0 comments

Comments

@MohamadSalman11
Copy link
Contributor

MohamadSalman11 commented Feb 7, 2025

Currently, box-sizing: border-box; is applied to all elements using the universal selector.

Suggestion:
Set box-sizing: inherit; in the universal selector and box-sizing: border-box; on the root element. This will have the same effect as before but it will ensure child elements inherit their parent's box-sizing, providing consistent behavior.

Example:
Imagine we have a .container with child elements inside it. If we set box-sizing: content-box; on the .container, currently in Bootstrap, only the container itself will have content-box, and the children will have border-box.

For consistency, it would be better if we set box-sizing: inherit; in the universal selector. This way, the child elements would inherit the same box-sizing as their parent. So, if the parent is set to content-box, the children will also use content-box,

Currently

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  @if $font-size-root != null {
    @include font-size(var(--#{$prefix}root-font-size));
  }

  @if $enable-smooth-scroll {
    @media (prefers-reduced-motion: no-preference) {
      scroll-behavior: smooth;
    }
  }
}

Maybe Later

*,
*::before,
*::after {
  box-sizing: inherit;
}


:root {
  box-sizing: border-box;

  @if $font-size-root != null {
    @include font-size(var(--#{$prefix}root-font-size));
  }

  @if $enable-smooth-scroll {
    @media (prefers-reduced-motion: no-preference) {
      scroll-behavior: smooth;
    }
  }
}

Check out the file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants