It depends on your image and stylesheet location.
But this is the syntax:
.theme-image {
background-image: url('../images/header-img.jpg');
}
The above code is for the structure
wp-content
- themes
- your-theme
- images
- header-img.jpg
- css
- style.css
You are making the browser come one directory before and search for images directory.
Related Posts:
- @wordpress/create-block image url in css
- How do I get the avatar URL instead of an HTML IMG tag when using get_avatar?
- Programmatically get images by URL and save in uploads folder
- Function to get URL of original uploaded image – full size
- Mixed content warnings after changing site adress from HTTP to HTTPS
- Making WordPress Gallery (.gallery-item) Responsive?
- Adding HTML within an image title attribute
- Preview Image Path in Admin Section
- Add CSS class to every image
- Why would image paths in wordpress suddenly change?
- How to Make WordPress Default gallery responsive on mobile?
- Responsive background images added inline
- Remove the http protocol from images
- How do i reference the theme path in pages for images?
- WordPress url image redirect to the homepage
- Broken urls with http site and https wp-admin
- A way to change image urls in post to cdn image url?
- How to change image url?
- Update image links in database
- Shortcode for a link and thumbnail
- media_sideload_image with rewritten urls?
- 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 add an image to a custom url?
- How to handle a background-size: cover image in WordPress?
- images not showing after transfer
- Background-image not showing? [closed]
- Change media URL (images)
- t5-fresh-editor-stylesheets.php breaks image placement in WP Beta 3 editor
- Redirect to another page using contact form 7? [closed]
- How do I get my main image to stretch the full length of the screen?
- How to redirect homepage to actual URL?
- Clicks registering on Preview DNS site
- How to upload and style svg logo?
- How would you add sequentially numbered labels to images in posts?
- css to fit image by HEIGHT
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- Using a .pdf file as a page in wordpress
- How to get image URL from media_sideload_image?
- How to implement CSS-defined images from bootstrap site in wordpress theme
- Exclude image url from search query
- a: hover issue with image issues [closed]
- Redirect Image Url to a page via htaccess
- 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]
- How to pass on a value as parameter via url to another page
- How to replace post image url before posting using api?
- 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?
- Hide or mask the url to an image
- Landing Page with HTML CSS JS and Images on wordpress
- Glitched page redirects to image
- i want to change URL of WordPress image or rewrite in runtime
- How to show a full page when someone links directly to an image on my site
- How to change background image
- 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?
- How to display posts with images in fullscreen slider
- Bypass wp_safe_remote_get()?
- 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?
- Which tools should I use for a gallery that uses an API and url for the path of the images?
- List sub pages with custom field content converting image ID to URL
- Image thumbnail on single product issue | WooCommerce
- Background image call problem
- all images of past post messed up after changing theme
- Change the image for a certain URL
- Custom styling Insert Media window
- Setting name of attachment URL
- Search and replace image urls in posts
- Protocol relative url not pulling up images on IE, FF, and OPERA
- 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
- Broken image URL
- How do I mitigate the forward slash problem for URLs of images after a WP migration?
- Is there a good way to use CMS images with CSS
- Images in sub-pages fail to load
- get_post_custom: get image URL instead of image ID
- Are image addresses security relevant?
- Stop underlining image links
- Font size on image captions on mobile
- Parallax image problem
- Remote Image (from URL) as Media Library element
- 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]
- WPALLIMPORT Exporting images from repeater field [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]
- Is there a way to add background-image to theme.json?