Archived topic
Header Element background image
3 replies · Started by Matthew on January 29, 2019
Hi,
I am not sure if I am going about this the right way, I want to feature an image at the top of my category.
So I have used the Header element and set a background image but it doesn't appear unless I add in content so I added in some <br> tags, is there a better cleaner way to do this?
Also how do I set the ALT attribute for this image? Does it just take it from what's set on the image in Wordpress media library?
Cheers.
Hi there,
The Header Element has to have some content in it for it to display. I would use a HTML comment which doesn't display on the front end:
<!-- page header -->
The images are loaded as background images so their is no ALT tag like you would have in an <img>
Is there a way to add alt tags to background images?
I've tried inserting the image as a single image (I'm using WPBakery Page Builder), but there is a margin on the left and right. I prefer to insert the image as a background image so that it consumes the full width.
Thanks!
You can't add an alt tag to background images by nature unfortunately as background image as simply applied using CSS.
Please open a new topic if you have further questions on this.
Thanks!