Building Your Learning Module...
Getting things ready for you!
Find videos you like?
Save to resource drawer for future reference!
Consistent naming across your project
Clear class names that explain their purpose
Avoid naming conflicts and confusion
Make code easier for teams to work on
Popular conventions: BEM, camelCase, kebab-case
Essential for large projects
.btn, .button, .button2,.newButton, .btn-new-final all doing the same thing! Good naming conventions prevent this chaos and make your code professional.Words separated by dashes (most common in CSS)
.user-profile, .nav-item, .button-primaryFirst word lowercase, rest capitalized
.userProfile, .navItem, .buttonPrimaryWords separated by underscores (rare in CSS)
.user_profile, .nav_item, .button_primaryAll words capitalized (rare in CSS)
.UserProfile, .NavItem, .ButtonPrimaryThe CSS community mostly uses kebab-case because:
.main-navigation vs .mainNavigationfont-family, background-color.block__element--modifierThe main component
.card.menu.buttonPart of the block (use __)
.card__title.menu__item.button__iconVariation (use --)
.card--featured.menu--vertical.button--large/* Block: The main component */
.product-card {
padding: 20px;
border: 1px solid #e5e7eb;
border-radius: 8px;
}
/* Elements: Parts of the product card */
.product-card__image {
width: 100%;
height: 200px;
object-fit: cover;
border-radius: 4px;
}
.product-card__title {
font-size: 18px;
font-weight: 600;
margin: 12px 0;
}
.product-card__price {
font-size: 20px;
color: #10b981;
font-weight: 700;
}
.product-card__description {
font-size: 14px;
color: #6b7280;
margin: 8px 0;
}
/* Modifiers: Variations of the product card */
.product-card--featured {
border-color: #3b82f6;
border-width: 2px;
box-shadow: 0 4px 6px rgba(59, 130, 246, 0.1);
}
.product-card--compact {
padding: 12px;
}
.product-card--compact .product-card__image {
height: 120px;
}<div class="product-card">
<img class="product-card__image" src="https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=300&h=200&fit=crop" alt="Product">
<h3 class="product-card__title">Wireless Headphones</h3>
<p class="product-card__price">$99.99</p>
<p class="product-card__description">Premium sound quality with active noise cancellation</p>
</div>
<div class="product-card product-card--featured">
<img class="product-card__image" src="https://images.unsplash.com/photo-1484704849700-f032a568e944?w=300&h=200&fit=crop" alt="Product">
<h3 class="product-card__title">Pro Headphones ⭐</h3>
<p class="product-card__price">$199.99</p>
<p class="product-card__description">Our best-selling premium headphones with extended battery</p>
</div>
<div class="product-card product-card--compact">
<img class="product-card__image" src="https://images.unsplash.com/photo-1545127398-14699f92334b?w=300&h=120&fit=crop" alt="Product">
<h3 class="product-card__title">Budget Headphones</h3>
<p class="product-card__price">$49.99</p>
</div>Loading preview...
.product-card__price tells you exactly what it is.product-card__title won't break other titles.user-avatar.nav-menu not .Nav-Menu.article-title not .title.navigation not .nav (unless common abbreviation).item, .box, .thing.usrprf, .nv.box2, .style3.red-text, .big-box.2-column (invalid!)/* ❌ BAD: Generic, unclear names */
.box { }
.item2 { }
.red { }
.big { }
.new { }
/* ✅ GOOD: Descriptive, specific names */
.user-profile-card { }
.navigation-menu-item { }
.error-message { }
.header-logo-large { }
.product-featured { }
/* ❌ BAD: Style-based (what if design changes?) */
.red-button { } /* What if it becomes blue? */
.left-sidebar { } /* What if it moves to the right? */
/* ✅ GOOD: Purpose-based */
.button-danger { } /* Still makes sense if color changes */
.sidebar-navigation { } /* Describes what it is, not where it is */
/* ❌ BAD: Too generic */
.title { } /* Which title? */
.image { } /* Which image? */
/* ✅ GOOD: Specific */
.article-title { }
.product-thumbnail { }.is-activeCurrently active/selected
.is-disabledNot clickable/usable
.is-loadingFetching data
.is-hiddenNot visible
.has-errorContains an error
.is-openExpanded/visible
/* Base button */
.button {
padding: 10px 20px;
background: #3b82f6;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
}
/* Button states */
.button.is-disabled {
opacity: 0.5;
cursor: not-allowed;
pointer-events: none;
}
.button.is-loading {
position: relative;
color: transparent;
}
.button.is-loading::after {
content: '';
position: absolute;
width: 16px;
height: 16px;
border: 2px solid white;
border-top-color: transparent;
border-radius: 50%;
animation: spin 0.6s linear infinite;
}
/* Dropdown states */
.dropdown {
position: relative;
}
.dropdown__menu {
display: none;
position: absolute;
top: 100%;
left: 0;
}
.dropdown.is-open .dropdown__menu {
display: block;
}Components, reusable UI elements, component libraries
Common styles: .text-center, .mb-4, .flex
Temporary states: .is-active, .is-loading, .has-error
Page structure: .l-header, .l-main, .l-sidebar
.card__header not .card__container__header__title.item, .box, .content (too vague).blue-text, .large-box (what if design changes?).user-card and .userCard in same project.homepage-hero-section-container-wrapper-div (overkill!).usrprf, .nv (unclear what they mean).button2, .style3-final (no context)