Site icon Hip-Hop Website Design and Development

How to display different blocks for mobile and desktops

I want to display a fixed banner from the bottom left of the screen. But at the same time, the banner is different for desktops and mobile devices.

Please tell me. How can I determine the user’s device? For this, can I use the wp_is_mobile function? As I understand it, wp_is_mobile identifies the device by the user agent of the browser.

PHP code is very simple. Something like the following?

<?php if (wp_is_mobile()):?>

<div class="mobile_banner"><img src="mobile.png"></div>

<?php else:?><div class="desktop_banner"><img src="desktop.png"></div><?php endif?>

Is this the correct way to determine the user’s device?

There is another if_is_mobile function. Please advise me. Confused a little bit.