# Classless HTML

Source: https://iriscss.com/documentation/overview/classless-html/

Write semantic HTML and it is styled. Classes are only for variants.

Everything on this page is plain HTML with no class. Each element has its own page with the details and variants.

## Page structure

`body` has no margin. A `header`, `main` or `footer` directly in `body` gets vertical padding, and each `section` gets space below it. Wrap the content in a [container](https://iriscss.com/documentation/layout/container-and-grid/index.html.md) to center it.

```html
<body>
  <header class="container">...</header>
  <main class="container">
    <section>...</section>
    <section>...</section>
  </main>
  <footer class="container">...</footer>
</body>
```

## Text

```html
<hgroup>
  <h3>An article title</h3>
  <p>With a subtitle under it</p>
</hgroup>
<p>
  A paragraph with <strong>strong</strong>, <em>emphasis</em>,
  <a href="#">a link</a>, <mark>highlighted</mark> text and
  <code>inline code</code>. Press <kbd>Ctrl</kbd> to continue.
</p>
<blockquote>
  <p>A quote set apart from the text.</p>
  <footer><cite>Someone wise</cite></footer>
</blockquote>
<ul>
  <li>A list item</li>
  <li>Another item</li>
</ul>
```

See [typography](https://iriscss.com/documentation/elements/typography/index.html.md), [list](https://iriscss.com/documentation/elements/list/index.html.md) and [code](https://iriscss.com/documentation/elements/code/index.html.md).

## Forms

```html
<form>
  <label>Email <input type="email" placeholder="ada@example.com"></label>
  <label>Plan
    <select>
      <option>Free</option>
      <option>Pro</option>
    </select>
  </label>
  <label><input type="checkbox" role="switch" checked> Send me updates</label>
  <button type="submit">Sign up</button>
</form>
```

See [controls](https://iriscss.com/documentation/form/controls/index.html.md), [checkbox, radio and switch](https://iriscss.com/documentation/form/checkbox-radio-and-switch/index.html.md) and [validation](https://iriscss.com/documentation/form/validation/index.html.md).

## Tables, progress and media

```html
<table>
  <thead>
    <tr><th scope="col">Task</th><th scope="col">Done</th></tr>
  </thead>
  <tbody>
    <tr><td>Design</td><td>100%</td></tr>
    <tr><td>Build</td><td>60%</td></tr>
  </tbody>
</table>
<progress value="60" max="100"></progress>
<figure>
  <img src="/android-chrome-192x192.png" alt="Iris CSS logo" width="96" height="96">
  <figcaption>A figure with a caption.</figcaption>
</figure>
```

See [table](https://iriscss.com/documentation/elements/table/index.html.md), [progress and meter](https://iriscss.com/documentation/elements/progress-and-meter/index.html.md) and [media](https://iriscss.com/documentation/elements/media/index.html.md).

## Interactive elements

`details` is an accordion, `dialog` a modal, an element with `popover` a popover, and `nav` a row of links. None of them need JavaScript.

```html
<details>
  <summary>What is in the box?</summary>
  <p>Plain HTML, styled.</p>
</details>
<nav aria-label="Classless example">
  <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
  </ul>
</nav>
```

See [accordion](https://iriscss.com/documentation/components/accordion/index.html.md), [modal](https://iriscss.com/documentation/components/modal/index.html.md), [popover](https://iriscss.com/documentation/elements/popover/index.html.md) and [nav](https://iriscss.com/documentation/components/nav/index.html.md).

## When to add a class

Add a class when you want a variant, such as `.primary` or `.large`, or a pattern HTML has no element for, such as `.card` or `.badge`. Start with [colors](https://iriscss.com/documentation/modifiers/colors/index.html.md) and [sizes](https://iriscss.com/documentation/modifiers/sizes/index.html.md).
