# Media

> Images, images that zoom, and YouTube and SoundCloud embeds.

Images are plain `<img>` elements, scaled to the content width. Wrap one in `<figure>` with a `<figcaption>` for a caption.

## Internal Images

Reference images from your project; every file that is not a page is copied to the output at the same path:

**HTML**

```html
<img src="/screenshots/docs.webp" alt="An htmlpress docs page">
```

**Markdown**

```md
![An htmlpress docs page](/screenshots/docs.webp)
```

A relative `src`, `srcset` or `poster` is resolved from the page's source file, so it keeps working at the page's folder URL, under a language prefix, or at another `<meta name="path">`.

Renders as:

![An htmlpress docs page with the navigation, a code block and the table of contents](/screenshots/docs.webp)

An htmlpress docs page.

## External Images

Reference images from external URLs:

**HTML**

```html
<img src="https://picsum.photos/seed/htmlpress/800/300" alt="Placeholder">
```

**Markdown**

```md
![Placeholder](https://picsum.photos/seed/htmlpress/800/300)
```

Renders as:

![Placeholder](https://picsum.photos/seed/htmlpress/800/300)

## Base64 Images

Embed small images directly using data URIs:

**HTML**

```html
<img src="data:image/png;base64,iVBORw0KGgo…" alt="banner">
```

**Markdown**

```md
![banner](data:image/png;base64,iVBORw0KGgo…)
```

Renders as:

![banner](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABQCAIAAADTD63nAAABU0lEQVR4nO3csU3DUBRAUUCIGVJlHLcwAVV2YIbsQJUJUmccJCRmoKKgthOR3IDNOe138WxdveZLvn0c3m/g0u5+ewCWSVgkhEVCWCSERUJYJIRFQlgkhEXifvr47eP1OnMwR+vVZuzIxiJxZGN9e3p+qedgXva77fQDNhYJYZEQFglhkRAWCWGREBYJYZEQFglhkRAWCWGROOkSeswwPFxqjr/jcPgcO1rk+06b+BrTbCwSwiIhLBLCIiEsEsIiISwSwiIhLBLCIiEsEsIiISwSwiIhLBLCIiEsEsIiISwSwiIhLBLCIiEsEsIiISwSwiIhLBLCIiEsEsIicdZvjH78j5uZ+m/vew4bi4SwSAiLhLBICIuEsEgIi4SwSAiLhLBICIuEsEicdAm9323rOVgYG4vEkY21Xm2uMwcLY2OREBYJYZEQFglhkRAWCWGREBaJL1tnFXf+b+eSAAAAAElFTkSuQmCC)

## Themed Images

`data-theme="light"` or `data-theme="dark"` on an `<img>` shows it in that theme only, following the header's theme toggle as well as the system setting; Livemark's `#light` and `#dark` endings on the `src` work too. Put the pair side by side:

**HTML**

```html
<img src="/screenshots/docs.webp" alt="The docs" data-theme="light">
<img src="/screenshots/docs-dark.webp" alt="The docs" data-theme="dark">
```

**Markdown**

```md
![The docs](/screenshots/docs.webp#light)
![The docs](/screenshots/docs-dark.webp#dark)
```

Renders as (toggle the theme to switch):

![The docs site in light mode](/screenshots/docs.webp)

The page's Markdown copy keeps only the light image.

## Image Zooming

Every image in a page opens full screen on click, unless a link wraps it; a click anywhere closes it. It works with internal, external and base64 images alike.

**HTML**

```html
<img src="screenshot.png" alt="The docs site">
```

**Markdown**

```md
![The docs site](screenshot.png)
```

Renders as (click it):

![The htmlpress components page with callouts in four colors](/screenshots/components.webp)

## Video Blocks

`<htmlpress-video type="youtube" url>` plays the video at its `url` (a `watch`, `youtu.be`, `embed`, `shorts` or `live` URL); without the script it stays a link:

**HTML**

```html
<htmlpress-video type="youtube" url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"></htmlpress-video>
```

**Markdown**

```md
::video{type="youtube" url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"}
```

Renders as:

<https://www.youtube.com/watch?v=dQw4w9WgXcQ>

## Audio Blocks

`<htmlpress-audio type="soundcloud" url>` plays the track at its `url`; without the script it stays a link:

**HTML**

```html
<htmlpress-audio type="soundcloud" url="https://soundcloud.com/flume/never-be-like-you-feat-kai"></htmlpress-audio>
```

**Markdown**

```md
::audio{type="soundcloud" url="https://soundcloud.com/flume/never-be-like-you-feat-kai"}
```

Renders as:

<https://soundcloud.com/flume/never-be-like-you-feat-kai>
