If you hear the word margin, it is certainly not foreign to operate office software, where margins are used to set the distance between edges or elements or pages or text. Now in this tutorial, we will discuss how to adjust margins with CSS, in this tutorial we will discuss in full how to use margin properties along with other margin derivatives.
Before going forward, there are a number of articles that you might be looking for.
Following is the property-margin property which will be discussed in this tutorial:
margin short property to set all corners of an element in a declaration
margin-top to adjust the upper margin
margin-bottom to adjust the bottom margin
margin-left to adjust the left margin
margin-right to adjust the right margin
The above properties will be discussed along with the use of complete source code to make it easier to understand.
How To Set Margins With CSS
As discussed above, there are several properties that can be used to manage margins with CSS, one of which we will discuss first is the use of short properties that can set all corners of elements in a declaration.
margin: 10px 10px 10px 10px;
The syntax margin above is used to set all the edges of the elements, here is an illustration of each value in the property above.
It can be seen that from each edge of the element has a distance of 10 pixels, here is an example of complete source code adjusting margins with CSS.