Asked • 03/18/19

Placing border inside of div and not on its edge?

I have a `
` element and I want to put a border on it. I know I can write `style="border: 1px solid black"`, but this adds 2px to either side of the div, which is not what I want. I would rather have this border be -1px from the edge of the div. The div itself is 100px x 100px, and if I add a border, then I have to do some mathematics to make the border appear.Is there any way that I can make the border appear, and ensure the box will still be 100px (including the border)?

1 Expert Answer

By:

James C. answered • 04/10/20

Tutor
5 (14)

Computer Science Instructor | Here to Help with All Things Web!

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.