斑马线, 实现方式
css 选择器中 nth-child() 奇数 偶数 odd even
css 使用线性渐变
background-image:linear-gradient(90deg,#E1DEB0 50%,transparent 50%,transparent);
js 中 个数取 2 的余 然后设置 样式
bootstrap 有现成的
vue 实现 遍历 data 中的数据, 绑定样式 :style 也是取2的余
<li v-for="(item, index) in news" :key="index" :style="{
backgroundColor: index % 2 ? 'pink' : 'skyblue'
}">{{item}}--{{index}}
</li>