WordPress – 3 Widgets in a sidebar, Apply “last” class to the third widget

i’ve create a custom sidebar in my wordpress site

register_sidebar(array(
    'name' => 'Home Widgets',
    'before_widget' => '<div id="%1$s" class="blurb %2$s">',
    'after_widget' => '</div> <!-- end .widget -->',
    'before_title' => '<h4 class="widgettitle">',
    'after_title' => '</h4>',
));

And i’ve added 3 widgets into it using the widget panel in admin page.

Read More

This is the css

.blurb { float: left; margin-right: 96px; width: 256px; }

I’ve also declared a “last” class to remove the margin right to the last (third) widget.

.last { clear: right; margin-right: 0 !important; }

How can i apply the “last” class to the last widget?

Related posts

Leave a Reply

1 comment