The way this works is because if translate is used with a percentage value, its value is calculated based on the elements height/width on which it is applied on.
top, margin-leftleft and margin-top percentage values are calculated based on the parent element or in case the element has position: absolute applied to it based on the nearest parent with position: relative/absolute.
To center an element you just need to apply a value of 50% to either top, margin-leftleft or margin-top and a value of -50% to translate.
For left and margin-left you have to use translateX(-50%) and for the others translateY(-50%).
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
You can haveimages in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
The way this works is because if
translate
is used with a percentage value, its value is calculated based on the elements height/width on which it is applied on.top
,margin-left
left
andmargin-top
percentage values are calculated based on the parent element or in case the element hasposition: absolute
applied to it based on the nearest parent withposition: relative/absolute
.To center an element you just need to apply a value of
50%
to eithertop
,margin-left
left
ormargin-top
and a value of-50%
totranslate
.For
left
andmargin-left
you have to usetranslateX(-50%)
and for the otherstranslateY(-50%)
.You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
See advanced examples further down …
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
See advaaaanced examples further dow
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
See advanced examples further down
ay yo
See advanced examples further down
You can have images in your text field. This is a very rudimentary example, but you can enhance the image plugin with resizing, focus or alignment plugins.
See advanced examples further down