Skip to content

fix(image): use CSS styles for width/height to support percentage values#9966

Open
allin2 wants to merge 1 commit into
marimo-team:mainfrom
allin2:fix/image-video-height-100
Open

fix(image): use CSS styles for width/height to support percentage values#9966
allin2 wants to merge 1 commit into
marimo-team:mainfrom
allin2:fix/image-video-height-100

Conversation

@allin2

@allin2 allin2 commented Jun 23, 2026

Copy link
Copy Markdown

Summary

The ImageOutput component used HTML attributes for width/height, which only accept pixel values. This prevented percentage values like '100%' from working.

Motivation

Fixes #9810

Users reported that setting height=100% on images and videos did not work.

Changes

  • fix: Changed ImageOutput to use CSS styles instead of HTML attributes for width/height
  • CSS styles support both pixel values and percentage values
  • Numeric values are still converted to pixel strings (e.g., 100 → "100px")
  • String values like "100%" are passed through as-is

Validation

  • mo.image(src, height=100) still works (converted to "100px")
  • mo.image(src, height="100%") now works correctly
  • mo.image(src, width="50%") now works correctly

Checklist

  • Code follows the project's style guidelines
  • Tests pass
  • No unrelated changes included
  • Commit message follows Conventional Commits format

Review in cubic

The ImageOutput component used HTML attributes for width/height, which
only accept pixel values. This prevented percentage values like '100%'
from working.

Changed to use CSS styles instead of HTML attributes, which support
both pixel values and percentage values.

Fixes marimo-team#9810
@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jun 23, 2026 12:25pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

height=100% does not work on images and videos

1 participant