.container { width: 100%; /* 容器宽度 */ display: flex; /* 设置display属性 */ justify-content: center; /* 设置水平对齐方式 */ align-items: center; /* 设置垂直对齐方式 */ } .card { width: 80%; /* 卡片宽度 */ display: flex; /* 设置display属性 */ flex-direction: column; /* 设置主轴方向为垂直方向 */ align-items: center; /* 设置垂直对齐方式 */ } .card img { width: 100%; /* 图片宽度 */ height: auto; /* 图片高度自适应 */ } .card h3 { font-size: 24px; /* 字体大小 */ margin-top: 20px; /* 上边距 */ margin-bottom: 10px; /* 下边距 */ } .card p { font-size: 16px; /* 字体大小 */ color: #666; /* 字体颜色 */ line-height: 1.5; /* 行高 */ text-indent: 2em; /* 首行缩进 */ }
使用CSS网页布局在线软件,大家可以非常方便地实现页面布局。通过对CSS样式的修改,还可以做出丰富多彩的界面效果。尤其对于初学者来说,使用这种工具可以帮助其更好地理解CSS布局的原理和实现方式。