- This topic has 24 replies, 2 voices, and was last updated 3 years, 9 months ago by Leo.
-
AuthorPosts
-
December 1, 2015 at 6:55 am #157051Jitske
Hi,
I would like to change the order of the blocks when I open the website on a mobile devise.
I have sidebar left, sidebar right, main content.
Now it shows:
Main content, sidebar left, sidebar right.
But I ould like it to show:
Sidebar left, main content, sidebar rightWhat do I have to change to get this?
Thanks for your help!December 1, 2015 at 11:44 am #157121TomLead DeveloperLead DeveloperMoving HTML around with CSS never used to be possible, but there’s some new CSS3 that does just that:
@media (max-width: 768px) { .site-content { display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-flex-flow: row wrap; flex-flow: row wrap; } #left-sidebar { -webkit-box-ordinal-group: 1; -moz-box-ordinal-group: 1; -ms-flex-order: 1; -webkit-order: 1; order: 1; } .content-area { -webkit-box-ordinal-group: 2; -moz-box-ordinal-group: 2; -ms-flex-order: 2; -webkit-order: 2; order: 2; } #right-sidebar { -webkit-box-ordinal-group: 3; -moz-box-ordinal-group: 3; -ms-flex-order: 3; -webkit-order: 3; order: 3; } }
- This reply was modified 7 years, 11 months ago by Tom.
December 1, 2015 at 11:50 am #157122JitskeYesss!! That’s exactly what I was looking for!
Thank you so much.December 1, 2015 at 11:50 am #157124TomLead DeveloperLead DeveloperYou’re welcome.
Just a heads up that it won’t work on older browsers – mainly old versions of IE.
May 5, 2016 at 3:30 pm #192097Nate HeathWould there be any change to this code if you were only looking to do it on the home page?
May 5, 2016 at 9:36 pm #192147TomLead DeveloperLead DeveloperYes, add .home in front of each selector.
So:
.site-content
Becomes:
.home .site-content
#left-sidebar
Becomes:
.home #left-sidebar
And so on π
March 14, 2017 at 10:42 am #291303ThierryHello,
I want right sidebar in first and content in second :
@media (max-width: 768px) {
.site-content {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
}#right-sidebar {
-webkit-box-ordinal-group: 1;
-moz-box-ordinal-group: 1;
-ms-flex-order: 1;
-webkit-order: 1;
order: 1;
}.content-area {
-webkit-box-ordinal-group: 2;
-moz-box-ordinal-group: 2;
-ms-flex-order: 2;
-webkit-order: 2;
order: 2;
}}
The code is correct ? but don’t work
March 14, 2017 at 10:46 am #291305LeoStaffCustomer SupportHi Thierry,
Yup that code looks good. I just tested it and it works on my site.
Can you provide a link to your site where it’s not working?
March 14, 2017 at 11:14 am #291336ThierryMarch 14, 2017 at 11:23 am #291341LeoStaffCustomer SupportHmm I don’t see the CSS being added.
Can you try clearing the cache in WP Rocket?
March 14, 2017 at 11:56 am #291362Thierryi disable wp rocket and i add the css with simpleCss but it’s the same thing π
March 14, 2017 at 12:15 pm #291365Thierrywith “aditionnal css” it’s ok π
i try with simpleCss later, thx LΓ©o
March 14, 2017 at 12:30 pm #291374LeoStaffCustomer SupportGlad you got it working π
February 25, 2019 at 1:29 pm #821361ChantalHi there,
Very basic question
How would I apply this same code to post or a page? How/Where would I put the page id?
@media (max-width: 768px) {
.site-content {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
}#right-sidebar {
-webkit-box-ordinal-group: 1;
-moz-box-ordinal-group: 1;
-ms-flex-order: 1;
-webkit-order: 1;
order: 1;
}.content-area {
-webkit-box-ordinal-group: 2;
-moz-box-ordinal-group: 2;
-ms-flex-order: 2;
-webkit-order: 2;
order: 2;
}}
Many thanks!
February 25, 2019 at 3:48 pm #821441LeoStaffCustomer SupportHi there,
It would be before any of the selectors as it’s in the body tag.
So replace:
.site-content
with.page-id-xx .site-content
#right-sidebar
with.page-id-xx #right-sidebar
.content-area
with.page-id-xx .content-area
Let me know if this helps π
-
AuthorPosts
- You must be logged in to reply to this topic.