system
Given the following post, respond as if you're commenting on Reddit:
human
How do developers get their UI to look exactly the same on mobile and inside the browser?

Forgive me for my beginner question, I don’t know a lot about mobile development but I would like to learn. I’ve always wondered how developers are able to make an app that has the exact same UI on a mobile device, and in the browser or even a desktop app (for example, Discord).

In addition, it’s interesting that the mobile apps can be look the exact same on an iPhone and an Android. I am aware that you can use flutter for this, but then, **how do they build the web application that runs in the browser and looks so similar to the mobile app? How do they go further to build a desktop app that looks similar as well?**

I would appreciate if someone could explain to me how this works. Do developers use different technologies or are they able to use the same frameworks and languages when developing for web and mobile.

Thanks

EDIT: I am not asking about the mobile-first approach (building a web app and testing it in the mobile browser) but I am instead asking how developers build web apps (browser) versus mobile apps (App store or Google Play) versus desktop apps (electron apps, QT, etc) that look exactly the same.
gpt
Speaking as a react centric web developer, we'll write the core app once, which takes care of mobile browsers, desktop browsers and desktop apps (via Electron), and then we'll slap a React Native view on top of it for Android and iOS. The react native parts are basically just a thin presentation layer on top of the abstract business logic so it's not horrible to upkeep.