Skip to main content

Translate

· One min read
Lex
Front End Engineer @ Baoxiaohe

水平垂直居中

  position fixed  top 50%  left 50%  transform translateX(-50%)  transform translateY(-50%)

Question is this is not useful.I find some blog ,but no get the answer.

translateX 和 translateY 单独拎出来是生效的,但是一起使用却有问题。这是为什么,Oh my god。谁来拯救我。

🆗,i make it with

position fixedtop 50%left 50%transform translate(-50%,-50%)

So,u should to read MDN more( •̀ ω •́ )y