I'm using the Backpack Traveler theme from Mikado, and I'm not happy with the width on my articles when viewed from a mobile device. I have an idea, but I wanted to ask for an opinion here before I do it, since I'm a newbie.
This is the code that the theme currently uses(I'll just add 2 examples):
@media only screen and (max-width:768px) {
.mkdf-header-vertical .elementor-widget-wrap>.mkdf-row-grid-section.elementor-element,
.mkdf-header-vertical .mkdf-container-inner,
.mkdf-header-vertical .mkdf-grid,
.mkdf-header-vertical .mkdf-row-grid-section {
width: 600px
}
}
@media only screen and (max-width:680px) {
.mkdf-header-vertical .elementor-widget-wrap>.mkdf-row-grid-section.elementor-element,
.mkdf-header-vertical .mkdf-container-inner,
.mkdf-header-vertical .mkdf-grid,
.mkdf-header-vertical .mkdf-row-grid-section {
width: 420px
}
}
As you can see most of the pixels are not used when the phone size is max or near max-width parameters. What I think of doing is:
- Create more @media query code lines for every 20 pixels (Let's say from 320px to 640px) That's 16 lines of @media query lines with pixel size of 320,340,360 etc.
- Set the width to calc(100% - 20px)
It's not the best way to do it for sure, but I don't have any other ideas, so I decided to ask here.
Edit: I have contacted the theme devs and they told me to use this code instead
@media only screen and (max-width: 480px){
.single-post .elementor-widget-wrap>.mkdf-row-grid-section.elementor-element,
.mkdf-container-inner, .mkdf-grid, .mkdf-row-grid-section {
width: X;
}
}
I'm guessing the .single-post will apply only to the articles themselves so nothing will break when messing with the width size. I've set the width to 95% for a max-width of 480 pixels. I'll do the same for 680px,768px and 1024px.
Edit 2: I tried out the new changes on my Samsung Galaxy S9+ and everything looks great. Some elements are not centered anymore on the home page but I'll figure it out.
width:94%gives a 3% margin, and margins in proportion to the screen size can be more aesthetically pleasing. However please note that any change to the width of a theme could break the layout if other elements rely on a specific width. - FluffyKitten