icomoon: usar iconos como fuentes
1. Ingresamos a
http://icomoon.io/app/ y seleccionamos los íconos que queremos:
![](https://lh6.googleusercontent.com/t9Y2YUa-5XJ_6-o4P00aWLD2prV6ynfZ5er89jaVfxyCY8ahbauWXrxU0RSrplDmxH0NADztJdQZxSjybQxpr4ICDn5pTNM4co6UXg6kn6ErvJd68NCZqXBrBg)
2. Presionamos el botón Font para generar la fuente:
:![](https://lh3.googleusercontent.com/LDpUAdkJoAVjcgIWP-cK41kCrnc0Ctkupnk4HMyihfKnLM5fJ_A1QoqsFGwSwM5K1r9Rwlb5nhKfZFo4i-FQUDP3c7FrGq8ONH2HqjsU4ZUXbOp0cuJRmCCtjA)
![](https://lh6.googleusercontent.com/rEqN8CLu3oCMMBkDtlxLJGWAATTST-ZnloGaZsxMz2oHLh2Y96WSnoQPQ2F1c0QCrQCD2bgjwuCLLCBT8yY1k-rRT5X0dR12SoUlIHxz63A6ZpzmXFAeqlTNMg)
3. Presionamos Download:
![](https://lh4.googleusercontent.com/ajzY4yvnoPwcU1k45Pl_ZSO8G7D0rVeziMacD3iVkBULxboLmagVw5_9p38BffXp9Fm9m4bSzfOX6r-uoNxLKh1_WMq94iB-dnVCe8iQikWdW52iQ3BHTdGZdw)
4. Al extraer los archivos, nos encontramos con estos:
![](https://lh4.googleusercontent.com/9S8tUljLKCsqpvpmsheTyU2nA7B3QN4RupwAgtttWOPmgqfMCuuDrT2NcyBxQYx8XVCpnMmX47Ylmy9-UsjH8mWe8SeZs1OGjb6iaghtW7c_kpfHO_Ef6x_AMw)
license.txt: un archivo con la información de la licencia.
Ite-ie7.js: es para que funcione en navegadores menores a Internet Explorer 7.
Read Me.txt: un archivo con instrucciones.
Styles.css: archivo de estilos.
La fuente está creada con un div vacío y un atributo propio llamado data-icon y genera un valor unicode para cada ícono:
![](https://lh3.googleusercontent.com/V-tjTGRRxOTBR4NnrHWLM5EbPmiMhb1DL0I-MuiVCDBtlwvij8eBKP6NGfDuMB9fa7khG2NL4bahyUeeyvf1Vekq1FTD99BTPzGfHue8bGOj3gr_st7AT5FAoA)
En el archivo styles.css tenemos inicialmente el código que llama a cada archivo en la carpeta fonts y define otros parámetros:
![](https://lh3.googleusercontent.com/4yHr9Bmzng77D6sOuo-eAjJ56xOuzd3vVyL7-gyZL_2nMWsiFYlVDWQNWco5NGgQar2KppN1-jal0JRikahBRZawUPf4WJ2QTxC9_ASs1TYNTQiqYzqi6EPOfg)
Para las clases toman cada ícono y le define la fuente y otros parámetros:
![](https://lh6.googleusercontent.com/nWkWLXeKmeQJhu9gD5UXws5siJz4ASU2CUpkP3OT3aiwFultXKw36Tzp19mb9tWXQBpX0ZskcIelAz035BgPmXMqWHz91XIPJf_KVwPtK-UwaL5iHynCIpa37A)
Posteriormente, antes del contenido de la clase, agrega un
content con la letra
unicode correspondiente a cada ícono, como mostramos más arriba:
![](https://lh6.googleusercontent.com/P4_RzW9BwCCEB_2maoRK43vZTAF7DP5jHY-iY81UZ1ittZj1elGUybou3G_XDh8O4TfO7tE2sfghouktjMQ2K_36yJXzXh8q_5CO6eE0rN364BJVN3tjImwiSQ)
Antes de seguir:
¿Qué es un pseudo elemento?
Es un elemento propio creado mediante un atributo que se guarda en el archivo de estilos. Por ejemplo data-icon:
![](https://lh6.googleusercontent.com/YtNfNsLXhDjMZ-EV6TEiuUsII_MuGSHfKCtnJ0Pe8XmF-KrMJ8lta02XM6dBNxkIjKiznuyMcgcWGKLDisEfwIny9FExlTiNF4PcZf9ExyUug6Q0XYg0b_9GCQ)
4. Siguiendo con el ejercicio, utilizaremos la carpeta fonts y el archivo styles.css y lo llevaremos a la carpeta de nuestra aplicación.
Para convertir el .css a .styl: mediante el comando stylus -C style.css (si el watch está activado lo detenemos con ctrl+c):
![](https://lh6.googleusercontent.com/trUhBr9_ujAx_xgD0nHw-Uwk-oVbrjRC1l4aDVcVP9M5_PsadslPKgHIkPASM5ZOmszZ5qGXnfsFA76-qc1FdlDKTTpPPMw85YMGWLvByk6DRr0ykkosdZEw_A)
5. Nos arroja un buen resultado, a excepción de @font.face que hay que corregirlo manualmente porque aparece undefined:
![](https://lh3.googleusercontent.com/Q-54FPE_UJdetT1IMdIDJU9LSO-iHC66JdlekV2nWulUZJB-xGV7wS4rkWiMYvW0W1PQPR3oy8mohfegm37FJliVimc_xTuyW6HANIRjtMcWYZIN0WOfHmdM2g)
6. Corregimos agregando toda la orden de pre-render @font-face:
![](https://lh3.googleusercontent.com/dftWPVgI6wDihjHNEPyD3-jagoxqQOPVYrFSNdajDKgQYaxGHUfr61WmgmwFZD9D275JZZw9aEJr1tBfT37Ksjn3ZlJy54dkH8d0Ew96YMHdp7lRlsJRqCvm8w)
7. Ahora compilamos style.styl y quedaría así:
![](https://lh6.googleusercontent.com/EL744SUdyoi2veUK6QAw46aEPNkH81HUCFFkBuYJ17m5yAqwk4RM5-w9FhGJB7E2sl9RslsMOslM58bkXqDFbgLHV8EK2wIyAUgUJ0xr0G3Eo1LzIVl5f1fDOw)
8. Renombraremos el archivo style.styl por iconos.styl.
Compilamos todo en un sólo archivo: en es,ñm-mtilos.styl usamos el comando @import:
![](https://lh6.googleusercontent.com/DrJolp2neHtwQac0BYBE0VPVDOTr6a6MRLOcrqOVXRZYqAzHXNuT1L_hvr53DukmF4wzfR8drkT6FNABwiPvh4MvfPwbluwg-1fnxzdZ8rUvcII218bdRlaerA)
9. Ahora ejecutamos el comando para que compile y vea:
![](https://lh4.googleusercontent.com/EgUSyCnXM4R0_EWO0KTRGYc5tygltBDKsppuw9kjmhnzlXmuuvBriYkZh-VQYKBPhmGQB54AhG-qKUE0YEUU-y5UYN9YXBKliDRcdtFCgpHFbkPmPAN29XkGXg)
10. Ahora estilos.css nos queda así:
![](https://lh4.googleusercontent.com/JTyxFLb4S1AYWlNkwULsuPsUT7f9CP2fGn2CC9_7v37gvkV9bLY17dLMJY4QYDFnwpYOTBDZTAZP3JFTdXYaUmASAuvJYFAobdg7DKtbKD9DXWK3bzOwZpVFHw)
11. Sólo agregamos entonces la clase de cada ícono y podemos agregarle las propiedades que deseemos. Hay que recordar que debe ser manipulado como fuente.
Contenido creado por: