How to set the border length to be smaller than div width with CSS?

Spread the love

Sometimes, we want to set the border length to be smaller than div width with CSS.

In this article, we’ll look at how to set the border length to be smaller than div width with CSS.

How to set the border length to be smaller than div width with CSS?

To set the border length to be smaller than div width with CSS, we set the box shadow to have negative spread.

For instance, we write

box-shadow: 0px 24px 3px -24px magenta;

to set the box shadow spread to -24px to set the border length to be smaller than div width.

Conclusion

To set the border length to be smaller than div width with CSS, we set the box shadow to have negative spread.

Leave a Reply

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