InterviewSolution
Saved Bookmarks
| 1. |
How is margin different from padding in CSS? |
|
Answer» Margin property using which we can create space around the elements. We can also create space for borders defined at the exteriors. We have the following properties for DEFINING the margin:
The padding property is used for generating the space around the element’s CONTENT and inside any known border. The padding also has sub-properties like:
It is to be noted that the padding does not ALLOW negative values. From the below image, we can see that the Margin is the outermost entity of the CSS Box Model that lies outside of the borders whereas the padding lies within the borders. |
|