I'm using the following CSS to add checkmarks before my <li>
list items:
ul.checkmark li:before { content:"\2713\0020"; }
And then in the HTML:
<ul class="checkmark"> <li>Learn the keyboard at your own pace</li> </ul>
Works great in Safari, Firefox and Chrome, but displays "freak out boxes" on IE8.
Safari:
IE8:
Is there a portable way to specify a good-looking checkmark that will work in all the major browsers?
EDIT Solution: I ended up using a variation on meder's answer below:
ul.checkmark li { background:url("../checkmark.gif") no-repeat 0 50%; padding-left: 20px; } ul.checkmark { list-style-type: none; }
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.
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.
The <ul> tag defines an unordered (bulleted) list. Use the <ul> tag together with the <li> tag to create unordered lists. Tip: Use CSS to style lists. Tip: For ordered lists, use the <ol> tag.
The <li> tag defines a list item. The <li> tag is used inside ordered lists(<ol>), unordered lists (<ul>), and in menu lists (<menu>). In <ul> and <menu>, the list items will usually be displayed with bullet points. In <ol>, the list items will usually be displayed with numbers or letters. Tip: Use CSS to style lists.
li { background:url(/images/checkmark.gif) no-repeat 0 50%; }
Would probably be the only way you'll get it to work consistently in the IE pre 8/9.
ul { list-style-image:url("/default_unchecked.png"); /* other list styles*/ }
then later change it via javascript, maybe.
$('.selected').css("list-style-image", "url('/images/blueball.gif')");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With