Skip to main content

CHAT GPT
Solution of  aka  Stronger ONEs
IF ..
ACCIDENTALLY DEFINING THE SAME CLASS TWICE

Accidentally Defining the Same Class Twice

If you accidentally define the same class twice in internal CSS, like this:


<style>

.blogger {

  color: blue;

}

.blogger {

  color: red;

}

</style>

The rule that appears last wins — because of the CSS cascade order.

So in this case → the text will be red.


How to Make One .blogger More Powerful

1️⃣ Use an ID (Very Strong)


#main .blogger {

  color: red;

}

Specificity:


#main .blogger → 0,1,1,0

IDs are stronger than classes, so this overrides:


.blogger → 0,0,1,0


2️⃣ Duplicate the Class (Hacky but Works)


.blogger.blogger {

  color: red;

}

This increases specificity.



CSS Specificity Difference


0,0,1,0

vs

0,0,2,0

What Do These Numbers Mean?

Specificity format:


(A, B, C, D)

Position Represents Example
A Inline style style=""
B ID selectors #main
C Class / attribute / pseudo-class     .blogger, [type=text], :hover
D Element selectors div, p

0,0,1,0

  • 0 inline styles
  • 0 IDs
  • 1 class
  • 0 elements

.blogger { color: blue; }

Specificity = 0,0,1,0

0,0,2,0

  • 0 inline styles
  • 0 IDs
  • 2 classes
  • 0 elements

.container .blogger { color: red; }

/* OR */

.blogger.active { color: red; }

Specificity = 0,0,2,0

Why 0,0,2,0 Wins

CSS compares left to right:


0,0,2,0

0,0,1,0

      ↑

At the class level: 2 > 1

So this wins:


.blogger { color: blue; }           

.container .blogger { color: red; }

Final color → red

Important Note

Specificity is compared column by column from left to right.


0,1,0,0   (one ID)

0,0,999,999

The first one wins because the ID column is higher.

CSS Specificity Guide

CSS Specificity Difference

0,0,1,0
vs
0,0,2,0
    

What Do These Numbers Mean?

Specificity format:

(A, B, C, D)
    
Position Represents Example
A Inline style style=""
B ID selectors #main
C Class / attribute / pseudo-class .blogger, [type=text], :hover
D Element selectors div, p

0,0,1,0

  • 0 inline styles
  • 0 IDs
  • 1 class
  • 0 elements
.blogger { color: blue; }
    

Specificity = 0,0,1,0

0,0,2,0

  • 0 inline styles
  • 0 IDs
  • 2 classes
  • 0 elements
.container .blogger { color: red; }
/* OR */
.blogger.active { color: red; }
    

Specificity = 0,0,2,0

Why 0,0,2,0 Wins

CSS compares left to right:

0, 0, 2, 0
0, 0, 1, 0
      ↑
        

At the class level: 2 > 1. Final color → red

Important Note

Specificity is compared column by column from left to right. Even a million classes cannot beat a single ID.

0,1,0,0   (One ID wins!)
0,0,99,99 (Many classes/elements lose)
    

3️⃣ Use !important (Last Resort)


.blogger {

  color: red !important;

}

This overrides almost everything except another !important with higher specificity.

Avoid overusing it — it makes CSS harder to maintain.


What Really Controls Priority?

  1. !important
  2. Inline style (style="")
  3. ID selectors
  4. Class selectors
  5. Element selectors
  6. Order (last wins if equal)

Best Practice Recommendation

  • Prefer increasing specificity instead of repeating rules
  • Avoid !important unless absolutely necessary
  • Keep CSS structured and predictable

Comments

Popular posts from this blog

Utk yg mo Bantu2 Keuangan saya
..monggo ke Bank Central Asia BCA 5520166779 a.n. Andreas Tparlaungan Manurung (Indonesia)


For those who would like to help support my finances
..please feel free to send it to Bank Central Asia (BCA) account number 5520166779 under the name Andreas Tparlaungan Manurung (Indonesia)

ANDREAS TOMMY PARLAUNGAN MANURUNG SHARED POOLING ACCOUNT MY ANDROID APKs PAGE please download here! REFRESH PAGE aka CHECK LATEST UPDATE! DOWNLOAD "SHOWING" POOL OF MY ANDROID-APK(s) aka APK CONTAINING LIST OF ALL MY ANDROID-APK(s) APP CLICK HERE FOR ALWAYS BEING UPDATED FOR MY LATEST APK! CONTOH HASIL "PROGRAM" App: Prompts' Guide aka TEMPLATE-HELPERs click here to download! Youtube and Instagram EMBEDded to Blogger/Blogspot.com SOURCE CODE Click this box to download 📥 TikTok EMBEDded to Blogger/Blogspot.com SOURCE CODE Input: BrowserLINK (mandatory) Click this box to download SHORTCUT-APPs note :  "precise" click to download R8: ronin1985.blogspot.com R2M: ronin-manu.blogspot.com Helping Download(ing) OnlineVIDEO! ...

[ERROR BUG]
ChatGPT+Gemini: TikTok → Blogger Embed Converter using Cloudflare/Online Server

🔄 Refresh Page ERROR BUG: The connection is blocked because it was initiated by a public page to connect to devices or servers on your local network. Planning: Revise Program CODE Code USING Javascript/Online Server Code NOT USING Javascript Sample Working Code aka Already Repaired! Temporary Solution is by Asking AI Assistant to do REPAIR CODE of (Not yet Repaired) Current Conversion Program Code-Output TikTok Archive – Embedded Preview TikTok Embed ▶ View this video on TikTok ⚠️ DISCLAIMER: INPUT URL LIMITATION This program is currently restricted to processing Full Browser URLs only. It does not support TikTok’s mobile "short-link" format (e.g., vt.tiktok.com ). Required Action: Users must open the video in a web browser and copy the expanded URL from the address bar before pasting it into this program. URL Conversion Example ❌ UNSUPPORTED: https://vt.tiktok.com/ZSaXoFyov/ ✅ REQ...

REPOST: Studying WATER PUMP by ROMAN ENGINEERING

*^ Ini yg Asli Gan! Mekanisme pada Concrete Pump: Kok ky Sistem Mekanik Romawi ya?! Tapi malah bisa HANYA pake PER aka bukan "MATA BOR look a like" Mekanisme Drill yg Cost Pembuatan bikin REPOT aka harus Tool SUPER Khusus Dari Material Besi yg digunakan terlihat langsung secara kasat mata Jauh Lebih Banyak drpd Per Biasa seperti yg ditunjukkan pd Video Alternatif dgn Penggunaan PER Video dr Instagram: Source: YouTube Rome's drainage machines #history #romanempire #engineering