- AMP:Building Accelerated Mobile Pages
- Ruadhan O'Donoghue
- 134字
- 2021-07-08 10:04:09
Mixing flex and non-flex items
We can also have flex and non-flex items together in the same flex parent. Non-flex items must declare their width and height attributes explicitly, and the remaining space will be divided between the flex items:
<div class="flex-container-row">
<amp-img src="img/placeholder.png" width="250" height="150" layout="fixed"></amp-img>
<amp-img src="img/placeholder.png" height="100" layout="flex-item">
</amp-img>
<amp-img src="img/placeholder.png" layout="flex-item"></amp-img>
<amp-img src="img/placeholder.png" layout="flex-item"></amp-img>
</div>

Mixed flex and non flex items filling a flex container
Note that we are demonstrating these layouts with uniform, square images so that their distortion will show how different layouts will affect components. It is unlikely that you will ever want actual images to distort like this, but it will be useful to know what to expect when applying these layouts to other components, such as amp-fit-text and amp-carousel, that we'll see later.
That's probably enough about flex layouts for now. We'll see how to use this last flex layout later in the chapter.
推薦閱讀
- Learn ECMAScript(Second Edition)
- Django+Vue.js商城項目實戰
- Learning Java Functional Programming
- Intel Galileo Essentials
- Python自動化運維快速入門(第2版)
- 編寫高質量代碼:改善Python程序的91個建議
- C語言程序設計
- Data Analysis with IBM SPSS Statistics
- Web全棧工程師的自我修養
- 21天學通C++(第6版)
- 深入淺出PostgreSQL
- C語言程序設計教程
- NoSQL數據庫原理
- HTML5 APP開發從入門到精通(微課精編版)
- C編程技巧:117個問題解決方案示例