--pdf-page-bar-side

Works in all major browsers
Since July 2026

WebPDF works in Chrome and Edge 125, Firefox 153 and Safari 18, on desktop and mobile, and in every later version: the oldest versions its PDF.js build supports, which already have every platform feature WebPDF needs. Since July 2026, that is every major browser.

The --pdf-page-bar-side CSS custom property sets the edge of a <pdf-page> that the bar of its viewer controls sits on. It is typed: WebPDF registers it with CSS.registerProperty(), so it takes one keyword out of a fixed set, inherits, and starts out as bottom.

Syntax

css
/* Physical edges */
--pdf-page-bar-side: bottom;
--pdf-page-bar-side: top;
--pdf-page-bar-side: left;
--pdf-page-bar-side: right;

/* Flow-relative edges */
--pdf-page-bar-side: block-start;
--pdf-page-bar-side: block-end;
--pdf-page-bar-side: inline-start;
--pdf-page-bar-side: inline-end;

/* Global values */
--pdf-page-bar-side: inherit;
--pdf-page-bar-side: initial;
--pdf-page-bar-side: revert;
--pdf-page-bar-side: revert-layer;
--pdf-page-bar-side: unset;

Values

bottom

Across the bottom edge, its menu above it. This is the initial value.

top

Across the top edge, its menu below it.

left or right

Upright along the left or the right edge, its menu beside it.

block-start or block-end

The start or the end of the page's block flow: its top or its bottom, or its right or its left in a page whose writing-mode is vertical-rl.

inline-start or inline-end

The start or the end of a line: the left or the right edge, the other way round in a right-to-left page (dir=rtl), and the top or the bottom in a vertical one.

Description

The edge matters on a page with controls. To take the bar away, leave the edge alone and add notoolbar to controlslist: the keys and gestures keep working.

The property is inherited, like caption-side: set it on a page, on any ancestor, or on :root for every page. A <pdf-file> passes it on only to the pages inside it; pages that name their file with of sit elsewhere in the document, so select them, for example with pdf-page[of=report].

Because it is registered, its value is checked when the page's style is computed. A value that is not one of the keywords, such as a typo, or TOP (keywords are case-sensitive), is invalid at computed-value time: it acts like unset, so the page takes its parent's edge.

getComputedStyle() returns the keyword as written, a flow-relative one included. The page resolves it against its own writing-mode and direction; a page is laid out horizontally unless you set writing-mode on pdf-page itself.

The bar moves as soon as the value changes, whether a class, a media query or a container query changed it. On the left or the right edge it stands upright, as a vertical toolbar.

Formal definition

Initial valuebottom
Applies to<pdf-page> elements
Inheritedyes
Computed valueas specified
Animation typediscrete

Formal syntax

css
--pdf-page-bar-side =
  top | right | bottom | left | block-start | block-end | inline-start | inline-end

Examples

Moving the bar to the top

HTML

html
<pdf-file id=f src=//pdf.ist/web.pdf></pdf-file>
<pdf-page of=f controls scale=0.5></pdf-page>

CSS

css
pdf-page {
  --pdf-page-bar-side: top;
}

Result

A bar at the end of a line

In a right-to-left page, inline-end is the left edge.

HTML

html
<pdf-file id=f src=//pdf.ist/web.pdf></pdf-file>
<pdf-page of=f controls dir=rtl scale=0.5></pdf-page>

CSS

css
pdf-page {
  --pdf-page-bar-side: inline-end;
}

Result

A rail on wide screens

On a wide screen the bar stands upright at the end of a line; on a narrow one it goes back to the bottom.

HTML

html
<pdf-file id=f src=//pdf.ist/web.pdf></pdf-file>
<pdf-page of=f controls scale=0.5></pdf-page>

CSS

css
@media (width > 40rem) {
  pdf-page {
    --pdf-page-bar-side: inline-end;
  }
}

Result

Following the bar with your own layout

A registered property also works in style queries. Here a caption moves away from the rail:

css
.viewer {
  --pdf-page-bar-side: left;
}
@container style(--pdf-page-bar-side: left) {
  .viewer figcaption {
    text-align: end;
  }
}

Specifications

Not part of any specification. <pdf-file> and <pdf-page> are autonomous custom elements defined by WebPDF.pro. It implements:

Specification
CSS Properties and Values API Level 1
# the-registerproperty-function
CSS Custom Properties for Cascading Variables
# defining-variables
CSS Logical Properties and Values Level 1

Browser compatibility

desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
--pdf-page-bar-side
1251251531111812515383182712518

Legend

Full support

See also