在CSS中,实现一个播放键并不难。我们可以利用CSS中的伪元素来实现播放键的样式。我们先来看一下如何利用伪元素实现三角形:.play-button::before { content: ; displ
.play-button::before { content: ""; display: inline-block; width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 10px solid #fff; }
.play-button { width: 30px; height: 30px; border: 2px solid #fff; border-radius: 100%; display: flex; justify-content: center; align-items: center; position: relative; }
.play-button:hover::before { border-top: 10px solid #ccc; }
<p> <pre> .play-button { width: 30px; height: 30px; border: 2px solid #fff; border-radius: 100%; display: flex; justify-content: center; align-items: center; position: relative; } .play-button::before { content: ""; display: inline-block; width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 10px solid #fff; } .play-button:hover::before { border-top: 10px solid #ccc; }
粉丝
0
关注
0
收藏
0