How can I determine different font values on different devices?

Hello community, how are you?

I come through this thread to ask for help with a problem that has been bothering me a lot: different ways of presenting a note on different devices. I talk about this topic specifically about font sizes. I use Obsidian on IOS phone, Android tablet and PC. I didn’t get the expected result from the existing topics on the forum.

What I’m trying to do

Trying to obtain specific CSS classes for each device and thus keep them fixed from the moment I enter Obsidian on each device. This way, I can use a Snippet to solve a problem.

Things I have tried

Help in the community because I’m new to the subject :wink:

Thank you in advance :pray:t2:

There are some mobile specific selectors listed in this post:

Hopefully they can get you started.

Oh, I see you were the one who asked in that topic. :slightly_smiling_face:

1 Like

You can also change the configuration folder per device. See this answer, and note that all configurations become separate, including plug-ins.

Note: The location of the override changed sometime after the above post to Settings → Files and folders → Override config folder.

2 Likes

This is more of an idea, than a solution, but wouldn’t it be possible to use some startup script (like the startup template of Templater, or a javascript using one of many javascript plugins), to actually set a variable at the top level of the DOM, and then use for further selection?

I’m thinking checking for something like navigator.appVersion, navigator.userAgent or navigator.platform, and then set a dedicated class somewhere near the top of the DOM? Shouldn’t that work? The following article further enhances this approach:

Here it states that you should be able to use navigator.userAgentData.platform and navigator.userAgentData.mobile , and do some magic based upon these values. And yes, Obsidian is way beyond Chromium 84 where this was firstly enabled.

1 Like

Thank you for your attention. In fact, I had already posted similar help but I believe this is proof that I have content adaptability problems depending on the device used, be it the font size or even the theme (taking advantage of the opportunity, is it possible?)