📜  如何使内联块元素居中 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:32.199000             🧑  作者: Mango

代码示例2
display: inline-block;
  position: relative;
  /* Move the element to the right by 50% of the container's width */
  left: 50%; 
  /* Calculates 50% of the element's width, and moves it by that */ 
  /* amount across the X-axis to the left */
  transform: translateX(-50%);