<template>
<div class="content">
<div v-for="item in 8" :key="item" class="title">{{ item }}-{{ item }}-{{ item }}</div>
</div>
</template>
<script>
export default {
name: "HelloWorld",
props: {
msg: String,
},
data() {
return {};
},
methods: {},
mounted() {},
};
</script>
<style scoped lang="scss">
.content .title:nth-child(odd) {
color: #a31e1e;
font-weight: 600;
}
content .title:nth-child(even) {
color: #380b74;
font-weight: 600;
}
</style>
![](https://i-blog.csdnimg.cn/blog_migrate/2dbed0303c81dd3cdf71abed28733e9d.png)
.el-carousel__item:nth-child(2n) {
background-color: #99a9bf;
}
.el-carousel__item:nth-child(2n + 1) {
background-color: #d3dce6;
}