0

I have created a function that enables Header Image in Wordpress (5.0.3) ACP. My HTML code treats that image as normal image (not background).

<img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />

How can I make my custom header as background image?

1 Answer 1

0

Because you have used it as an image. <img src="//..." height="..." width="..."/>

This code is used to display images, not background images.

Use it with text:

<div style="background-image: url(../images/test-background.gif); height: 200px; width: 400px; border: 1px solid black;">Example of a DIV element with a background image:</div>

Or without text:

<div style="background-image: url(../images/test-background.gif); height: 200px; width: 400px; border: 1px solid black;"> </div>

Source is enter link description here

I tried it with the header tag...

<header style="background-image: url(.../images.png)";>
Your text here.
</header>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.