We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
分析两个点: 1、宽度自适应,高度始终为宽度一半;【此处需要记住一个知识点:padding-top/bottom和margin-top/bottom都是相对于父元素的宽度来计算的,参考的是父容器的宽度。】 2、垂直水平居中。【可以利用flex容器水平轴和交叉轴的属性来设置】 <div class="fa"></div>
<div class="fa"></div>
.fa { width: 100%; padding-bottom: 50%; // 高度由 padding 撑开,高度也就相对于父元素宽度 height: 0; // 同时需要将 height 设置为0,这是为了将元素高度完全交给 padding 负责 display: flex; align-items: center;}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
分析两个点:
1、宽度自适应,高度始终为宽度一半;【此处需要记住一个知识点:padding-top/bottom和margin-top/bottom都是相对于父元素的宽度来计算的,参考的是父容器的宽度。】
2、垂直水平居中。【可以利用flex容器水平轴和交叉轴的属性来设置】
<div class="fa"></div>
The text was updated successfully, but these errors were encountered: