Archived topic
Custom sidebar width
7 replies · Started by Kristjan on February 27, 2019
Hello,
I am trying to optimize the container + content/sidebar widths for my site: https://searchtraffic.com/
My problem is that a 30% sidebar width is too narrow, while 35% is too wide.
What is the best way to change the sidebar width in smaller increments, such as 32% or 33%?
Thanks,
Kristjan
Hi there,
some CSS like this should do the trick:
@media (min-width: 768px) {
#primary {
width: 68%;
}
#right-sidebar {
width: 32%;
}
}
Is there a way to do this with PHP? I am using a two sidebar layout and with css it always looks kind of deformed. Would like sidebars to be 22.5% each and content 55%.
Hi there,
the sidebar / main widths are defined using CSS - so PHP would only be parsing the CSS units.
If you want to start a new topic where you can share your Site URL privately i can take a look at the issue.
It's nothing live yet.
@media (min-width: 768px) {
#primary {
width: 54%;
}
#right-sidebar {
width: 23%;
}
#left-sidebar {
width: 23%;
}
}
Is this how you would do it?
Try this CSS:
@media (min-width: 769px) {
#left-sidebar,
#right-sidebar {
width: 22.5%;
}
#left-sidebar {
left: -55%;
}
#primary {
width: 55%;
left: 22.5%;
}
}
Seems to work thank you very much!
You're welcome