Internet use via mobile devices and cell phones is growing every day. The goal of responsive design is to present content in a way that best suits the device the visitor is using. Technically it means flexible layout, flexible images, CSS media queries and some JavaScript. Media queries allow you to apply changes to your website design based on the size of your visitor's browser window. For instance, you could specify styles that take effect only when the browser window is narrower than a certain width.
Since Dottoro theme provides you a highly flexible environment (you can set the page width, thumbnail sizes, the number of columns in post lists, etc.),
it is not possible to create a responsive stylesheet that contains all required styles and works on all sites created with the Dottoro theme.
And due to the nature of CSS media queries, we believe that using them in a child theme provides much more freedom than hard-coding them in the stylesheet of the Dottoro theme.
We also use a child theme on our demo site to adapt the layout to the viewing environment.
Our demo child theme and the next examples will give you a good starting point to create your own responsive design.
In addition, there are some items that require special handling. These are the menu and the slideshow. Dottoro theme from version 1.13 comes with additional options which help you in making the menu and and slideshow responsive.
@media only screen and (max-width: 980px) {
you can see that it takes effect only when the browser window is not wider than 980 pixels.
The default design of the Dottoro theme sets the page width to 980 pixels, but you can change this in the Theme Editor.
If you change this, you should also change the value in the media query.
/* fixed width (315px) sidebar, fluid content */
#content_wrapper {width:100% !Important;}
.left_sidebar #content_wrapper {margin-left:-315px !Important;}
.left_sidebar #content {margin-left:315px;}
.default_sidebar #content_wrapper {margin-right:-315px !Important;}
.default_sidebar #content {margin-right:315px;}
.right_sidebar #content_wrapper {margin-right:-315px !Important;}
.right_sidebar #content {margin-right:315px;}
with these lines:
/* fluid sidebar, fluid content */
#sidebar_wrapper {width:32% !Important;}
#content_wrapper {width:68% !Important;}
.no_sidebar #content_wrapper {width:auto !Important;}
in the style.css file of your child theme and you are done.
In this case, please also remove these lines:
/* remove margins added above */
.left_sidebar #content_wrapper {margin-left:0px !Important;}
.left_sidebar #content {margin-left:0px;}
.default_sidebar #content_wrapper {margin-right:0px !Important;}
.default_sidebar #content {margin-right:0px;}
.right_sidebar #content_wrapper {margin-right:0px !Important;}
.right_sidebar #content {margin-right:0px;}
from the second media query, because these lines are only required for the fixed width sidebar - fluid width content layout.
The first two rules:
.compressed_menu #header {height:90px !Important;}
.compressed_menu #nav {left:auto !Important; right:0 !Important; width:auto !Important;}
set the header height back to 90 pixels and move the comressed menu to the right.
If you want to place the compressed menu in a different position, you should change these rules.
The next ones:
@media only screen and (max-width: 310px) {
.compressed_menu #header {height:130px !Important;} /* original header height: 90px + menu height: 40px */
.compressed_menu #nav {right:37% !Important;} /* compressed menu position, right aligned because of the back button */
}
increase the height of the header and move the compressed menu to a bit left on small screen sizes to prevent the menu to overlap the site title.
And the two last rules:
.compressed_menu #nav .sub-menu li.folder > a .submenu_icon_after:after {content:'\f008' !Important;}
.compressed_menu #nav .sub-menu li.folder:hover > a .submenu_icon_after:after {content:'\f008' !Important;}
set submenu icons to the compressed menu. Submenu icons make multilevel compressed menus more usable.
You might not need these rules if your menu design already uses submenu icons.
Some things have changed in the responsive design of our demo site. We recommend you to make the same changes in the style.css file of your child theme to make your site more mobile friendly.
Prior to version 1.37, the sidebar was hidden when the browser window was less than 768 pixels wide. From version 1.37, the sidebar is moved below the content instead of being hidden.
Why the change was needed?The content of the sidebar is an important part of the overall content strategy. There is no reason to be hidden on small screen sizes.
What changes should I make in my website?Replace the lines
#content_wrapper {width:100% !Important;}
#sidebar_wrapper {display:none !Important;}
with these lines
#content_wrapper {width:100% !Important; float: none !Important;}
#sidebar_wrapper {width:100% !Important; float: none !Important;}
in the style.css file of your child theme. There are located in the media query "@media only screen and (max-width: 767px)".
@media only screen and (max-width: 767px) {
/* move the sidebar below the content */
#content_wrapper {width:100% !Important; float: none !Important;}
#sidebar_wrapper {width:100% !Important; float: none !Important;}
/* remove margins added above */
.left_sidebar #content_wrapper {margin-left:0px !Important;}
.left_sidebar #content {margin-left:0px;}
.default_sidebar #content_wrapper {margin-right:0px !Important;}
.default_sidebar #content {margin-right:0px;}
.right_sidebar #content_wrapper {margin-right:0px !Important;}
.right_sidebar #content {margin-right:0px;}
}
Prior to version 1.37, all multi-column layouts (except the post lists) were changed to one-column layouts when the browser window was less than 768 pixels wide. From version 1.37, each multi-column layout is handled individually.
Why the change was needed?It depends on the number of columns and content of a multi-column layout as to what screen sizes the layout should be changed to a one-column layout. For instance, if the footer has a 4-column layout, it should be changed to a 2-column layout on small screens and should only be changed to a one-column layout if the browser window is too small for two columns. Furthermore, it most cases a 2-column layout containing large images should be changed to a one-column layout on larger screens than a 2-column layout containing text. Finally, there are cases when the contents of columns don't allow the columns to go below a certain width. Therefore the browser will automatically place them one below the other on small screen sizes. In this case, you don't need any CSS media query at all.
What changes should I make in my website?Remove the following lines from the style.css file of your child theme:
.no_sidebar .col, #footer .col, #subheader .col, #header .col {
width:100% !Important;
}
.no_sidebar .row > .col {margin-top:10px;}
.no_sidebar .row > .col:first-child {margin-top:0;}
They are located in the media query "@media only screen and (max-width: 767px)" below the comment "change multi-column layouts to single-column layouts".
/* small screen sizes, no multi-column layout at all */
@media only screen and (max-width: 479px) {
/* change multi-column layouts to single-column layouts
and add some margin to elements that go below each other */
.col {
width:100% !Important;
}
.row > .col {margin-top:10px;}
.row > .col:first-child {margin-top:0;}
}
Now, you have to add some media queries to your style.css file. For instance, we use these media queries for the footer in the demo child theme:
/* change the 4-column layout to 2-column layout in the footer */
@media only screen and (max-width: 690px) {
#footer .col4 {
width:50% !Important;
}
}
/* change the 4-column layout to single-column layout in the footer */
@media only screen and (max-width: 485px) {
#footer .col4 {
width:100% !Important;
}
}
As you can see, when the browser window is less than 690 pixels wide, the layout is switched to 2-column and when the browser window is less than 485 pixels wide, the layout is switched to single-column.
If you have a 4-column layout in the footer, just copy and paste these media queries into your style.css file and modify the 690 and 485 values based on your needs. And for instance, if you have a 2-column footer, then you don't need the first media query only the second one.
The next thing you should check is the multi-column layouts in the content. You don't need to care about the post lists (Blog, News and Portfolio pages, category, tag and date archive pages). They have their own media queries that have not been modified.
You should only check the multi-column layouts created with the [row] and [col] shortcodes.
For instance, of you have a 2-column layout like this:
[row]
[col2]Some content in the first column[/col2]
[col2]Some content in the second column[/col2]
[/row]
and you want to change it to a one-column layout when the browser window is less than 500 pixels wide, then add a CSS class to the row (e.g. col1_below_500):
[row class="col1_below_500"]
[col2]Some content in the first column[/col2]
[col2]Some content in the second column[/col2]
[/row]
and add this media query to your style.css file:
@media only screen and (max-width: 500px) {
.col1_below_500 > .col {
width:100% !Important;
}
/* add some vertical space between the columns that are now rows */
.row.col1_below_500 > .col {margin-top:30px;}
.row.col1_below_500 > .col:first-child {margin-top:0;}
}
Similarly, if you have another 2-column layout that you want to change to a one-column layout when the browser window is less than 750 pixels wide, add a CSS class to it:
[row class="col1_below_750"]
[col2]Some content in the first column[/col2]
[col2]Some content in the second column[/col2]
[/row]
and add this media query to your style.css file:
@media only screen and (max-width: 750px) {
.col1_below_750 > .col {
width:100% !Important;
}
/* add some vertical space between the columns that are now rows */
.row.col1_below_750 > .col {margin-top:30px;}
.row.col1_below_750 > .col:first-child {margin-top:0;}
}
It's that simple.
And of course, if you have another 2-columns layout that you want to change to a one-column layout when the browser window is less than 500 pixels wide, you don't need to add the "col1_below_500" media query to your style.css file again. Just add the col1_below_500 class to the row ([row class="col1_below_500"]
) and you are done.
So in other words, you will need some media queries like these
@media only screen and (max-width: 500px) {
.col1_below_500 > .col {
width:100% !Important;
}
/* add some vertical space between the columns that are now rows */
.row.col1_below_500 > .col {margin-top:30px;}
.row.col1_below_500 > .col:first-child {margin-top:0;}
}
@media only screen and (max-width: 750px) {
.col1_below_750 > .col {
width:100% !Important;
}
/* add some vertical space between the columns that are now rows */
.row.col1_below_750 > .col {margin-top:30px;}
.row.col1_below_750 > .col:first-child {margin-top:0;}
}
in your style.css file and you should add one of the col1_below_500, col1_below_750, etc. classes to each of your multi-column layouts.
We hope that this guide will help you make the necessary changes. If you need any further information, please do not hesitate to ask in our support forum.