I am using a custom theme based on Quark and I have set the position of some navigation buttons on the home page of my website by absolute pixel values to create a circle of buttons around a round logo.
It looks nice on desktop but is totally messed up on a mobile device. But when I tell my mobile browser to show the desktop version of the page, it is shown correctly.
That’s why I am searching for a way to prevent mobile devices to use the mobile version of te website on that one home page wile still using the mobile version on all other pages.
I thought there could be some frontmatter value for that purpose? But I didn’t find something.
Is it possible to force desktop mode for one single page?
Hello and thanks for that hint.
But to be honest, I do not know how to use this within a grav page. Should I just write the html code inside the (markdown) page?
do you know css ?
if so
mobile version is just a css rule
like " if width of page is less than this do this"
so if you just add a new rule like that after “existing” one, that would just work.
you can use browser to find what to add
go to the page you want to change
open inspect at browser
select navigation
search for width rule of it like “@media (max-width: 640px)”
play with it
.
.
.
lastly) good night, sleep well, cya ^^.
Thanks!
That sounds promising.
I am not sure where exactly to add that rule in the particular page. But I will try around (as soon as I find the time - I hope tonorrow in the evening).
That’s the only thing I could perhaps associate with the way the page is shown. But: It is loacted in the meta part - so before the body tag is opened. That’s why I think it is difficult to influence this on a per page basis…
What do you think?
Update pamtbaau: Added backticks surrounding the <meta> element
Sorry - unfortunately the code was interpreted and thus not shown - I edited the last post using a code block now so that you can see what I meant (meta viewport tag).
I am quite familiar with HTML and I am getting familiar with css in the last weeks as I am using Grav now as well as Marp.
What I am not familiar with is Grav’s details as well as responsive websites…
i didnt say source code, i said inspect. there you can see and try css codes that effects html elements. you may search about this topic on web and try it after reading and watching some videos again
I don’t know your website, nor your use-case and user base, so my reply might miss the point for you.
I am quite familiar with HTML and I am getting familiar with css in the last weeks
The approach you are taking smells like the proverb: “If all you know (have got) is a hammer, all problems look like a nail”.
Considering that across Europe, mobile visitors outnumber desktop users, you might consider taking mobile first in mind when designing a webpage.
I would suggest to study MDN: Responsive Design to learn how to design a website that fits both mobile and desktop users.
You will learn among other things about Media Queries and relative units that allow you to use css rules for specific screen sizes.
If your use-case really requires to show a “desktop” version of a single page, you could try the following in your Quark based custom theme (not sure if it works in your use-case):
Copy file /user/themes/quark/templates/default.html.twig into /user/themes/mytheme/templates/home.html.twig .
This was the main point. By using another template (here “home”) instead of the default one which is used for the other pages it was possible to control that single “home” page.
Now I was playing with the viewport options and the initial-scale and I have what I need.