Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Sidebars & Widgets (http://forum.bytesforall.com/forumdisplay.php?f=14)
-   -   help: trying to center a button in a text widget (http://forum.bytesforall.com/showthread.php?t=376)

Shepherd Jim Feb 13, 2009 03:27 PM

help: trying to center a button in a text widget
 
What is the best way to center, or otherwise align, pad, marginate (a word?) the contents of a text widget? I've inserted an "<a href=" link ref for the button into the text widget and the button is crammed all the way over against the left side of the widget.

Sort of in conjunction with the above: I am right in assuming that CSS changes done in the "Theme Options" CSS Inserts are stored in the WP database and should therefore survive either a WP or Atahualpa update?

Would setting up a "child theme" CSS file be an option? All my CSS changes/additions could be placed in the "child".css

I hope the above doesn't make it sound too much like I know what I'm doing.

Tnx Jim

Flynn Feb 13, 2009 05:34 PM

Try to wrap it into a container like this

HTML Code:

<div style="text-align:center">
... content ...
</div>

and put that into the text widget. As you can see I just used an inline style here because for a single style of a div that's used only once it might be too much trouble to add a CSS Insert just for that.

Of course if you want to add more styles or even use that container multiple times, adding the styles through CSS Inserts would be better. Do do that, you'd give the container a class of any name

HTML Code:

<div class="my-button-widget">
... content ...
</div>

and insert the style as CSS Insert
HTML Code:

div.my-button-widget {
text-align: center;
}

To center that box inside the widget as well (and not just the content inside that box), give it a defined width, and a left and right margin of "auto"

HTML Code:

div.my-button-widget {
text-align: center;
width: 100px;
margin-left: auto;
margin-right: auto;
}

Yes, CSS Inserts would be preserved as they are saved in the WP database.

Shepherd Jim Feb 15, 2009 06:45 PM

Thank you, Flynn! Sorry I'm so late with the thanks. Life on the farm sort of got in the way.


All times are GMT -6. The time now is 05:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.