Skip to Content
Menu
This question has been flagged
1 Reply
3057 Views

Dear all,


We have a website for which we would like to use a separate template for the mobile version. We have not found any documentation on how to do it. How can we do this? 


Best,

Avatar
Discard
Best Answer

Hi,

For that, you need to create two templates, One desired for the desktop and the other one desired for mobile. Next what you have to do is do the styling for both templates using media query. Choose the screen width to show the mobile screen view and using the class or id for the top tag of mobile view and desktop view, give css as follows.

@media (max-width: 'give the screen width') {
'selector for mobile template' {
display: block;
}
'selector for desktop template' {
display: none;
}
}

Please note that first you need to give 'd-none' in mobile template to hide it in normal screen.

Or you can also achieve this using bootstap classes.

Screen size Class
Hidden on all                 .d-none
Hidden only on xs          .d-none .d-sm-block
Hidden only on sm         .d-sm-none .d-md-block
Hidden only on md         .d-md-none .d-lg-block
Hidden only on lg            .d-lg-none .d-xl-block
Hidden only on xl            .d-xl-none .d-xxl-block
Hidden only on xxl          .d-xxl-none
Visible on all                   .d-block
Visible only on xs           .d-block .d-sm-none
Visible only on sm          .d-none .d-sm-block .d-md-none
Visible only on md          .d-none .d-md-block .d-lg-none
Visible only on lg            .d-none .d-lg-block .d-xl-none
Visible only on xl            .d-none .d-xl-block .d-xxl-none
Visible only on xxl          .d-none .d-xxl-block

Regards

Avatar
Discard
Related Posts Replies Views Activity
0
May 20
1983
1
Jun 24
2406
1
Oct 22
2552
1
Dec 21
3242
1
Feb 21
1093