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]
- Separate Media Library for each user
- Separate attachment images from post loop
- alt, title tags not showing
- Why can’t I edit certain images from the WordPress Media library?
- How can I store an image in the database with Transients API?
- WordPress url image redirect to the homepage
- Is there a way to delete images from WordPress media library programmatically?
- Why isn’t “background-image: url”working with Bootstrap carousel on WP?
- Special purpose photos with each post
- WordPress – different icon image depends of comment number
- Turn off image captions in gallery view?
- Unyson Framework doesn’t show gallery images
- add_shortcode to capture URL screenshot not loading correctly
- Show image crop window on image upload
- Uploaded images not displaying in network site
- Link listings with image
- After Migration, images show up on a preview of the page but not the actual page [closed]
- How to apply image alt descriptions from media library?
- Specify automatically the height and weight of the images
- How to crop images in a certain size only for a certain page?
- How to pass on a value as parameter via url to another page
- Using different size thumbnails on different parts of my site… with functions.php?
- Pictures randomly replaced by blue question mark
- How to skip the creation of landscape thumbnails for an original portrait image
- Why are my button images blurry on mobile screens?
- Broken imges after moving wordpress website from localhost to server [closed]
- How to regularly backup and update WordPress website with lot of images?
- Resize images to match CSS
- How to put images into theme from server folder (not from media library)
- Select image and display from textfield?
- add_image_size() width not actually working
- Get content from one WordPress website to another
- My subdirectory sites images (except webP) are throwing to 404 page even they are exist
- Multisite image URLs incorrect in editor
- Load Webp Version of Image if it exists
- Convert User’s Avatar/Gravatar to a jpg or png on the Fly
- Placing a background image with text over it
- How can I use an image from an external source without uploading it to the media library
- Can’t upload svg files in WordPress
- Images uploaded in customized gallery do not link to media
- WordPress Site Broken and it gives Headers Already sent error