Course · Lesson 10 of 20

Style the page you own

Separate theme defaults, page CSS and reactive presentation without manipulating shadow roots.

Reading · Practice2 sectionsPrerequisites: Arrange an application with containers
Course contents

Start from the page resources

Gramlot loads a base theme before page styles. A matching stylesheet, such as appearance.css beside appearance.py, can style that page. Page.css lists additional stylesheet URLs. Compact and the other theme overlays modify the base rather than replacing the page model.

Use the Themes and CSS guide’s two-file example. The current public guide does not provide a root.css() API; do not copy an older experimental declaration into current course work.

Change presentation without changing meaning

Use application classes and supported component variables or parts. Styles outside a component do not automatically cross its shadow boundary. Keep host navigation styling separate from the CSS of an authored Gramlot Page.

The Style and visibility example makes presentation reactive. It also distinguishes visible, which keeps the layout space, from hidden, which removes that space. A layout change need not modify the underlying application value.

Your turn

Try it yourself

  1. Create the appearance.py and appearance.css files from the linked guide in your local project.
  2. Change one class rule, reload and compare the styled area with the rest of the page.
  3. Open Style and visibility and compare the space occupied by visible and hidden content.

Check your understanding

Should a new visual theme require rewriting the form’s Data bindings?

Show the answer and expected result

No. Theme and page CSS affect presentation. Keep the same literal bindings and inspect the rendered result. Use documented variables and parts for components rather than reaching into their shadow roots.

Working examples and reference