Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By sstavridis on
Hi,
is there any way so I can make a responsive image style for background images?
Thanks.
Comments
You can set breakpoints and
You can set breakpoints and change the background image based on breakpoint.
If you want to use image styles, it becomes a little more tricky. You'll first need to upload your source images to the files directory. Then you will have to figure out what the URL should be using something like this for each image style. You will then use those URLs in your CSS:
Note that you'll need to change 'thumbnail' to the machine name of the style you want to output. Also note that you can't use PHP in CSS files, so you're going to have to use this PHP code just to figure out what the URLs should be. This code likely will not become part of your final code.
Thanks! I'll try it!
Thanks! I'll try it!