简体   繁体   中英

How to get rid of this extra white space for my div?

I create this app with create-react-app cli and I cannot get rid of these extra white spaces at top, left and right side of my main container. Take a look at the screenshot below. I have only one div for this app yet and I have the following css for the div.

 .mainContainer{ display: flex; flex-direction: column; background-color: black; } 

What I have tried is setting both margin and padding for 0px, but neither of them works.

在此处输入图片说明

html, body { margin: 0; padding: 0 }

You can right-click on the page, select Inspect and you will be able to see where this margin/padding is coming from. A console will appear, move your mouse over the HTML elements to see a color overlay over the page element. You will be able to see what CSS is doing this and adjust it.

I think you will be able to get rid of it by doing this .mainContainer { padding: 0, margin: 0 } but maybe you will only have to reset the padding or the margin, not both.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM