SyntaxStudy
Sign Up
CSS Showing and Hiding at Breakpoints
CSS Beginner 3 min read

Showing and Hiding at Breakpoints

Visibility at Breakpoints

Use media queries to show desktop-only or mobile-only elements without duplicating markup.

Example
.mobile-only { display: block; }
.desktop-only { display: none; }
@media (min-width: 768px) {
  .mobile-only  { display: none; }
  .desktop-only { display: block; }
}
/* Use visibility: hidden if you need to keep layout space */
Pro Tip

Prefer CSS show/hide over duplicated HTML for the same content.