---
title: "Discussion on \"Difference between an id and a class in css\" | Hashnode"
description: "Discussion on \"Difference between an id and a class in css\". When you write a simple css code it almost feels like you can use an id and a class interchangeably -after all they produce seemingly equal outputs- but you can't-per say- And I'm going to tell you why\n<style>\n    .red-socks{\n        color: #ff0;\n}\n<..."
url: "https://hashnode.com/posts/difference-between-an-id-and-a-class-in-css/5fb09a4ac03b0e471014fb64"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Difference between an id and a class in css](https://rennee04.hashnode.dev/difference-between-an-id-and-a-class-in-css?utm_source=hashnode&utm_medium=feed)

When you write a simple css code it almost feels like you can use an id and a class interchangeably -after all they produce seemingly equal outputs- but you can't-per say- And I'm going to tell you why <style> .red-socks{ color: #ff0; } <...

Nov 14, 2020 · 3 min read · rennee04.hashnode.dev  
Read the article

-   [#css](https://hashnode.com/tag/css)
-   [#class](https://hashnode.com/tag/class)

## Written by

[Renee Fatogun](https://hashnode.com/@Renee04)

@Renee04

  
[View profile](https://hashnode.com/@Renee04)

## Responses 2

Markdown supported · ⌘↵ to post

[Nifemi Adeyemi](https://hashnode.com/@Oluwanifemi)

[Nov 15, 2020](https://hashnode.com/posts/difference-between-an-id-and-a-class-in-css/5fb09a4ac03b0e471014fb64/comment/5fb1018d03f7294d0e3a81d8)

Well done This was insightful 🤩

[iyin Dairo](https://hashnode.com/@DairoIyin)

[Nov 15, 2020](https://hashnode.com/posts/difference-between-an-id-and-a-class-in-css/5fb09a4ac03b0e471014fb64/comment/5fb0d370b69caa470a3c3e24)

Great article, thanks for explaining this. ✨
