Forums
Home / Fixing WordPress / Centering Widgets in Sidebar
(@bmiller0912)
10 years, 11 months ago
I am trying to center a Loan Calculator widget in my Right Sidebar in the Twenty Eleven theme.
As of now I have text, images, and widgets all in the sidebar and I have successfully centered the text and images using this below in CSS:
#secondary { float: right; margin-right: 7.6%; width: 18.8%; image-align: center; text-align: center; }
But I cannot seem to figure out how to center the widget. Below is the block of code for all widgets in my CSS sheet:
/* =Widgets ———————————————– */
.widget-area { font-size: 12px; } .widget { word-wrap: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; clear: both; margin: 0 0 2.2em; } .widget-title { color: #666; font-size: 10px; font-weight: 500; letter-spacing: 0.1em; line-height: 2.6em; text-transform: uppercase; } .widget ul { font-size: 15px; margin: 0; } .widget ul ul { margin-left: 1.5em; } .widget ul li { color: #777; font-size: 13px; } .widget a { font-weight: bold; text-decoration: none; } .widget a:hover, .widget a:focus, .widget a:active { text-decoration: underline; }
Unfortunately, the site I’m working is not live, so it cannot be seen by just anyone. If you’d like I can send you the CSS file.
(@zoerooney)
So image-align: center; isn’t actual CSS – you can remove that.
image-align: center;
You can try changing the bolded line below so that it’s margin: 0 auto 2.2em; instead of margin: 0 0 2.2em; like so:
margin: 0 auto 2.2em;
margin: 0 0 2.2em;
.widget { word-wrap: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; clear: both; margin: 0 auto 2.2em; }