WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Centering image in text widget (5 posts)

  1. TonyWilliams
    Member
    Posted 7 months ago #

    I have put the following code in a text widget:
    <img src="http://www.wordpresstest.thecapitalpartnership.co.uk/wp-content/uploads/2013/11/asasmall.jpg">
    This shows the image OK but I want to centre the image in the widget. What do I have to add to do that? I've tried the normal html code <center>----</center> but that doesn't appear to work.
    Thanks
    Tony
    PS I've tried Image Widget but that doesn't centre them either

  2. WPyogi
    Volunteer Moderator
    Posted 7 months ago #

    No way to help with CSS without seeing your site.

    BTW, "center" tags are deprecated.

  3. TonyWilliams
    Member
    Posted 7 months ago #

    Oh, OK I didn't think that the content of text widgets was affected by the CSS file but here is the site
    http://www.wordpresstest.thecapitalpartnership.co.uk
    Could you explain "deprecated"? As you will realise I'm a newbie at this
    Thanks
    Tony

  4. WPyogi
    Volunteer Moderator
    Posted 7 months ago #

    See:

    http://www.w3schools.com/tags/tag_center.asp

    Right now you have CSS code visible on your in that widget CSS needs to go in an external stylesheet or custom CSS plugin. Looks like you have a child theme so it should go in that style.css file.

    Try this:

    div.inner-footer-item img {
        display: table;
        margin: 0 auto;
    }
  5. TonyWilliams
    Member
    Posted 7 months ago #

    Spot on thanks a lot! They look fine now.
    Tony
    PS you may have spotted the code in the widget but I'm currently working on the site and it's changing every 5 minutes!

Reply

You must log in to post.

About this Topic

Tags

No tags yet.