Background image in theme.json is not yet supported
In your theme.json file, you can define a CSS class name for the element that you want to add the background image to. For example:
"styles": {
"hf-bg": {
"backgroundColor": "#ffffff"
}
}
In this example, we’ve defined a style called hf-bg that sets the backgroundColor property to white. You can then add custom CSS to your theme to apply a background image to this element. For example:
.hf-bg {
background-image: url('assets/images/hf_bg2.png');
}
This CSS will apply a background image to any element with the class hf-bg. Make sure to adjust the URL to the location of your image file relative to your theme’s root directory.
Related Posts:
- How to reference a theme image in a stylesheet?
- Making WordPress Gallery (.gallery-item) Responsive?
- Adding HTML within an image title attribute
- Width 100%: Aspect ratio of image
- Add CSS class to every image
- How to Make WordPress Default gallery responsive on mobile?
- Responsive background images added inline
- @wordpress/create-block image url in css
- Get all post media images via WP REST API
- How can I upload an image for background use using the Theme Editor in WordPress?
- Override img class in gallery
- Multiple amp-image overlays. How to properly do this in wordpress?
- Image not shown in the theme as it’s showing in HTML template [closed]
- How to handle a background-size: cover image in WordPress?
- Background-image not showing? [closed]
- t5-fresh-editor-stylesheets.php breaks image placement in WP Beta 3 editor
- How do I get my main image to stretch the full length of the screen?
- How to upload and style svg logo?
- How would you add sequentially numbered labels to images in posts?
- css to fit image by HEIGHT
- How to implement CSS-defined images from bootstrap site in wordpress theme
- a: hover issue with image issues [closed]
- All 3?: Responsive resizing of images + image width of actual image for small images + max-width for all larger images
- Moving an image to the side [closed]
- Image Captions Have a 10px Extra Margin, And It’s Not CSS? [duplicate]
- Can i have 2 separate Galleries on 2 separate pages each go to a DIFFERENT Attachment.php file?
- Image modification
- How to remove image size inline style in article and include caption
- Is there a layout to place 2 same sized images in two columns on the WordPress page?
- Landing Page with HTML CSS JS and Images on wordpress
- How to change background image
- Images names not inserting in WordPress Database from Dynamic Add / Remove fields
- Change header image size
- Adding custom html/css/images to Theme
- Is there a way to create referable automatic numbering in image captions?
- Why do images inserted in the post content via the_content() go off the max-width?
- How can we achieve this image css style?
- Remove image border in twentyeleven theme [closed]
- How to display posts with images in fullscreen slider
- Using a full-width hero image that can be changed in the dashboard by a user
- Put image onto header
- Are WP images responsive by default?
- Image thumbnail on single product issue | WooCommerce
- Background image call problem
- all images of past post messed up after changing theme
- Custom styling Insert Media window
- Display ajax preloader for large images within posts
- An image on my site is showing as the wrong image [closed]
- Theme files and imagesnot loading on a mobile device
- Is there a good way to use CMS images with CSS
- change with CSS the color of an svg background image set with “background-image: url()”
- Stop underlining image links
- Font size on image captions on mobile
- Parallax image problem
- Theme using masonry layout script rendering overlaped images in Google Chrome [closed]
- Why is inline CSS added to images automatically? [closed]
- Create decorative image border with CSS? [closed]
- WordPress update leads to 404 error on admin page and signup. CSS mishap with all plugin related functions
- I am having trouble displaying an image at the top of a widget area [closed]
- CSS how to target the caption of one individual image?
- How do I set attributes for all images in a site
- How do I delete all UNUSED images from my uploads directory?
- Why is wp_get_attachment_image_src not working with my custom size (add_image_size)
- Set Custom Post feature image as og:image
- Programatically creating image attachments from local URLs and setting featured image
- Applying class to links around self hosted images embedded to posts/pages
- Why does wordpress generate more thumbnails than the 3 standard sizes?
- WordPress Child Theme Calling Images
- including image assets in widget
- Link Featured Thumb to Attachment Page, If Possible
- Is there a shortcut to change bulk BMP images to JPG images in a site?
- Add instructions to featured image
- Image resize using url parmater
- Copying and pasting emoji in a wordpress post
- How can I use cached images in an AJAX response?
- Is it a good practice to change media settings on theme activation?
- Function to remove all classes on images inserted into posts?
- Images don’t update after being edited
- Display post image in a size defined by add_image_size()
- IMG size is set to width=”964px” or “100%”, but is shown as “634px” in browser
- big trouble with javascript
- get rid of random string before an for an image path on wordpress
- Using srcsets in a custom block
- Product Gallery Images to go into full size on Product Page
- How to Display Image Caption but Not Alt Text
- I want to create a hero image with text and a button on my front page. How can I do this?
- Why image Thumbnail url is not displaying with custom size?
- add_image_size limiting sizes (???)
- Automatically generate multiple image sizes for element
- Is it possible to remove spaces from existing images? [closed]
- How to have a specific image show up for everyone who comments?
- php.ini -Theme-specific settings
- Display X images from a gallery in the sidebar
- Where do you upload images on a wordpress site?
- How do you add text to a carousel of images like here in this example
- WordPress API, creating Featured Media from image url (nodejs)
- Attachment tag archive
- Replace image with its alt text?
- How do you detect when an image has been deleted from WordPress media library?
- How to disable featured image from inside of the blog post?