子块水平居中小技巧

it2025-01-19  34

子块水平居中小技巧

margin-left: 50%;/* 左外边距 向左移动父块50% */ transform: translateX(-50%);/* 向左移动块自身50% */
最新回复(0)