Container has padding-right and padding-left even if padding: 0 is added
See original GitHub issueWhat package has an issue
Describe the bug
I’m using the latest version of Mantine and the Container
component is receiving padding-right
and padding-left
properties even when padding: 0
is used in the applied class or in the MantineProvider
styles. It only works if px={0}
prop is used.
import { MantineProvider, Container } from "@mantine/core";
export default function App() {
return (
<MantineProvider
withGlobalStyles
withNormalizeCSS
styles={{
Container: {
root: {
padding: 0 // this has no effect
}
}
}}
>
<Container
sx={{
width: 500,
height: 300,
backgroundColor: "#ff00FF20",
display: "flex",
justifyContent: "center",
alignItems: "center",
padding: 0 // this has no effect
}}
px={0} // this works
>
Hello World!
</Container>
</MantineProvider>
);
}
In which browser did the problem occur
Chrome and Firefox
If possible, please include a link to a codesandbox with the reproduced problem
https://codesandbox.io/s/agitated-sutherland-3mjowl?file=/src/App.tsx
Do you know how to fix the issue
No
Are you willing to participate in fixing this issue and create a pull request with the fix
Yes
Possible fix
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
padding-left - CSS: Cascading Style Sheets - MDN Web Docs
The padding-left CSS property sets the width of the padding area to the left of an element.
Read more >Remove default padding-left and padding-right in container ...
The problem is that styles.css should follow bootstrap.min.css in the HEAD tag. Once this is done the .container-fluid padding override ...
Read more >padding | CSS-Tricks
The padding property in CSS defines the innermost portion of the box model, creating space around an element's content, inside of any ...
Read more >CSS Padding - W3Schools
CSS has properties for specifying the padding for each side of an element: padding-top; padding-right; padding-bottom; padding-left.
Read more >CSS Margin vs. Padding: What's the Difference? - HubSpot Blog
If you're new to CSS, you might have heard the words margin and padding but aren't quite sure what they mean, or how...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It is not related to Container, set
padding
prop to 0 insteadYou can fix that by setting defaultProps instead of styles on MantineProvider – https://codesandbox.io/s/sweet-waterfall-51pnky?file=/src/App.tsx
This is an issue with styles priority, I’ll try to fix it with one of the next patches.