解决需求:更改ant design的a-carousel走马灯组件样式问题

需求样式

问题解决:

html部分:

<a-carousel arrows>
          <div slot="prevArrow" class="custom-slick-arrow" style="left: 10px; z-index: 1">
           // 左箭头
            <div class="circle">
              <a-icon
                type="left"
                style="
                  color: #f5222d;
                  height: 50px;
                  font-size: 25px;
                  text-align: center;
                  display: flex;
                  align-items: center;
                  justify-content: center;
                "
              />
            </div>
          </div>
          <div slot="nextArrow" class="custom-slick-arrow" style="right: 10px">
          // 右箭头
            <div class="circle">
              <a-icon
                type="right"
                style="
                  color: #f5222d;
                  height: 50px;
                  font-size: 25px;
                  text-align: center;
                  display: flex;
                  align-items: center;
                  justify-content: center;
                "
              />
            </div>
          </div>
          <div>
            <h3>
这里是分页1
            </h3>
          </div>
          <div><h3>这里是分页2</h3></div>
          <div><h3>这里是分页3</h3></div>
          <div><h3>这里是分页4</h3></div>
        </a-carousel>

css部分:

// 左右箭头
.ant-carousel >>> .slick-slide {
  text-align: center;
  /* height: 160px; */
  line-height: 160px;
  background: rgb(255, 255, 255);
  overflow: hidden;
}

.ant-carousel >>> .custom-slick-arrow {
  width: 50px;
  height: 50px;
  font-size: 50px;
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 50px;
  opacity: 1;
  box-shadow: 0px 0px 5px 3px rgba(0, 0, 0, 0.05)
}
.ant-carousel >>> .custom-slick-arrow:before {
  display: none;
}
.ant-carousel >>> .custom-slick-arrow:hover {
  opacity: 0.5;
}
// 所有页面下标
.ant-carousel >>> .slick-dots li {
    margin: 24px 1px;
  background: #ffeff0;
}
.ant-carousel >>> .slick-dots li button {
  background: #f5222d;
}
// 当前选中页面的下标
.ant-carousel >>> .slick-dots li.slick-active {
  background: #f5222d;
  opacity: 1;
}
.ant-carousel >>> .slick-slide h3 {
  color: #fff;
}

猜你喜欢

转载自blog.csdn.net/qq_39210364/article/details/139931897