One page column order on mobile
-
Sorry to start yet again a thread on column order then displaying on mobile.
My home page has 3 columns (1,2,3) that I wish to display as (2,1,3) only in the mobile view for the Home page. I searched and found a number of threads on WordPress forums addressing this same question and found the following code that works fine for all the pages on the site:
@media only screen and (max-width: 600px) { .wp-block-columns :nth-child(1) { order: 2; } .wp-block-columns :nth-child(2) { order: 1; } .wp-block-columns :nth-child(3) { order: 3; } }
I entered this in the Styles for the page Template:
Appearance -> Editor -> Templates -> Page no Title -> (edit) -> Styles -> Additional CSSI also found a reference elsewhere to using the .page-id number to target only that one page.. I opened the Home page in a browser, copied and pasted the code into Notepad++ and found the “body class = “home page-template page-template-page-no-title page page-id-6 logged-in …”. I’m now stuck with where to put the .page-id-6 in the above code so it works.
I tried:
.page-id-6 @media only screen and (max-width: 600px) { .wp-block-columns :nth-child(1) { order: 2; } .wp-block-columns :nth-child(2) { order: 1; } .wp-block-columns :nth-child(3) { order: 3; } }
But the mobile column order remains the same (1,2,3)
Am I on the right track to solving this?
If so, what have I done wrong?
Note that I’m still a 1-month old WordPress Newbie, but have some prior experience designing traditional HTML/CSS sites using Grid and Flex. As a learning project I’m duplicating the look and function of a small site I previously made with Atom using grid-template columns, rows, and areas to define the mobile and desktop display block positions and order.
Thanks for any help.
- The topic ‘One page column order on mobile’ is closed to new replies.