Html css

From G1Joshi/Agent-Skills · View interactive version

Html css is an AI agent skill from the GitHub repository G1Joshi/Agent-Skills. Expert modern HTML5 and CSS3 assistance covering semantic markup, Flexbox, CSS Grid, container queries, CSS custom properties, and responsive design systems. Use when crafting accessible web interfaces, building resilient UI layouts, or optimizing render performance.

How to use this skill

Skill file

HTML & CSS

Modern HTML5 and CSS3 for semantic web structure and responsive styling.

When to Use

Quick Start

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Page Title</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <main class="container">
      <h1>Hello World</h1>
    </main>
  </body>
</html>

Core Concepts

Semantic HTML5 & Accessible Landmark Roles

Replaces generic <div> soup with structural elements that assistive technologies understand:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Enterprise Portal</title>
  </head>
  <body>
    <header role="banner">
      <nav aria-label="Main Navigation">
        <ul>
          <li><a href="/dashboard">Dashboard</a></li>
        </ul>
      </nav>
    </header>
    <main id="main-content">
      <article>
        <h1>System Architecture 2026</h1>
        <p>Modern web applications prioritize semantic accessibility.</p>
      </article>
    </main>
    <footer role="contentinfo">
      <p>&copy; 2026 Enterprise Corp.</p>
    </footer>
  </body>
</html>

Modern CSS Layout (Grid & Subgrid)

Builds responsive multi-column layouts without external CSS frameworks:

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 3;
  padding: 1.5rem;
  background-color: var(--color-surface);
  border-radius: 0.75rem;
}

Container Queries & CSS Custom Properties

Adapts styling based on container container width rather than the global browser viewport:

:root {
  --color-primary: #4f46e5;
  --color-surface: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-surface: #0f172a;
  }
}

.card-container {
  container-type: inline-size;
}

@container (min-width: 450px) {
  .card-content {
    display: flex;
    gap: 1rem;
  }
}

Common Patterns

Centered Responsive Component Layout

Problem: Vertically and horizontally centering responsive card elements across varying viewport dimensions.

Solution:

/* Center content */
.center {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Navigation bar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* Card grid with wrap */
.card-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.card {
  flex: 1 1 300px;
}

CSS Grid

Problem: Constructing multi-dimensional grid layouts and responsive page containers without fragile positioning hacks.

Solution:

/* Responsive grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* Page layout */
.layout {
  display: grid;
  grid-template-areas:
    "header header"
    "sidebar main"
    "footer footer";
  grid-template-columns: 250px 1fr;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

.header {
  grid-area: header;
}
.sidebar {
  grid-area: sidebar;
}
.main {
  grid-area: main;
}
.footer {
  grid-area: footer;
}

Responsive Design

Problem: Maintaining layout proportion, typography readability, and container responsiveness across disparate screen viewports.

Solution:

/* Mobile-first approach */
.container {
  padding: 1rem;
}

@media (min-width: 768px) {
  .container {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
  }
}

/* Container queries */
.card-container {
  container-type: inline-size;
}

@container (min-width: 400px) {
  .card {
    display: flex;
    gap: 1rem;
  }
}

Best Practices

Do:

Don't:

Troubleshooting

| Error | Cause | Solution |

| ----------------------- | ------------------- | ------------------------- |

| Layout overflow | Fixed widths | Use percentage or min/max |

| Flex items not wrapping | Missing flex-wrap | Add flex-wrap: wrap |

| Grid gaps not showing | Old browser | Check browser support |

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.