Saturday 13 February 2016

// //

How to get ID of any blogger widget


Identifying the id of a Blogger gadget will make it very easy for you to customize the gadget using CSS. eg if it is a Link List gadget, you can easily use css to add scrolling effect, change the font text, add dotted border etc provided you know the id of the gadget. More so, if you want a gadget to show on your Blogger mobile template, you will need its ID in order to add the mobile='yes' to it's code in your Blog's html.



If you use the "Add a Gadget" link in Blogger Layout to add a widget to your Blogspot blog, Blogger will automatically generate an id for the widget. Although, you can get the id of any widget added to a Blogger blog inside the template HTML code but there is a simpler way you can get it without the need to search your Blog's HTML.

The simpler method is what I've decided to share with you in this tutorial.

As an example, I'm going to check the id of an Adsense widget I added to my blog using the Adsense Gadget. Follow me through the steps:

==> Log in to your blogger dashboard
==> Go to "Layout" and locate the widget
==>  Click the "edit" link of the widget. Widget configuration window like the one below will pop up


adsense-widget


==> Look closely at the window and you will notice that the widget id is in the URL of the widget as highlighted in the screenshot above.

From the screenshot above, you will notice there is &widgetId=AdSense7in the URL. This means the id of the Adsense widget is  AdSense7. (Capital letter "S").

That's all.

Now, you can use the id as a selector in stylesheet when styling the widget. To do this, you will need to add the pound sign "#"as a prefix eg#WidgetID{ }

For example, if I want to centralize the Adsense widget, I can add the code below to the css section of my blog's html.

#AdSense7 {
text-align:center;
}
I hope this helps.

Image courtesy: Ogbongeblog.com