8000 Content Positioning Inconsistency in Reveal.js Across Different Screen Sizes · Issue #3762 · hakimel/reveal.js · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Content Positioning Inconsistency in Reveal.js Across Different Screen Sizes #3762
Open
@ChanMeng666

Description

@ChanMeng666

When using Reveal.js to create presentations with positioned content boxes, there's an inconsistency in how content is displayed across different screen sizes. Specifically:

  1. When the browser window is reduced in size (not maximized), all text content is fully visible.
  2. When the browser window is maximized, the upper portion of text content becomes cut off or invisible.

This behavior suggests a potential issue with how Reveal.js handles absolute positioning in responsive contexts.

Reproduction Steps

  1. Create a slide with a content box that uses absolute positioning with percentage-based values
  2. Position the content using top percentage values (e.g., top: 50%)
  3. Use transform: translate(-50%, -50%) for centering
  4. View the presentation in a maximized browser window
  5. Resize the browser window to be smaller
  6. Notice the difference in content visibility between the two states

Expected Behavior

Content positioned with absolute positioning should be consistently visible regardless of browser window size. Elements positioned with percentage-based values should scale proportionally while maintaining their visibility.

Actual Behavior

Content is fully visible when the browser window is smaller, but when maximized, the upper portion of content becomes cut off or entirely invisible.

Attempted Solutions

Solution 1: Using bottom instead of top positioning

.content-box {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    /* other styles */
}

Result: This caused all content to completely disappear, with only fixed position elements like the "AI-Powered Assistant" label remaining visible.

Solution 2: Using adjusted top percentages with modified transform

.content-box {
    position: absolute;
    top: 75%;
    left: 50%;
    transform: translate(-50%, 0);
    /* other styles */
}

Result: This solution worked correctly, showing that Reveal.js has compatibility issues with certain positioning approaches.

Solution 3: Adding responsive adjustments

@media (max-height: 700px) {
    .content-box {
        top: 70%;
    }
}

@media (max-height: 500px) {
    .content-box {
        top: 65%;
    }
}

Technical Details

  • Reveal.js version: Clone on 2025/03/14
  • Browser: Chrome Version 134.0.6998.89 (Official Build) (64-bit)
  • OS: Windows 11 (64-bit)

Conclusion

There appears to be an incompatibility between Reveal.js's presentation rendering and certain CSS positioning techniques, particularly:

  1. Bottom-based positioning (bottom: Npx) causes elements to disappear completely
  2. Default top-based positioning with vertical centering (top: 50%, transform: translate(-50%, -50%)) causes content to be cut off in maximized browser windows

The workaround is to use top-based positioning with a higher percentage value and remove the vertical transform component:

top: 75%;
transform: translate(-50%, 0);

This issue affects the creation of responsive presentations and requires developers to use specific positioning techniques that may not be intuitive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0