headers - How to make custom_header_setup() image as background image?

admin2025-04-17  2

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?

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?

Share Improve this question asked Feb 9, 2019 at 19:28 Mix911Mix911 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 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>
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1744857255a270903.html

最新回复(0)