Archived topic
Widget's borders
4 replies · Started by Allen on April 18, 2021
hi
How to
a) change sidebar's background colour
b) extra space at the top of blog
c) add border to widget
d) add space between widget
e) add text without border
f) add border to post
g) add gap between post
Thanks
h) reduce the space between post's posted date and post's content.
thx
Hi there,
For a):
Do you mean the sidebar container or the widgets?
If it's the widgets, you can do this with the Colors module enabled.
https://docs.generatepress.com/article/colors-overview/
Go to Appearance > Colors > Sidebar Widgets. That's where you can change the color values.
For the sidebar container itself, you can do it with custom CSS:
Example: blue right sidebar, green left sidebar.
#right-sidebar { background-color: blue; }
#left-sidebar { background-color: green; }
For b)
There are multiple ways of doing this. All require custom CSS.
You can do any of these:
-Add padding-top to #right-sidebar > .inside-right-sidebar.
Example: #right-sidebar > .inside-right-sidebar{padding-top: 40px;}
-Add margin or padding to the first widget.
Example: #right-sidebar > .inside-right-sidebar > *:first-child{padding-top: 40px;}
For c):
Custom CSS as well.
.inside-right-sidebar .widget {
border: 2px solid red;
}
For d):
If you use "Separate Containers" on Content Layout setting found in Appearance > Customize > Layout > Container, the Separating Space setting controls the separation space between widgets as well.
However, if you wish to control the widget space specifically, you can do it with custom CSS.
Example:
.inside-right-sidebar .widget:not(:last-child) {
margin-bottom: 20px;
}
For e):
Same as D and E. We just need to change the selectors.
I'm not exactly sure what you mean. Is this something you've manually inserted through hooks? Can you explain a bit more?
For f and g):
article.post {
border: 2px solid red;
}
article.post:not(:last-child) {
margin-bottom: 20px;
}
For h:)
It's this CSS:
.entry-content:not(:first-child), .entry-summary:not(:first-child), .page-content:not(:first-child) {
margin-top: 2em;
}
Change 2em to the space of your preference.
Thanks Elvin! Straight to solutions!
No problem. Glad to be of any help. :)