Alex Chang

35 code snips · on codesnips 5 months

Front-end developer with 10+ years building modern web applications. Expert in responsive design, performance optimization, and accessibility. Passionate about creating...

css
/* Interactive pseudo-classes */
a:link { color: blue; }
a:visited { color: purple; }
a:hover { text-decoration: underline; }
a:active { color: red; }
a:focus { outline: 2px solid orange; }

CSS pseudo-classes and pseudo-elements for advanced styling

css pseudo-classes pseudo-elements
by Alex Chang 2 tabs
css
/* Basic transitions */
.button {
  background-color: blue;
  color: white;
  padding: 1rem 2rem;
  transition: background-color 0.3s ease;

CSS animations and transitions for smooth interactions

css animations transitions
by Alex Chang 1 tab
javascript
// Theme switching with CSS variables
const themeToggle = document.getElementById('theme-toggle');
const root = document.documentElement;

// Load saved theme
const savedTheme = localStorage.getItem('theme') || 'light';

CSS custom properties (CSS variables) for dynamic theming

css variables custom-properties
by Alex Chang 2 tabs
css
/* Mobile-first base styles (no media query needed) */
.container {
  width: 100%;
  padding: 1rem;
  margin: 0 auto;
}

Responsive design with media queries and mobile-first approach

css responsive media-queries
by Alex Chang 1 tab
css
/* Specificity: 0,0,0,1 - Element selector */
p {
  color: black;
}

/* Specificity: 0,0,1,0 - Class selector */

CSS selectors and specificity calculation rules

css selectors specificity
by Alex Chang 1 tab
css
/* Static positioning (default) */
.static {
  position: static; /* Normal document flow */
}

/* Relative positioning */

CSS positioning and z-index layering strategies

css positioning z-index
by Alex Chang 1 tab
css
/* Basic grid container */
.grid-container {
  display: grid;

  /* Define columns: 3 equal columns */
  grid-template-columns: 1fr 1fr 1fr;

CSS Grid layout for two-dimensional design

css css-grid layout
by Alex Chang 1 tab
css
/* Basic flexbox container */
.flex-container {
  display: flex;
  /* flex-direction: row | row-reverse | column | column-reverse */
  flex-direction: row; /* default */

CSS Flexbox layout system fundamentals

css flexbox layout
by Alex Chang 1 tab
html
<!DOCTYPE html>
<html lang="en">
<head>
  <!-- Essential meta tags -->
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

Meta tags, SEO optimization, and Open Graph

html seo meta-tags
by Alex Chang 2 tabs
html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Form Validation Example</title>
  <style>

HTML forms with validation and accessibility

html forms validation
by Alex Chang 1 tab
html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Semantic HTML Example</title>

Semantic HTML5 elements and accessibility best practices

html html5 semantics
by Alex Chang 2 tabs