What our subscription widget is going to look like. See image below.
Little brief about HTML5
We will use HTML5's new required tag. Right now, different browsers will do different things when a form using HTML5 elements is submitted. When the form is submitted, most browsers will prevent the form from being submitted and will display a "hint" to the user, marking the first field that is required and has no value.HTML5 validation works according to the type attribute that is set within the form fields. For years HTML only supported a handful of type attributes, such as type="text" but with HTML5 there are a over a dozen new input types including email and url which we are going to use in our form.
add it to blogger blog
1. Go to Template > Edit HTML.
2. Back up your template.
3. Look for the following data tag in your Template.
]]></b:skin>
4. Paste the following code immediately above (before) it:
#subs_wrapper {
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvdu5s4BuvMl3Vb3Xz9d2R0SOX57c8yungoi4Zf-cN4IEhmdm8AVC2s1pGUig8_9VeR_adAVkRgUBGBMAk7TyoXL-gXxeZWNdhtVUivV9yavURUlIJamQt7L3uCKr_CqI_Zux0cNqu_2mT/s1600/Subcription_bg.png) no-repeat;
width: 300px;
height: 250px;
padding: 10px 10px;
margin: 5px;
}
#subs_wrapper p {
font-family: Tahoma, Geneva, sans-serif;
margin-top: 60px;
color: yellow;
text-align: center;
margin-right: 20px;
}
.subs_form input {
height: 27px;
font-size: 15px
font-family:'Open Sans', sans-serif;
font-size: 14px;
border: 1px solid #26beaf;
width: 238px;
margin: inherit;
padding: 6px;
float:;
}
.subs_form input {
margin: 2px;
}
.subs_form input {
border: 1px solid #aaa;
box-shadow: 0px 0px 3px #ccc, 0 10px 15px #eee inset;
border-radius: 3px;
padding-right: 30px;
-moz-transition: padding .25s;
-webkit-transition: padding .25s;
-o-transition: padding .25s;
transition: padding .25s;
}
.subs_form input:focus {
background: #fff;
border: 1px solid #fff;
box-shadow: 0 0 3px #aaa;
}
*:focus {
outline: none;
}
:-moz-placeholder {
color: blue;
}
.emailinput {
color: #666;
font-family: Georgia, "Times New Roman", Times, serif;
font-style: italic;
}
::-webkit-input-placeholder {
color: blue;
}
::-webkit-validation-bubble-message {
padding: 1em;
margin-left: -40px;
}
button.submit {
background-color: #68b12f;
background: -webkit-gradient(linear, left top, left bottom, from(#68b12f), to(#50911e));
background: -webkit-linear-gradient(top, #68b12f, #50911e);
background: -moz-linear-gradient(top, #68b12f, #50911e);
background: -ms-linear-gradient(top, #68b12f, #50911e);
background: -o-linear-gradient(top, #68b12f, #50911e);
background: linear-gradient(top, #68b12f, #50911e);
border: 1px solid #509111;
border-bottom: 1px solid #5b992b;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
box-shadow: inset 0 1px 0 0 #9fd574;
-webkit-box-shadow: 0 1px 0 0 #9fd574 inset;
-moz-box-shadow: 0 1px 0 0 #9fd574 inset;
-ms-box-shadow: 0 1px 0 0 #9fd574 inset;
-o-box-shadow: 0 1px 0 0 #9fd574 inset;
color: white;
font-weight: bold;
padding: 10px 96px;
text-align: center;
text-shadow: 0 -1px 0 #396715;
list-style-type: none;
}
button.submit:hover {
opacity: .85;
cursor: pointer;
}
button.submit:active {
border: 1px solid #20911e;
}
Now lets go and do one more step…
5. Now again look for the following data tag in your Template.
<div class='post-footer'>
Normally there are three instances of the tag present in your template ( post-footer, post-footer-line-1, post-footer-line-2 like this. Locate the post-footer (from top) one.
6. Paste the following code immediately below (after) it:
<b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:blog.pageType != "static_page"'>
<div id="subs_wrapper" style='float:left;'>
<p> Get Latest Updates To Your Inbox..!</p>
<form class="subs_form" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=mybloggerstrick', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true" method="post" action="http://feedburner.google.com/fb/a/mailverify">
<input type="hidden" value="My Blogger Tricks" name="uri">
<input type="hidden" value="en_US" name="loc">
<input class="emailinput" type="email" value="Enter Your Email..." onfocus="if (this.value == "Enter Your Email...") {this.value = ""}" onblur="if (this.value == "") {this.value = "Enter Your Email...";}" name="email" required />
<button class="submit" type="submit">Submit Form
</button><br/>
<p style="color: #999; text-align:center; font-size: 10px; padding: 10px; margin: 20px 20px; text-decoration:none;">We Always Respect Your Privacy.</p>
</form>
</div>
</b:if>
</b:if>
Widget alignment
- Change the value of float property:
Align right: set it toright;
Align left: set it to left;
Now click on save button and View your blog. The widget should appear on post pages.
I hope this tutorial helped. If you have any questions, please feel free to share them with us. Take care :)