How to ignore parent padding with CSS?

Spread the love

Sometimes, we want to ignore parent padding with CSS.

In this article, we’ll look at how to ignore parent padding with CSS.

How to ignore parent padding with CSS?

To ignore parent padding with CSS, we set the margin to offset the padding.

For instance, we write

div {
  margin: -10px;
}

to set margin to -10px to offset 10px padding on all sides of the parent.

Conclusion

To ignore parent padding with CSS, we set the margin to offset the padding.

Leave a Reply

Your email address will not be published. Required fields are marked *