You are here: Reference > CSS > properties > browser specific extensions > -webkit-margin-top-collapse

-webkit-margin-top-collapse property

Browser support:
Specifies whether the top and bottom margins can be shared between adjacent elements.
JavaScript page for this property: webkitMarginTopCollapse. You can find other example(s) there.

Possible values:

 One of the following values: 
collapse
Default. Vertical margins are collapsed with the adjacent elements.
discard
Discards the margin.
inherit
Takes the value of this property from the computed style of the parent element.
separate
Default. Separate margins are drawn for the adjacent elements.
Default: collapse.

Example HTML code 1:

This example illustrates the use of the -webkit-margin-top-collapse property:
<head>
    <style>
        .collMargin {
            -webkit-margin-bottom-collapse: separate;
            -webkit-margin-top-collapse: separate;
            margin:20px;
        }
    </style>
</head>
<body>
    <div class="collMargin" style="border:3px solid #000000;">
        The margins are separate
    </div>
    <div class="collMargin" style="border:3px solid #000000;">
        between these two divisions
    </div>
    <div style="border:3px solid #000000;margin:20px;">
        The margins are collapsed
    </div>
    <div style="border:3px solid #000000;margin:20px;">
        between these two divisions
    </div>
</body>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content