Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw a checkmark / tick using CSS?

How to draw the tick symbol using CSS? The symbols I find using Unicode isn't aesthetically-pleasing.

EDIT Icon fonts are a great suggestion. I was looking for something like this.

like image 398
dayuloli Avatar asked Feb 23 '14 12:02

dayuloli


People also ask

How do I make a checkmark in CSS?

A checkmark icon can be created with CSS by following these steps : Taking a container element, and using its ::before and ::after pseudo-elements to create two straight lines. Rotate both pseudo-elements to make the element look like a checkmark.

How do I insert a tick symbol in HTML?

In the web page's HTML source code, add one of the following Unicode HTML entities, depending on the type of check mark you want to insert. ☑ - inserts the " ☑ " symbol. ✓ - adds the " ✓ " symbol. ✔ - inserts the " ✔ " symbol.


2 Answers

You can draw two rectangles and place them next to each other. And then rotate by 45 degrees. Modify the width/height/top/left parameters for any variation.

DEMO 1

DEMO 2 (With circle)

HTML

<span class="checkmark">     <div class="checkmark_stem"></div>     <div class="checkmark_kick"></div> </span> 

CSS

.checkmark {     display:inline-block;     width: 22px;     height:22px;     -ms-transform: rotate(45deg); /* IE 9 */     -webkit-transform: rotate(45deg); /* Chrome, Safari, Opera */     transform: rotate(45deg); }  .checkmark_stem {     position: absolute;     width:3px;     height:9px;     background-color:#ccc;     left:11px;     top:6px; }  .checkmark_kick {     position: absolute;     width:3px;     height:3px;     background-color:#ccc;     left:8px;     top:12px; } 
like image 185
dayuloli Avatar answered Sep 23 '22 14:09

dayuloli


Here is another CSS solution. its take less line of code.

ul li:before {     content: '\2713';     display: inline-block;     color: red;     padding: 0 6px 0 0; }  ul li {     list-style-type: none;     font-size: 1em; }  <ul>     <li>test1</li>     <li>test</li> </ul> 

Here is the Demo link http://jsbin.com/keliguqi/1/

like image 30
Kheema Pandey Avatar answered Sep 22 '22 14:09

Kheema Pandey