Skip to content

Theme.json styling for image gets unexpected results for background and border #33794

@karmatosed

Description

@karmatosed

I am currently experiencing some unexpected results for border and background on the image block when using theme.json. The following is what I have set:

				"color":{
					"background": "currentColor"
				},
				"spacing": {
					"margin":{
						"bottom": "var(--wp--custom--margin--vertical-large)",
						"top": "var(--wp--custom--margin--vertical)"
					},
					"padding": {
						"bottom": "1px",
						"top": "1px",
						"right": "1px",
						"left": "1px"
					}
				}
			},

The result is:

image

Whilst this is a certain 'look', I don't really want that space at the bottom. I tried the above to get around the problem of no border working.

In addition to this, I find myself unable to set the border properties to the image block at all. It won't output. For example:

				"border": {
					"color": "currentColor",
					"style": "solid",
					"width": "1px 1px 1px 1px"
				}

This doesn't seem to work at all on image block when I output to the front. It works in the editor but doesn't on the front of my site.

I understand it might be something I am doing, but it seems there are also potentially 🐛 lurking in this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Priority] LowUsed to indicate that the issue at hand isn't a top priority to address and can be handled later[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions