📜  如何使 div 居中 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:36.984000             🧑  作者: Mango

代码示例6
EntireBanner: {
    position: "relative",
    backgroundImage: `url(${bgImage})`,
    backgroundSize: "cover",
    backgroundRepeat: "no-repeat",
    width: "100%",
    height: "800px",
  },
  textBox: {
    position: "absolute",
    top: "50%",
    left: "50%",
    transform: "translate(-50%, -50%)",
  },