margin-top is a property in CSS, used to set the top margin of an element. All mainstream browsers support the margin-top property. Let’s take a brief look at the usage of the margin-top property.
The syntax of margin-top is as follows:
1 |
|
The value of value has the following possibilities:
auto: The top margin set by the browser.
length: Define a fixed top margin. The default value is 0.
%: Defines the top margin as a percentage based on the total height of the parent object.
inherit: Specifies that the top margin should be inherited from the parent element.
Let’s take a look at a simple code example:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
The running results are as follows:
This article is all over here For more exciting content, you can pay attention to the CSS Video Tutorial column on the PHP Chinese website! ! !
The above is the detailed content of What does margin-top mean?. For more information, please follow other related articles on the PHP Chinese website!