The effect we need to achieve: What is needed The styles of 1 picture, 2 pictures, and 3 pictures are different. You can use js to complete the judgment of child elements, but here I use css to complete it Core knowledge points Use CSS selectors to determine child elements example: Use CSS selector to match only one element div { &:last-child:nth-child(1) { // Related styles} } It is easy to understand: the last element under the div is also the first element, so doesn’t it have only one child element? Use CSS selector to match only two child elements div{ &:nth-last-child(2):nth-child(2) { } } Following the same pattern: The second element at the end is also the second element. Doesn’t that mean there are only two elements under this div? Finished Style HTML part <div class="box" v-for="(item,index) in list" :key="index"> <div class="header"> <img :src="item.userImage" alt=""> <span>{{item.name}}</span> </div> <div class="content"> <img :src="v" alt="" v-for="(v, i) in item.imageUrl" :key="i"> </div> <div class="bottom"> <span class="left-icon">{{item.createTime}}</span> <div class="right"> <img src="./img/6.1.png" alt=""> <span>{{item.fabulousNumber}}</span> </div> </div> </div> CSS part .box { padding: 0.26rem; .header { display: flex; align-items: center; img { width: 0.58rem; height: 0.58rem; margin-right: 0.17rem; } } .bottom { display: flex; justify-content: space-between; align-items: center; color: #999999; font-size: 0.17rem; img { width: 0.17rem; height: 0.17rem; } } .content { display: flex; margin: 0.17rem 0; img { flex: 1; height: 1.37rem; width: 0; margin-right: 0.09rem; &:last-child { margin-right: 0; } &:last-child:nth-child(1) { height: 2.75rem; } } } } The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: How to view and set the mysql time zone
>>: JavaScript to implement a simple clock
/******************** * Application of linked lis...
Table of contents Container Hierarchy The process...
Table of contents 1. Test environment 1.1 Hardwar...
1. MySQL download address; http://ftp.ntu.edu.tw/...
Table of contents 1 What is array flattening? 2 A...
I have recently learned web development front-end...
Table of contents 1. Live broadcast effect 2. Ste...
CSS realizes the process navigation effect. The s...
Table of contents Configuration nfs server (nfs.s...
var() Introduction and Usage Details (MDN) IE is ...
1. Documentation Rules 1. Case sensitive. 2. The a...
This article shares the MySQL 5.7 installation an...
Table of contents 1. Use the withRouter component...
Here is a case of modal box dragging. The functio...
Table of contents 1. Database Overview 1.1 Develo...