Placeholders

Back

Loading concept...

🎭 Bootstrap Placeholders: The Magic of β€œComing Soon” Boxes

Imagine you’re at a restaurant. The waiter brings you an empty plate with a shiny cover. You know food is coming, but you can’t see it yet. That empty covered plate is a placeholder β€” it tells you β€œsomething good is on its way!”


🌟 What Are Placeholders?

Think of placeholders like empty boxes that dance while your real content loads.

When a website is loading, instead of showing nothing (which feels broken), we show pretty gray boxes that pulse and shimmer. This tells users: β€œHold on! Good stuff is coming!”

Real Life Example:

  • Facebook/Instagram: Those gray boxes you see before posts appear? Placeholders!
  • YouTube: The gray thumbnails before videos load? Placeholders!
  • Shopping apps: Gray product cards before items show? Placeholders!
<!-- A simple placeholder paragraph -->
<p class="placeholder-glow">
  <span class="placeholder col-12"></span>
</p>

What happens? A glowing gray bar appears where text will be!


πŸ“ Placeholder Width: How Wide Should the Empty Box Be?

Just like drawing rectangles of different sizes, we can make placeholders thin, medium, or wide.

The Width Classes:

Class Width Use For
col-1 Very tiny Icons, dots
col-4 About 1/3 Short labels
col-6 Half Medium text
col-8 About 3/4 Long sentences
col-12 Full width Paragraphs

🍰 Cake Analogy:

Imagine cutting a cake into 12 equal slices:

  • col-3 = 3 slices (quarter of cake)
  • col-6 = 6 slices (half of cake)
  • col-12 = whole cake!
<!-- Different widths example -->
<p class="placeholder-glow">
  <span class="placeholder col-6"></span>
</p>
<p class="placeholder-glow">
  <span class="placeholder col-4"></span>
</p>
<p class="placeholder-glow">
  <span class="placeholder col-8"></span>
</p>

Result? Three gray bars: medium β†’ short β†’ long!


🎨 Placeholder Color: Painting the Empty Boxes

Why be boring with gray? Bootstrap lets you use colorful placeholders!

Color Classes:

Class Color When to Use
bg-primary πŸ”΅ Blue Main actions
bg-secondary ⚫ Gray Normal content
bg-success 🟒 Green Good things
bg-danger πŸ”΄ Red Warnings
bg-warning 🟑 Yellow Caution
bg-info 🩡 Cyan Information
bg-light ⬜ Light Subtle areas
bg-dark ⬛ Dark Bold sections

πŸ–οΈ Crayon Box Analogy:

Think of colors like picking crayons from a box. Each color gives a different feeling!

<!-- Colorful placeholders -->
<span class="placeholder col-12 bg-primary"></span>
<span class="placeholder col-12 bg-success"></span>
<span class="placeholder col-12 bg-danger"></span>

Pro Tip: Match placeholder colors to your final content colors for a smooth transition!


✨ Placeholder Animation: Making Boxes Dance!

Static gray boxes are boring. Animated ones feel alive and exciting!

Bootstrap gives you TWO animation styles:

1. πŸ’« Glow Animation (placeholder-glow)

The placeholder fades in and out like a heartbeat.

<p class="placeholder-glow">
  <span class="placeholder col-12"></span>
</p>

Feels like: A gentle breathing light πŸ’‘

2. 🌊 Wave Animation (placeholder-wave)

A shiny wave sweeps across from left to right, like water flowing.

<p class="placeholder-wave">
  <span class="placeholder col-12"></span>
</p>

Feels like: A shimmer of light moving across ✨


🎯 Complete Example: A Loading Card

Let’s build a realistic loading card for a user profile:

<div class="card" style="width: 18rem;">
  <div class="card-body">
    <!-- Fake Avatar -->
    <div class="placeholder-glow">
      <span class="placeholder col-4
        rounded-circle bg-secondary">
      </span>
    </div>

    <!-- Fake Name -->
    <h5 class="card-title placeholder-glow">
      <span class="placeholder col-6"></span>
    </h5>

    <!-- Fake Description -->
    <p class="card-text placeholder-wave">
      <span class="placeholder col-7"></span>
      <span class="placeholder col-4"></span>
      <span class="placeholder col-4"></span>
      <span class="placeholder col-6"></span>
    </p>

    <!-- Fake Button -->
    <a class="btn btn-primary disabled
      placeholder col-6"></a>
  </div>
</div>

🧠 Quick Summary

graph TD A["🎭 Placeholders"] --> B["πŸ“ Width"] A --> C["🎨 Color"] A --> D["✨ Animation"] B --> B1["col-1 to col-12"] C --> C1["bg-primary, success, danger..."] D --> D1["placeholder-glow"] D --> D2["placeholder-wave"]

πŸš€ Key Takeaways

  1. Placeholders = Loading boxes that show while real content loads
  2. Width = col-1 to col-12 (think cake slices!)
  3. Color = bg-primary, bg-success, etc. (pick your crayon!)
  4. Animation = glow or wave (heartbeat or flowing water!)

πŸ’‘ Remember This Forever

β€œA placeholder is like a movie trailer β€” it shows you something is coming and keeps you excited to wait!”

Now go make your loading states beautiful! πŸŽ‰

Loading story...

Story - Premium Content

Please sign in to view this story and start learning.

Upgrade to Premium to unlock full access to all stories.

Stay Tuned!

Story is coming soon.

Story Preview

Story - Premium Content

Please sign in to view this concept and start learning.

Upgrade to Premium to unlock full access to all content.