WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] How to style a particular widget?

[Resolved] How to style a particular widget?

Viewing 6 replies - 1 through 6 (of 6 total)
  • You are not limited to using id as a the selector for CSS rules, you can also use the class which needs a period rather than a hash.

    class="myStyle"
    
    .myStyle {
    padding: 5px;
    }
    
    id="uniqueIdentifier"
    
    #uniqueIdentifier {
    margin: 20px;
    }

    The border on the element you want to change is applied with this rule:

    .contentBlock1 .textwidget {
        border: 1px solid #D5D5D5;
        margin: 0 0 10px;
        padding: 10px;
    }

    It’s quite easy to edit that but I can’t work out how to only remove the border on the one element.

    Hi Martcol,

    Thanks for replying. Yes, I need to edit that particular widget that has the flash animation in it. This is normally done with an ID that WordPress asigns to each individual widget. However, I cant see any IDs for any of the widgets on that page. This is what I need help with. Is it possible that the original developer has overriden the WordPress system so that they are not being assigned IDs?

    I think that this is a theme thing and I guess the point I was making is that the trend seems to be to move towards using class rather than id for CSS.

    If you added:

    .contentBlock1 .textwidget {
        border: none;
    }

    That would remove the border on the element you want but the problem is it also removes the border on the element below it.

    There might be a way to add in an ID to each of your widgets but I couldn’t do that.

    .sideBar .contentBlock1:nth-child(1) .textwidget {
    border: medium none;
    }

    Hi Martcol,

    Thanks for the reply. I just fixed it myself by using a plugin that adds classes to widgets.

    Glad you got it sorted.

    I learned a bit about complex CSS selectors!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] How to style a particular widget?’ is closed to new replies.