猿问

有会stylus的吗,问下这段代码怎么用for循环简写

            .opencode[code="01"] {

                background: url(/static/images/theme/cars/car01.png) center no-repeat;

                background-size: cover;

            }

            .opencode[code="02"] {

                background: url(/static/images/theme/cars/car02.png) center no-repeat;

                background-size: cover;

            }

            .opencode[code="03"] {

                background: url(/static/images/theme/cars/car03.png) center no-repeat;

                background-size: cover;

            }

            .opencode[code="04"] {

                background: url(/static/images/theme/cars/car04.png) center no-repeat;

                background-size: cover;

            }

杨魅力
浏览 2089回答 1
1回答

慕姐8265434

for i in 01 02 03 04 05 06 07 08 09 10  .opencode[code={i}]      background: url('/static/images/theme/cars/car' + i + '.png') center no-repeat;      background-size: cover;
随时随地看视频慕课网APP
我要回答