How To Make CSS Play & Pause Icons With A Single DIV
Oct 1, 2014Web DevelopmentComments (2)
Using CSS borders, you can create play and pause icons with full browser compatibility, no images, and no extra http requests. Each one uses just one <div> and simple CSS.
Here are the icons:
If you have box-sizing: content-box set (default), use this CSS:
If you have box-sizing: border-box set, use this CSS:
To make them larger, increase the width and height and make sure to adjust the borders accordingly.
Here are the icons:
If you have box-sizing: content-box set (default), use this CSS:
.play {
width: 0;
height: 0;
border-top: 8px solid transparent;
border-left: 12px solid #000;
border-bottom: 8px solid transparent;
}
.pause {
width: 4px;
height: 16px;
border-right: 4px solid #000;
border-left: 4px solid #000;
}
If you have box-sizing: border-box set, use this CSS:
.play {
width: 12px;
height: 16px;
border-top: 8px solid transparent;
border-left: 12px solid #000;
border-bottom: 8px solid transparent;
}
.pause {
width: 12px;
height: 16px;
border-right: 4px solid #000;
border-left: 4px solid #000;
}
To make them larger, increase the width and height and make sure to adjust the borders accordingly.