让盒子中的内容上下左右居中。
在盒子上添加样式
display:flex;
在需要居中的元素上添加:
margin: auto;
即可;
若想让文本上下左右居中:
在盒子上添加:
align-items: center;
justify-content: center;
就可以了;
让盒子中的内容上下左右居中。
在盒子上添加样式
display:flex;
在需要居中的元素上添加:
margin: auto;
即可;
若想让文本上下左右居中:
在盒子上添加:
align-items: center;
justify-content: center;
就可以了;