You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will take the parents height, the elements own height and calculate the distance the element should have from the parents top to be vertically centered. This value is applied to the top margin of the element by default.
23
23
24
24
25
25
Options
26
26
-------
27
27
28
-
You can pass one parameter to the plugin, which is the css attribute that the value should be set on. The default is 'margin-top', but you can pass any attribute you would like. Most probably 'padding-top' or 'top'.
-`onAttribute` - the css attribute that the value should be set on (default: 'margin-top')
31
+
-`verticalOffset` - the number of pixels to offset the vertical alignment by, ie. 10, "50px", -100 (default: 0)
32
+
-`parentSelector` - a selector representing the parent to vertically center this element within, ie. ".parent" (default: the element's immediate parent)
This box is 20% wide and is always vertically centered within its parent, even if the view port changes (resize your window to see the result).
44
+
</p>
45
+
</div>
46
+
47
+
<divclass="box">
48
+
<pclass="second-item">
49
+
This box is 20% wide and is always vertically centered within its parent with a -50px offset, even if the view port changes (resize your window to see the result).
50
+
</p>
51
+
</div>
52
+
53
+
<divclass="box parent">
54
+
<divclass="box2">
55
+
<pclass="third-item">
56
+
This box is 20% wide and is always vertically centered within the specified dark grey parent, even if the view port changes (resize your window to see the result).
0 commit comments