Skip to content

HTML block has a visual space on gutenberg #79716

Closed

Description

@TheRadicalDreamer

Description

I have created these separators in vector graphics using html.

They works perfect. But on gutenberg i can see a black space under it, which is not really present in the code.
Image
Image

Step-by-step reproduction instructions

  1. Create a HTML block
  2. Paste the following:
<svg style="margin-bottom:-10px; margin-top:-1px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none">
        <rect x="0" y="0" width="1000" height="100" fill="var(--wp--preset--color--accent-5)"></rect>
        <path fill="#198be8" d="M0,0h1000c-.07,19.72.07,39.9,0,59.61-137.89-39.69-249.32-45.15-323.62-42.92C389.89,25.31,193.08,155.29,49.97,50.85,24.82,32.49,8.74,12.2,0,0Z"></path>
</svg>
  1. Save and publish.
  2. It should look fine in the front end, but in gutenberg you'll have a blank space

Screenshots, screen recording, code snippet

Image Image

Environment info

wordpress 7.0
chrome 150
theme 2025

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Activity

  1. talldan commented on Jul 1, 2026

    @talldan
    Contributor

    @TheRadicalDreamer I couldn't reproduce this, so a reproduction might be dependent on your theme or style settings.

    For me I get a gap above the HTML block, which correlates to block spacing, and it's consistent in the editor and frontend.

    I can get rid of it by putting the HTML block in a group and then changing the following on a group:

    • Switch off 'Inner blocks use content width'
    • Set margin to zero
  2. TheRadicalDreamer commented on Jul 3, 2026

    @TheRadicalDreamer
    Author

    Are you using theme twenty twenty five??
    Can you show me how you see it?

    Can you get rid of the block spacing? and show me?

    i am trying to get what makes that blank gap, but i cannot see any indicators.

    Image

    only i can see is that space is for the HTML block, but it is not generated by the code inside it.

  3. talldan commented on Jul 6, 2026

    @talldan
    Contributor

    Can you look at the 'computed' styles tab to see if there's margin on the html block, or if it's from another element?

    Here's how it looks in a template with a pattern before and after the html block:
    Image

    Space above, which from the CSS I can see comes from this block spacing css rule:
    Image

    To solve it I put the HTML block in a group and then with the group selected switch off 'Inner blocks use content width' (makes the html block full width):
    Image

    Set the group block's margin to 0:
    Image

    After that there's no gap:
    Image

  4. TheRadicalDreamer commented on Jul 17, 2026

    @TheRadicalDreamer
    Author
    Image

    I still get the same issue.

    But when i edit the CSS of the block with browser inspection, i can get it right

    Image
  5. TheRadicalDreamer commented on Jul 17, 2026

    @TheRadicalDreamer
    Author
    Image

    I have my margins set to zero to the whole theme

  6. github-actions commented on Aug 2, 2026

    @github-actions

    Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks.

  7. added
    [Status] StaleGives the original author opportunity to update before closing. Can be reopened as needed.
    on Aug 2, 2026
  8. TheRadicalDreamer commented on Aug 4, 2026

    @TheRadicalDreamer
    Author

    i cannot repro what you did.

    Are you using twenty twenty five theme??

  9. TheRadicalDreamer commented on Aug 4, 2026

    @TheRadicalDreamer
    Author

    I tried on the playground and i still get the same issue:

    Image Image

    It has something to do with the DIV of the HTML block

  10. talldan commented on Aug 4, 2026

    @talldan
    Contributor

    Can you identify the style that causes it?

  11. removed
    [Status] StaleGives the original author opportunity to update before closing. Can be reopened as needed.
    on Aug 5, 2026
  12. talldan commented on Aug 5, 2026

    @talldan
    Contributor

    I can repro with that playground link, but I can't see what it is either. I see that the iframe is given a height attribute, which can account for some of the gap, but you're right that the wrapper div of the html block also has some empty space as well. 🤔

  13. sanketio commented on Aug 24, 2026

    @sanketio
    Contributor

    This looks fixed on trunk. Tested the SVG from the report in a Custom HTML block — no gap in the editor, and the block box is 61px against the SVG's 65px, so the negative margins apply as intended.

    The iframe you spotted is gone. #79115 moved the block from the sandboxed Preview to InnerContent, so the content renders inline in the canvas:

    -<Preview content={ attributes.content } isSelected={ isSelected } />
    +<InnerContent clientId={ clientId } />

    That landed in 50ddbc1f6ed on 2026-06-29. It was a feature PR, so it didn't reference this issue. The Playground link in the thread pins an older Gutenberg, which is why it still reproduces there.

  14. TheRadicalDreamer commented on Aug 24, 2026

    @TheRadicalDreamer
    Author

    on which version will be available?

    So i can check when it comes?

  15. skorasaurus commented on Sep 8, 2026

    @skorasaurus
    Member

    on which version will be available?

    So i can check when it comes?

    This was included on Gutenberg 23.6 and it should be also included on WordPress 7.1

    Please reopen if you are still able to reproduce this in Gutenberg 23.6 or newer versions.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] HTMLAffects the the HTML Block[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions