How do you trim boxes within parent boxes (e.g div within div) after extending their margin outwards (using negative values)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do you trim boxes within parent boxes (e.g div within div) after extending their margin outwards (using negative values)?

Consider the code. I want the inner div which is a circle, to be shaped so the sides don't protrude outside parent div. https://code.sololearn.com/WONS6qacXmol/?ref=app

20th Dec 2020, 9:46 PM
Hilary
Hilary - avatar
3 Answers
+ 3
Give overflow: hidden; To the parent element Edit: in your case you also need to give position: relative; to the parent div
21st Dec 2020, 4:22 AM
Krish
Krish - avatar
+ 2
22nd Dec 2020, 9:49 AM
Krish
Krish - avatar
+ 1
Thank you Krish , I appreciate that.
22nd Dec 2020, 9:30 AM
Hilary
Hilary - avatar