- 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.
推薦閱讀
- Java程序設計與開發
- JavaScript 從入門到項目實踐(超值版)
- Docker技術入門與實戰(第3版)
- 深入實踐Spring Boot
- 動手玩轉Scratch3.0編程:人工智能科創教育指南
- Android 9 Development Cookbook(Third Edition)
- SQL語言從入門到精通
- Easy Web Development with WaveMaker
- HTML5 and CSS3 Transition,Transformation,and Animation
- SQL Server 2016數據庫應用與開發習題解答與上機指導
- HTML5 APP開發從入門到精通(微課精編版)
- Node.js開發指南
- C語言程序設計與應用(第2版)
- JavaScript前端開發基礎教程
- DevOps 精要:業務視角