Adding Border to Each Widget in the Sidebar

I am looking to add a border around each widget in the sidebar. Can I modify this in the Theme Options or do I need to place in CSS?

Website is: aliciamhilton.com

Hi there,

Thanks for writing in! You can do this CSS, please try adding the following code in the Theme Options > CSS:

.x-sidebar .widget {
    border: 1px solid #000;
    padding: 10px;
}

If you would like to learn CSS, I am sharing few resources that you take a look to get started with CSS and an interesting tool that you can use to speed up the development process.

I recommend you to watch following video that will help you to get started with CSS.

https://www.youtube.com/watch?v=MFR4WXiLzpc

Sometimes it can get a bit difficult to find out the right selector to be able to write the required CSS codes. A handy tool that can help you in this is Google Chrome dev tools. I am sharing the resource that you can refer to get started with dev tools.

https://developers.google.com/web/tools/chrome-devtools/css/

https://developers.google.com/web/tools/chrome-devtools/

https://www.youtube.com/watch?v=tP_kXBJWPhQ&t=200s

Cheers!

Thank you. This created several other questions:

  1. Can I choose to add border around specific widgets?

  2. Can I choose to have a border placed around 2 widgets together?

  3. Can I extend width of border?

Hi,

  1. You need to be able to add a unique class to your widgets so you can target it individually.

You can try this third party plugin - https://wordpress.org/plugins/widget-css-classes/

eg. If you added mycustomclass

Then you can target it using that class

.mycustomclass {
       border: 1px solid #000;
       padding: 10px;
}
  1. This isn’t possible but you can make it look that way by setting the bottom border of top widget to 0 and making the top border of bottom widget to 0.

a) Add topwidget class on your top widget

.topwidget {
       border-top: 1px solid #000;
       border-left: 1px solid #000;
       border-right: 1px solid #000;
       border-bottom: 0;
}

b) Add bottomwidget class on your bottom widget

.bottomwidget {
       border-top: 0;
       border-left: 1px solid #000;
       border-right: 1px solid #000;
       border-bottom: 1px solid #000;
}
  1. Yes, you can change 1px in the code to adjust the width of the border

eg.

.mycustomclass {
       border: 10px solid #000;
       padding: 10px;
}

Hope that helps

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.