HTML & CSSBeginner

Learn Icons

Use icon libraries and create custom icons for your projects.

1.5 hours
4 key concepts
2 in-depth sections
Official Docs

0 of 4 concepts completed (0%)

What You'll Learn

1.SVG Icons

html
<!-- Inline SVG most flexible, no extra request -->
<button aria-label="Close dialog">
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none"
       aria-hidden="true" focusable="false">
    <path d="M18 6L6 18M6 6l12 12" stroke="currentColor"
          stroke-width="2" stroke-linecap="round"/>
  </svg>

```

css
/* Icons inherit color */
.icon {
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.125em;  /* optically align with text */
}

2.Icon Libraries (Lucide, Font Awesome)

bash
# Lucide React (tree-shakeable, TypeScript-ready)
npm install lucide-react
jsx

// Basic usage

// With color

// Using currentColor (inherits from CSS)

// Accessible icon-only button

// Icon with visible label ```

html
<!-- Font Awesome 6 CDN -->
<link rel="stylesheet"

```

Code Example

<!-- Font Awesome icons -->
<i class="fas fa-heart"></i>
<i class="fas fa-star"></i>

<!-- SVG icon -->
<svg class="icon" viewBox="0 0 24 24">
  <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"/>
</svg>

Pro Tips

  • 1Prefer SVG icons over font icons SVGs are crisp at any size, support multi-color, and don't cause FOUT (Flash of Unstyled Text).
  • 2Always add aria-hidden='true' to decorative icons and a meaningful aria-label (or adjacent visible text) to meaningful ones.
  • 3Use currentColor for icon fill/stroke so icons inherit their parent's text color automatically no extra CSS needed.
  • 4Sprite sheets (a single SVG with <symbol> elements) are more performant than loading individual icon files.

Topics Covered

IconsFont AwesomeSVG

Continue Learning

Explore the official documentation and deepen your knowledge with real-world practice.

Explore the Full Portfolio

This is the complete portfolio of Sufi Khan Sulaiman, a technology leader specialising in B2B commerce and digital automation. Start from the Home page for the overview, then move through two decades of career experience across FLIR Systems, Lorex Technology, and 1c Platform, and the full catalogue of project case studies spanning headless commerce migrations, AI recommendation engines, and multi-channel fulfilment systems.

The skills and certifications page maps the technical and leadership capabilities behind the work, while the articles and the knowledge base break down the thinking into actionable frameworks. For hands-on learning, the tutorials and applications sections cover practical builds from front-end fundamentals to full-stack web apps.

For consulting engagement, the expertise page outlines service offerings, the ecommerce hub covers platform architecture and automation strategy, and the ecommerce guide (PDF) is a downloadable 55-page field manual. When you are ready to talk, the contact page is the direct line.