Why does margin has not any effect on right side of div tag??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does margin has not any effect on right side of div tag???

Review this code and suggest me how to fix it..... https://code.sololearn.com/W3YO3vl8t5PM/?ref=app

6th Sep 2020, 11:41 AM
saurabh
saurabh - avatar
3 Answers
+ 2
If you set margin:10px; It will applied from all side . But if it is not available horizontally priority will given to the left. And also width is not 100% It is actually 100%+20px(due to padding of 10px in each side.) Some useful tips Read about box-sizing: border-box; property And indivisual margin setting +. Margin shorthand margin: 10px 9px 8px 7px ; Margin-left: 5px; ..... ..... .......
6th Sep 2020, 2:06 PM
Divya Mohan
Divya Mohan - avatar
+ 2
First try to set margin and padding equals zero of body tag in your project.
6th Sep 2020, 2:07 PM
Divya Mohan
Divya Mohan - avatar
+ 1
Try remove width:100%;
6th Sep 2020, 12:15 PM
Ruba Kh
Ruba Kh - avatar