Tuesday 9 September 2014

Google Adsense account Approval Trick 2014

We all know that Google Adsense is the best advertising network because for its high CPC. Every blogger has a dream to earn a lot of money and this can be true only with Google Adsense. Unfortunately more than 80% bloggers cannot get their adsense account because of Google Adsense TOC. If our site does not comply with Google Adsense policies they simply reject our application. Google Adsense provides high quality ads related to the content automatically. It enables a blogger to earn a lot of money and fulfil his dreams. So here we are discussing an easy trick by which you can  get your adsense approved account. So lets start the trick.

How to Get Approved:

Just follow the below easy steps to approve your adsense application.

1. First, Make a new Google account of U.S.A or U.K.
How to do this ? I will tell you:
  • Use AnonymoX extension if you are Mozilla Firefox to change your IP address.
  • Or Use Stealthy if you are using Google. ( They both are free to use.)
  • Now after setting them, point your browser to www.Gmail.com and sign up for a Gmail Account.
  • Now fill your fake information and set country to UK or US.
  • If it asks for phone verification use any online service which provides free UK number.
  • Now You are ready!

2. Once you have created this account, Head over to YouTube.Com and login with your new Google Account.
3. Head to this page: http://www.youtube.com/account_monetization and click “Enable Monetization”.
and Follow the instructions given, At this stage you can enter your real country and submit your application.
5. Wait 1 to 2 hours to approve your application. Now you are ready to monetize your website.

For Blogger Users:

If you plan to use this with blogger please do this afterwards:
1. Go to Blogger.com
2. Click the Blog you want ads on.
3. Click Earnings Tab:
4. Click “Get Started”
5. Click “Link account”

Final Words:

This is an easy trick to get your adsense approved account and fulfil your blogging dreams. Now It's your turn to share this post with your friends so that they also can also earn a lot. Don't forget to comment below with your feedback till then Peace, Blessings and Happy Earnings.


Tags :  Google Adsense, high CPC,adsense approved account,

How to Increase Earning in Adsense A/c !

This summary is not available. Please click here to view the post.

Wednesday 9 April 2014

How To Add Related Posts Widget To Blogger with Thumbnails

Steps adding the Related Posts Widget to Blogger/Blogspot

Step 1. Go To Blogger Dashboard >> Template >>Edit HTML

Step 2. Click anywhere inside the template's code and press the CTRL + F keys

Step 3. Search for this piece of code by typing it inside the search box:

</head>

Step 4. Copy and paste the below code just before/above </head>

  <!--Related Posts with thumbnails Scripts and Styles Start-->
<!-- remove --><b:if cond='data:blog.pageType == &quot;item&quot;'>
<style type='text/css'>
#related-posts{float:left;width:auto;}
#related-posts a{border-right: 1px dotted #eaeaea;}
#related-posts a:hover{background: #f2f2f2;}
#related-posts h2{margin-top: 10px;background:none;font:18px Oswald;padding:3px;color:#999999; text-transform:uppercase;}
#related-posts .related_img {margin:5px;border:4px solid #f2f2f2;width:100px;height:100px;transition:all 300ms ease-in-out;-webkit-transition:all 300ms ease-in-out;-moz-transition:all 300ms ease-in-out;-o-transition:all 300ms ease-in-out;-ms-transition:all 300ms ease-in-out;}
#related-title {color:#222;text-align:center;padding: 0 10px;font-size:14px Oswald; line-height:16px;text-shadow:0 2px 2px #fff;height:28px;width:100px;}
#related-posts .related_img:hover{border:4px solid #E8E8E8;opacity:.7;filter:alpha(opacity=70);-moz-opacity:.7;-khtml-opacity:.7}</style>
<script type='text/javascript' src='http://helplogger.googlecode.com/svn/trunk/relatedposts.js' />
<!-- remove --></b:if>
<!--Related Posts with thumbnails Scripts and Styles End-->


Note:
- to change the width and height of thumbnails, modify the 100px value in red
- to change the color and size of related posts titles, change the value in blue
- remove the line in violet if you want the related posts to be displayed in homepage too

Step 5. Now find the following code (you might find it twice, stop at the second one):
<div class='post-footer'> 

Step 6. And just above it, copy and paste the below code:
<!-- Related Posts with Thumbnails Code Start-->
<b:if cond='data:blog.pageType == &quot;item&quot;'>

<div id='related-posts'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast != &quot;true&quot;'>
</b:if>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<script expr:src='&quot;/feeds/posts/default/-/&quot; + data:label.name + &quot;?alt=json-in-script&amp;callback=related_results_labels_thumbs&amp;max-results=5&quot;' type='text/javascript'/></b:if></b:loop>
<script type='text/javascript'>
var currentposturl=&quot;<data:post.url/>&quot;;
var maxresults=5;
var relatedpoststitle=&quot;<b>Related Posts:</b>&quot;;
removeRelatedDuplicates_thumbs();
printRelatedLabels_thumbs();
</script>
</div><div class='clear'/>
</b:if>
<b:if cond='data:blog.url == data:blog.homepageUrl'><b:if cond='data:post.isFirstPost'>
<a href='http://helplogger.blogspot.com'><img alt='Blogger Tricks' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmKB9BVT-lGCUpamfCeX6z76UxVp_doU5Bz_JwQhs7wJmxThjuWePh0MsRYytRQf8mS8RnC3_6h9ETtfiUeVjco1H3Ufnfh2kMXsF1FSNojSzjmAtsxhOdhbfIRpEigNVnMoUW8CQVZsjm/s1600/best+blogger+tips.png'/></a>
</b:if></b:if><!-- Related Posts with Thumbnails Code End-->
 

Note:
- change the 5 value from max-results=5 with the number of posts you want to be displayed
- if you want the related posts to be displayed on homepage too, then remove the lines in violet

Step 7. Save the Template 

Friday 4 April 2014

Simple Blogger Related Post Widget Without Thumbnails/Text Links Only

The Script For Blogger Related Post Without Thumbnails :

 

Add a new Javascript/HTML widget and paste the following:
 

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="http://blogger-related-posts.googlecode.com/files/related-posts-widget-1.0.js" type="text/javascript"></script>
<script type="text/javascript">
relatedPostsWidget({
   'containerSelector':'div.post-body'
   ,'loadingText':'loading...'
});</script>
 
 Note: The widget uses post labels to display related post links. Your 
recent posts will show up instead, if labels are missing. Make sure 
you've defined them.



Here's how to add the codes if you prefer:

  1. From your blogger dashboard, click "Layout" on the left panel.
  2. Click "Add a gadget" and scroll down until you see HTML/JavaScript. Open it.
  3. Paste the above codes in the content area there. Save it.

That's it. Your related posts should show up at the bottom of your article. It should help you increase page views and in turn decrease bounce rates - Both positive SEO signals.

How to put Adsense ads on Blogger/Blogspot

If you want to earn money from your site/blog, Google Adsense is the most popular service to monetize your blog or website content. When implemented, Adsense will display targeted Google ads on your blog and they can generate revenue on either a per-click or per-impression basis.

In order to display ads on your site, you should first Sign Up to Google Adsense program.

Before adding your ads, keep in mind that Adsense allows only up to 3 ad units, 3 link units and 2 search boxes per page.

In this tutorial i will show you the three ways you can add Adsense ads to your blog.

1. Adsense Gadget


Use this method to add ad unit as a widget, in places outside the blog post area. You can position it by simply dragging it in Page Elements, just like any other widget. To add the Adsense Gadget, follow these steps:
Step 1. Log in to your Blogger Dashboard, go to Layout and click on the "Add a Gadget" link on the right side.

Step 2. From the pop-up window, select the AdSense Gadget

Step 3. Configure ad format and colors (see the screenshot for more details)

Step 4. Finally, click on the Save button and you're done.


2. Inline Ads


This will display an ad unit at the end of each post. To show ads between posts:

Step 1. Go to Layouts > Page Elements and click the Edit link in Blog Posts gadget box.

Step 2. Check the "Show Ads Between Posts" box. 

Step 3. Configure ad frequency, ad format, and colors. Live preview is provided beneath the settings.

Step 4. Click on the Save button to save the settings.


3. Adsense code


The most notable benefits of using this method are:
  • You can place ad anywhere in your blog
  • You can add the code anywhere in your blog template - in your post content or page.
  • To find out which format perform the best, custom channels will help you to track the performance of specific groups of ad units.
  • You can choose types other than ad unit i.e. link unit, search box.

To create an ad unit:

Step 1. Go to Google Adsense website.

Step 2. Click on My ads tab, go to Ad units and then click on the "New ad unit" button.

Step 3. Choose your ad type, choose format and colors and assign channels.

Step 4. When you have finished editing, click on the Save and get code >> button and copy the code provided.

To add an ad unit to your blog, you have the following options:

  • Paste the code in a HTML/Javascript gadget
  • Paste the code in the blog post or page HTML section, or
  • Paste the code direct in your template. (if you choose this option, first you should convert adsense ad code)


Add Google Adsense to Blogger Header - Above the Title

Add a new element to Blogger header


Step 1. From your Blogger Dashboard, go to Template and click on the Edit HTML button (it is recommended to make a backup first - click on the Backup/Restore button on the right side)
 
Step 2. Click anywhere inside the code area and press the CTRL + F keys to open Blogger' search box:
 
Step 3. Paste or type the following code inside the search box and hit Enter to find it:
  <div id='header-wrapper'>
 
Note: if you can't find that one, try to find this one instead:
  <div class='region-inner header-inner'>
 
 Step 4. Just below one of these lines, you should see this line:
<b:section class='header' id='header' maxwidgets='1' showaddelement='no'>

Step 5. Replace the values in red like in this example:
<b:section class='header' id='header' maxwidgets='3' showaddelement='yes'>

Step 6. Click on the Save Template button to save the changes.

Adding the Adsense ad unit above the Blogger header


Step 7. Go to Layout (left side) and on the right side you should see a new section that will allow you to add a gadget to the header area
in case you want to add the script of an ad from your AdSense account, choose the HTML/JavaScript gadget and paste the script inside the empty box, then click on Save button.

Choose the type of ad unit you want. In my example, I added a new Adsense 728x15 ad link unit I thought would look good above the blog title. Color blending is usually done automatically by Blogger according to the color schema of your template but you can choose any other colors.

Step 9. Click on the Save arrangement button on the right side.
 
Step 8. Click on Add a Gadget link and select the Google Adsense gadget. 

Now view your blog to see your new Google Adsense unit. If all is going well, your new AdSense ad unit should appear above your blog's title or logo:
 
Note: it may take a while for your ads to show if you created an ad unit on your AdSense account

This is a very good Adsense placement that can help you to increase the CTR of your blog.

Show Recent Posts With Thumbnails For Particular Label or Category in Blogger

Steps

Step 1. From your Blogger Dashboard, go to Template/Edit HTML

Step 2. Click anywhere inside the code area and search (CTRL + F) for this piece of code:

]]></b:skin>

... just above it, paste this one:

/* Recent posts by labels
--------------------------------- */
img.label_thumb{
float:left;
margin-right:10px !important;
height:65px; /* Thumbnail height */
width:65px; /* Thumbnail width */
border: 1px solid #fff;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .4);
-moz-box-shadow: 0 1px 1px rgba(0, 0, 0, .4);
box-shadow: 0 1px 1px rgba(0, 0, 0, .4);
}

#label_with_thumbs {

float: left;
width: 100%;
min-height: 70px;
margin: 0px 10px 2px 0px;
padding: 0;
}
ul#label_with_thumbs li {
padding:8px 0;
min-height:65px;
margin-bottom:0px;
border-bottom: 1px dotted #999999;
}

#label_with_thumbs li{

list-style: none ;
padding-left:0px !important;
}

#label_with_thumbs a { text-transform: uppercase;}

#label_with_thumbs strong {padding-left:0px; }

/* End of Recent posts by labels
--------------------------------- */ 


Step 3. Now search for this tag (CTRL + F)
</head>

...and add the following script above it:

<script type='text/javascript'>
//<![CDATA[
function labelthumbs(json){document.write('<ul id="label_with_thumbs">');for(var i=0;i<numposts;i++){var entry=json.feed.entry[i];var posttitle=entry.title.$t;var posturl;if(i==json.feed.entry.length)break;for(var k=0;k<entry.link.length;k++){if(entry.link[k].rel=='replies'&&entry.link[k].type=='text/html'){var commenttext=entry.link[k].title;var commenturl=entry.link[k].href;}
if(entry.link[k].rel=='alternate'){posturl=entry.link[k].href;break;}}var thumburl;try{thumburl=entry.media$thumbnail.url;}catch(error)
{s=entry.content.$t;a=s.indexOf("<img");b=s.indexOf("src=\"",a);c=s.indexOf("\"",b+5);d=s.substr(b+5,c-b-5);if((a!=-1)&&(b!=-1)&&(c!=-1)&&(d!="")){thumburl=d;}else thumburl='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkc-9RLzBwlWdYIZkMzSWXio7DXEVxOidyWyDFhNb5vMcPBh7UvoIMI2BHSoZHMOw3mBUU59WzaJS6xqd3ITJ8dMjNhwAbSOMu4T1yeod1lzmOTUiLy8R2jwY79COhniTYhJre2G9balg/s1600/picture_not_available.png';}
var postdate=entry.published.$t;var cdyear=postdate.substring(0,4);var cdmonth=postdate.substring(5,7);var cdday=postdate.substring(8,10);var monthnames=new Array();monthnames[1]="Jan";monthnames[2]="Feb";monthnames[3]="Mar";monthnames[4]="Apr";monthnames[5]="May";monthnames[6]="June";monthnames[7]="July";monthnames[8]="Aug";monthnames[9]="Sept";monthnames[10]="Oct";monthnames[11]="Nov";monthnames[12]="Dec";document.write('<li class="clearfix">');if(showpostthumbnails==true)
document.write('<a href="'+posturl+'" target ="_top"><img class="label_thumb" src="'+thumburl+'"/></a>');document.write('<strong><a href="'+posturl+'" target ="_top">'+posttitle+'</a></strong><br>');if("content"in entry){var postcontent=entry.content.$t;}
else
if("summary"in entry){var postcontent=entry.summary.$t;}
else var postcontent="";var re=/<\S[^>]*>/g;postcontent=postcontent.replace(re,"");if(showpostsummary==true){if(postcontent.length<numchars){document.write('');document.write(postcontent);document.write('');}
else{document.write('');postcontent=postcontent.substring(0,numchars);var quoteEnd=postcontent.lastIndexOf(" ");postcontent=postcontent.substring(0,quoteEnd);document.write(postcontent+'...');document.write('');}}
var towrite='';var flag=0;document.write('<br>');if(showpostdate==true){towrite=towrite+monthnames[parseInt(cdmonth,10)]+'-'+cdday+' - '+cdyear;flag=1;}
if(showcommentnum==true)
{if(flag==1){towrite=towrite+' | ';}
if(commenttext=='1 Comments')commenttext='1 Comment';if(commenttext=='0 Comments')commenttext='No Comments';commenttext='<a href="'+commenturl+'" target ="_top">'+commenttext+'</a>';towrite=towrite+commenttext;flag=1;;}
if(displaymore==true)
{if(flag==1)towrite=towrite+' | ';towrite=towrite+'<a href="'+posturl+'" class="url" target ="_top">More »</a>';flag=1;;}
document.write(towrite);document.write('</li>');if(displayseparator==true)
if(i!=(numposts-1))
document.write('');}document.write('</ul>');}
//]]>
</script>



Note: to add your own pic for the posts with no thumbnail, replace the image url in blue with your own

Update! For a better image resolution add this script above the </body> tag:

<script type='text/javascript'>                  
function changeThumbSize(id,size){
var blogGadget = document.getElementById(id);
var replacement = blogGadget.innerHTML;
blogGadget.innerHTML = replacement.replace(/s72-c/g,"s"+size+"-c");
var thumbnails = blogGadget.getElementsByTagName("img");
for(var i=0;i&lt;thumbnails.length;i++){
thumbnails[i].width = size;
thumbnails[i].height = size;
}
}
changeThumbSize("label_with_thumbs",210);             
</script>


... save the template.

So we have added the Css to style the widget and the script to make it work. Now all we have to do is to add the widget's code to the blog sidebar in a Html/Javascript gadget:

Step 4. Go to Layout - click on Add a Gadget

Step 5. Choose the HTML/Javascript widget and paste this code inside the empty box: 

  <script type='text/javascript'>var numposts = 3;var showpostthumbnails = true;var displaymore = false;var displayseparator = true;var showcommentnum = false;var showpostdate = false;var showpostsummary = true;var numchars = 100;</script>
<script type="text/javascript" src="/feeds/posts/default/-/Name-of-the-label?published&alt=json-in-script&callback=labelthumbs"></script>


Note: Where it says Name-of-the-label is the name of the label you want to display, and if your label is case sensitive, like in my example, then you should type it that way.

Also within the last code, there are parts that we can customize, just change true with false or vice versa:

var numposts ← Number of posts to display
var showpostthumbnails ← Show/hide thumbnails
var displaymore ← Show or hide the read more link
var displayseparator ← Show/hide separator
var showcommentnum ← Show/hide the number of comments
var showpostdate ← Show/hide the posts dates
var showpostsummary ← Show or not the posts summaries
var numchars ← Number of posts characters (here you have to change the 100 value)


Remember that the gadget displays the latest posts from a particular label, therefore, if you want to display the latest posts from other labels then just repeat step 5 for each additional category you want to add.

make Simple Recent Posts Widget for Blogger/Blogspot

Sometimes we want to have everything organized so that our readers can find topics of interest more easily, and that's when instead of putting a widget with the latest posts, we can put together the latest entries sorted by category, so that we'll be able to show the latest posts for each label we want and also display a thumbnail for our category.

To add this type of gadget/widget for the latest categories, just follow the next steps:

How to add Recent Posts Widget to Blogger

Step 1. Log in to your Blogger Dashboard, then go to Layout and click on Add a Gadget link

Step 2. From the pop-up window, scroll down and choose HTML/JavaScript


Step 3. Select & Copy the code from one of the options below and paste it into the new HTML/JavaScript:

Option 1: Recent posts widget with snippets
<div id="hlrpsa">
<script src="http://helplogger.googlecode.com/svn/trunk/recent-posts-with-snippets.js">
</script>
<script>
var numposts = 5;var showpostdate = false;var showpostsummary = true;var numchars = 100;var standardstyling = true;
</script>
<script src="http://your-blog.blogspot.com/feeds/posts/default?orderby=published&amp;alt=json-in-script&amp;callback=showrecentposts">
</script></div>
<div id="rpdr" style="font-family: arial, sans-serif; font-size: 9px;">
<a href="
learnprogramming2hindi.blogspot.com" target="_blank" title="Grab this Recent Posts Widget">Recent Posts Widget</a> by <a href="learnprogramming2hindi.blogspot.com" title="Recent Posts Widget">learn programming in hindi.</a></div>
<noscript>Your browser does not support JavaScript!</noscript>
<style type="text/css">
#hlrpsa a {color: #0B3861; font-size: 13px;} #rpdr {background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3f85962zpy5idyqZ01q8WmHgHwzdTDzMpNSHAyUucTTc2-8YtpdbVaLD-dd7Tgog4wVxd5yDK_JbTU_nngiN2vL63P447jKE0cy-wAOs0wAEy2wcGTee8wpJZ3GMnDkc8JtUSQR5XUaAI/s1600/blogger.png) 0px 0px no-repeat; padding: 1px 0px 0px 19px; height:14px; margin: 5px 0px 0px 0px;line-height:14px;}
#rpdr, #rpdr a {color:#808080;}
#hlrpsa { color: #999999; font-size: 11px; border-bottom:1px #cccccc dotted; margin-top:-10px; padding-bottom:10px;}
.hlrps a {font-weight:bold; }
.hlrpssumm {}
</style>



Option 2: Recent Posts Widget Showing Post Titles Only

<div id="hlrpsb">
<script style="text/javascript" src="http://helplogger.googlecode.com/svn/trunk/recent-posts-with-titles-only.js"></script>
<script style="text/javascript">var numposts = 10;var showpostdate = false;var showpostsummary = false;var numchars = 100;var standardstyling = true;</script>
<script src="http://your-blog.blogspot.com/feeds/posts/default?orderby=published&alt=json-in-script&callback=showrecentposts"></script></div>
<div style="font-family: arial, sans-serif; font-size: 9px;" id="rpdr"><a href="
learnprogramming2hindi.blogspot.com" title="Grab this Recent Posts Widget" target="_blank">Recent Posts Widget</a> by <a href="learnprogramming2hindi.blogspot.com" title="Recent Posts Widget">learn programming in hindi</a></div><noscript>Oops! Make sure JavaScript is enabled in your browser.</noscript>
<style type=text/css>
#hlrpsb a {color: #0B3861; font-size: 13px;} #rpdr {background: url( https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3f85962zpy5idyqZ01q8WmHgHwzdTDzMpNSHAyUucTTc2-8YtpdbVaLD-dd7Tgog4wVxd5yDK_JbTU_nngiN2vL63P447jKE0cy-wAOs0wAEy2wcGTee8wpJZ3GMnDkc8JtUSQR5XUaAI/s1600/blogger.png ) 0px 0px no-repeat; padding: 1px 0px 0px 19px; height:14px; margin: 5px 0px 0px 0px;line-height:14px;}
#rpdr, #rpdr a {color:#808080;}
.bbrecpost2 {
padding-top:6px;
padding-bottom:6px;
border-bottom: 1px #cccccc dotted; }
</style>

Step 4.

  • Change 5 (option 1) and 10 (option 2) with the number of posts you want to display. 
  • Change false to true if you want the posts dates to appear 
  • Change 100 (option 1) if you want more characters to be displayed.
  • To change the color and font size of the links, modify the values in blue (links) and violet (font-size)
  • To change the style of posts summary, modify the values in green (color) and orange (font size)
  • Replace the your-blog text with the name of your blog or if you have a custom domain change all the bolded line with your address like in this example:
 http://www.your-site.com/feeds/posts/default....

Step 5. Save your widget. And that's it! Enjoy!

Friday 28 March 2014

What is XHTML


जब W3C ने HTML का 4.1 Version Release किया, तब उन्होंने Document के Style से सम्बंधित सभी Markup को Deprecated Mark कर दिया यानी उन्होंने तय कर लिया कि HTML के Future Versions में इन HTML Markups को Remove कर दिया जाएगा। ऐसा उन्होंने इसलिए किया था, ताकि लोग Web Pages के Structure को Web Pages के Style से अलग Develop करें। परिणामस्वरूप आज के सभी नए Web Pages में केवल HTML Document का Structure होता है और HTML Web Page से सम्बंधित सभी Stylizing Markup एक अलग CSS File में होते हैं। हालांकि हम आज भी इन Style Markups को अपने HTML Document में HTML Structure के साथ उपयोग में ले सकते हैं, लेकिन हमें ऐसा करना नहीं चाहिए।
HTML के 4.1 Version को Release करने के बाद W3C ने HTML का 5.0 Version Release नहीं किया, बल्कि उन्होंने HTML को एक नए रूप में Release किया जिसका नाम उन्होंने XHTML रखा, ठीक उसी तरह से जिस तरह से Microsoft ने Window 2000 Release करने के बाद Windows 2001 Release नहीं किया बल्कि Windows XP Release किया था।
HTML के नाम के पहले X अक्षर को इसलिए लगाया गया, क्योंकि ये अक्षर एक नई Language XML (eXtensible Markup Language) से आया था। इस इस Language ने विभिन्न Programming क्षैत्रों में बहुत ही जल्दी बहुत ज्यादा प्रसिद्धि प्राप्त कर ली थी, क्योंकि इस Language का प्रयोग करके हम हमारी जरूरत के अनुसार अपने स्‍वयं के HTML Elements Create कर सकते हैं। इसीलिए W3C ने तय किया कि वह HTML के अगले Version को XML में लिखकर Release करेगा और उन्होंने ऐसा ही किया।
प्रायोगि‍क रूप से इसका मतलब ये हुआ कि जो लोग Web Pages लिखते हैं, उन लोगों को अब अपने HTML Codes को लिखने के बारे में ज्यादा सावधान रहना जरूरी है, क्योंकि XML एक Strict Language है, इसीलिए XHTML भी एक Strict Language बन गई है। Stricter Language का एक फायदा ये है कि Web Browser की Size छोटी हो गई है, जिससे Web Pages को अब ज्यादा छोटी Screen यानी Mobile जैसे Device पर भी आसानी से देखा जा सकता है। दूसरा फायदा ये है कि XML के लिए कई Tools को Develop किया गया है और हम उन सभी Tools को XHTML के साथ भी उपयोग में ले सकते हैं।
Web Programming सीखने वाले एक नए Developer के लिए फायदा ये है कि उसे HTML व  XHTML दोनों Languages को सीखने की जरूरत नहीं है। क्योंकि जब XHTML को Develop किया जा रहा था, तब इस बात का ध्यान रखा गया था कि XHTML उन Web Browsers के Compatible रहे, जो केवल HTML Pages को ही Display कर सकते हैं। कहने का मतलब ये है कि हम जितने भी XHTML Elements को उपयोग में लेना सीखेंगे, उनमें से लगभग सभी Elements HTML के 4.1 Version में भी उपलब्ध हैं। HTML से XHTML के बीच XHTML के तीन Versions को हमें ध्यान में रखना होता है।

Transitional XTHML 1.0

XHTML के इस Version में एक Developer उन HTML Markup को भी उपयोग में ले सकता है, जिन्हें HTML के 4.01 Version में Deprecated Declare कर दिया गया था, लेकिन इस Version में भी Developer को Stricter Syntax Use करने का ध्यान रखना होता है।

Strict XHTML 1.0

XHTML के इस Version में एक Developer उन HTML Markup को उपयोग में नहीं ले सकता है, जिन्हें HTML के 4.01 Version में Deprecated Declare कर दिया गया था, साथ ही इस Version में भी Developer को Stricter Syntax Use करने का ध्यान रखना होता है।

Frameset XHTML 1.0

XHTML के इस Version में एक Developer उस Technology का प्रयोग कर सकता है, जिसे Frames कहते हैं। यानी इस Version में हम एक ही Browser में एक से ज्यादा Web Pages को Open कर सकते हैं। इसके बारे में हम बाद में पढेंगे। इस Version में भी Developer को Stricter Syntax Use करने का ध्यान रखना होता है।
सामान्यतया हम Transitional XTHML 1.0 Version के Elements को ही उपयोग में लेंगे, क्योंकि ये Version HTML 4.01 Version के Elements को भी Support करता है। लेकिन जहां तक हो सके हमें XHTML के Elements का ही प्रयोग करना चाहिए। जब हम केवल Pure XHTML के Elements ही उपयोग में लेते हैं और Deprecated Elements व Attributes का प्रयोग नहीं करते हैं, तब हमारा Page स्‍वयं ही Strict XHTML 1.0 का Page बन जाता है।

XHTML और HTML में अंतर

XHTML के नियमों को समझ लें, तो हम इन दोनों Languages के बीच के आपसी अन्‍तर को भी समझ सकते हैं। XHTML के विभिन्न Restrictions व विशेषताएं निम्नानुसार हैं:

Include XML Declaration

HTML की तुलना में XHTML के Syntax ज्यादा Strict होते हैं। चूंकि XHTML को XML में लिखा गया है, इसलिए जब हम एक XHTML Document बनाते हैं, तब वास्तव में हम एक XML Document भी बना रहे होते हैं। इसलिए हम हमारे Document की शुरूआत निम्नानुसार एक Optional Line से भी कर सकते हैं, जो कि सभी XML Documents में एक Optional Declaration होता है।
<?xml version=”1.0” encoding=”UTF-8” ?>
 
यदि हम हमारे Document में इस XML Declaration को Include करते हैं, तो ये Statement हमारे Document का सबसे पहला Statement होना जरूरी होता है, यहां तक कि इस Statement से पहले एक Blank Space भी नहीं होना चाहिए। इस Statement द्वारा हम अपने Web Browser को ये बताते हैं कि हम हमारे Document में XML के 1.0 Version के Standards के आधार पर नए Elements भी Create करने की सुविधा प्राप्त करना चाहते हैं और encoding Attribute द्वारा हम ये बताते हैं कि हम हमारे Document में किस Encoding को Support करवाना चाहते हैं। उदाहरण के लिए यदि हम हमारे Web Page में हिन्दी भाषा में भी Contents लिखना चाहते हैं और हम चाहते हैं कि इस भाषा में लिखे गए Content को दुनियां के सभी नए Web Browsers बिना किसी परेशानी के दिखा सकें, तो हमें Encoding के रूप में “UTF-8” को चुनना होता है, क्योंकि हिन्दी भाशा के Unicode इसी Encoding के अन्‍तर्गत Defined हैं।

Include a DOCTYPE Declaration

DOCTYPE Declaration इस बात को Indicate करता है कि हम HTML/XHTML के कौनसे Version को उपयोग में ले रहे हैं। इसे Opening <html> Tag को Use करने से पहले Specify किया जाता है। यदि हम हमारे Document में Transitional XHTML 1.0 Version के आधार पर Coding कर रहे हैं, जिसमें हम पुराने HTML 4.01 Version के Elements को Use करना चाहते हैं, तो हमें हमारे Web Browser को ये बात निम्नानुसार बतानी होती है:
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
इसके बजाय यदि हम Strict XHTML 1.0 Version के आधार पर अपने Web Pages तैयार कर रहे हों, तो हमें अपने Web Page में निम्न DOCTYPE Declaration Statement को उपयोग में लेना होता है:
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
जबकि यदि हम हमारे Document में Frameset का प्रयोग करना चाहते हैं, तो हमें हमारे Web Page में निम्न DOCTYPE Declaration Statement को Use करना होता है:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
 
Strict XHTML Documents में हमें DOCTYPE Declaration Statement को <html> Tag से पहले Use करना जरूरी होता है, जबकि यदि हम Transitional अथवा Frameset Document Create कर रहे हों, तो हम इस Declaration को छोड भी सकते हैं।

HTML के Versions और <!DOCTYPE> Declaration

                         <!DOCTYPE> declaration किसी वेब पेज को browser में सही तरीके से प्रदर्शित करने मे सहायता करता है।

HTML के विभिन्न वर्जनों के सामान्य Declarations है –

Version
Year
<!DOCTYPE> declaration
HTML
1991

HTML+
1993

HTML 2.0
1995

HTML 3.2
1997

HTML 4.01 Strict
1999
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Transitional
1999
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
HTML 4.01 Frameset
1999
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
XHTML 1.0 Strict
2000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
XHTML 1.0 Transitional

2000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
XHTML 1.0 Frameset

2000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
XHTML 1.1

2000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
HTML5
2012
<!DOCTYPE html>
XHTML5
2013

Use Lowercase Names

एक HTML Document में हम Uppercase अथवा Lowercase किसी भी तरह के Case में HTML Elements व Attributes को लिख सकते हैं, लेकिन XHTML Document में हमें सभी Element व  Attribute को Lowercase में लिखना जरूरी होता है। हालांकि Elements के बीच के Contents व Attributes के मान Case Sensitive नहीं होते हैं।

Close All Tags Correctly

XHTML में हमें हर Open होने वाले Tag को ठीक तरह से Close करना जरूरी होता है। हम केवल उसी स्थिति में किसी Tag  को Close करने से बच सकते हैं, जबकि वह Tag एक Empty Tag हो। HTML में हम किसी Paragraph को निम्नानुसार लिख सकते हैं:

<p> This is a HTML Paragraph Element.
<p> HTML could leave the closing tag.


जबकि इसी Paragraph को यदि हम XHTML में लिखें, तो हमें ये Paragraph Element निम्नानुसार Use करना होगा:

<p> This is a XHTML Paragraph Element. </p>
<p> XHTML could not leave the closing tag. </p>
जितनी बार भी एक XHTML Browser एक नए <p> Tag  को Run करता है, वह पिछले </p> Tag के अन्‍त को स्‍वयं ही मान लेता है, लेकिन XHTML तब तक नए Paragraph को नहीं मानता, जब‍ तक कि उसे पहले वाले Paragraph का Closing Tag प्राप्त नहीं हो जाता। इसलिए XHTML में हमें हर Tag को ठीक तरह से Close करना जरूरी होता है।
कुछ Tags ऐसे होते हैं, जिनके Opening व Closing Tag के बीच कोई Content नहीं होता। इस प्रकार के Tags को Empty Tag कहा जाता है। <img> व  <br> एसे ही Empty Tags हैं। इन्‍हें HTML में तो एसे ही लिखा जाता है, लेकिन जब हम XHTML Document बनाते हैं, तब हमें इन Empty Tags को भी Forward Slash के साथ लिखना होता है। यानी हमें इन्‍हें <img /> व <br /> लिखना पडता है।

Attribute Values

जब हम XHTML Attributes को कोई मान प्रदान करते हैं, तब हमें तीन बातें ध्यान में रखनी होती हैं। सबसे पहली बात ये कि हर Value को Double Quotes के बीच Enclosed रखना जरूरी होता है। दूसरी बात ये कि हर Attribute को मान प्रदान करना जरूरी होता है और तीसरी बात ये कि Value के पहले व बाद के Spaces Remove हो जाते हैं, इसलिए हमें Spaces के सम्‍बं‍ध में ध्यान रखने की जरूरत नहीं होती है।

HTML Element Must Be The Root Element

किसी भी XHTML Document की शुरूआत हमेंशा <html> Opening Tag से होती है व अन्‍त हमेंशा </html> Closing Tag से होती है। <html> Tag से पहले केवल XML Declaration व  DOCTYPE Declaration Statements ही आ सकते हैं, क्योंकि सभी XML Documents में एक Unique Root Element होना जरूरी होता है, जो कि बाकी के पूरे Document को अपने में Included या Contained रखता है। हमारे XHTML Document के सन्‍दर्भ में वह Root Element <html> Tag है।

Tags Must Nest Properly

XHTML Document में हम जिस Tag को सबसे पहले Open करते हैं, उसे सबसे बाद में व जिस Tag को सबसे बाद में Open करते हैं, उसे सबसे पहले Close करना जरूरी होता है। यदि हम एक साथ एक से ज्यादा Tags को Open करते हैं, तो हमें इस बात का ध्यान रखना होता है। उदाहरण के लिए निम्न Statement में पहले <p> Tag को Open किया है और बाद में <em> Tag को इसलिए सबसे पहले हमें <em> Tag को Close करना होता है और बाद में <p> Tag को।

<p> This is a <em>HTML Paragraph Element. </em></p>

जिन उपरोक्‍त नियमों का हमें XHTML Document बनाते समय ध्यान रखना जरूरी होता है, HTML Document बनाते समय हमें इन नियमों को ध्यान में रखने की जरूरत नहीं होती है। HTML व XHTML Document Creation में ये ही मुख्य अन्‍तर हैं।

Creating First HTML Page - HTML Tags and Elements


अब हम पहला HTML Web Page बनाते हैं। इस Page द्वारा हम विभिन्‍न प्रकार के Basic Concepts को समझ सकते हैं।

<!DOCTYPE html>
<html>
<head>
<title>HTML – Fast Track Course </title>
</head>
<body>
<h1>HTML – Introduction </h1>
<p>
document type को पारिभाषित करता है । यह HTML5 वर्जन मे काम आता है । यह प्रदर्शित नही होता है यानि यह छुपा हुआ होता है । यहहमारे web page के सभी अन्य elements को लिखा जाता है। यह प्रदर्शित नही होता है यानि यह छुपा हुआ होता है ।
</p>
</body>
</html>
  • <!DOCTYPE html> - document type को पारिभाषित करता है । यह HTML5 वर्जन मे काम आता है । यह प्रदर्शित नही होता है यानि यह छुपा हुआ होता है ।
  • <html> और </html>  के बीच में हमारे web page के सभी अन्य elements को लिखा जाता है। यह प्रदर्शित नही होता है यानि यह छुपा हुआ होता है ।
  • <body> और </body> के बीच में जो page content लिखा जाता है वह हमे हमारे web page में दिखाई देता है ।
  • <h1> और </h1>  के बीच जो लिखा जाता है वह heading की तरह दिखता है ।
  • <p> और </p> के बीच जो लिखा जाता है वह paragraph की तरह दिखता है ।
इस Example को Notepad में Type करके sample.htm नाम के साथ IIS Local Host के wwwroot Folder में अथवा WAMP के www Folder में अथवा XAMPP के htdocs Folder में “mysite” नाम का एक Sub-Folder Create करके उसमें Save करें और Web Browser को Open करके उसके Address Bar में http://localhost/mysite/sample.htm Type करके Enter करें। 

इस Web Page पर हम Title Bar में Page का Title, Heading व Paragraph देख सकते हैं, जो कि हमने Notepad में Type किया था, लेकिन हमने Notepad में जिन HTML Tags को Use किया था, वे HTML Tags हमें दिखाई नहीं दे रहे हैं, क्योंकि वे सभी Tags Document को Browser में Structure या Organize करने के उपयोग में आ गए हैं। Web Page Create करते समय हमने जो Texts Angle Brackets के बीच लिखे थे, वे सभी HTML Tags थे जबकि अन्‍य Texts वे Information हैं, जिन्हें हम Browser में Render करना चाहते थे।

HTML Tags क्या होते है ?

  1. HTML tags कुछ शब्द (tag names) होते है, जो किसी शब्द को दोनो और से Angle brackets (<……..>) से बाँधते है, जैसे -  <html>
  2. HTML tags सामान्यत: जोडे मे होते है, जैसे <b> और </b>
  3. जोडे का पहला tag - start tag, और दुसरा tag - end tag कहलाता है ।
  4. end tag भी start tag की तरह ही लिखा जाता है, पर इसमें tag के नाम के पहले forward slash ( / )
  5.  Start and end tags को opening tags और closing tags भी कहा जाता है ।
Example -  <tagname> आपका content </tagname>

HTML Elements क्या होते है ?

                                       "HTML tags" और "HTML elements" को सामान्यत: एक ही वस्तु कहा जाता है। पर असल में, एक HTML element वह सब कुछ है जो start tag और end tag के बीच लिखा जाता है:
 Example -  <p>This is a paragraph.</p>
                    यदि हम अपने Example की पहली व आखिरी Code Line को देखें, तो हम एक HTML Tag Pair को देख सकते हैं जिसमें <html></html> लिखा गया है। दो Opening and Closing Angle Brackets व उसमें लिखे गए Texts को Tag कहा जाता है। हम देख सकते हैं कि हमारे Example में बहुत सारे Tags का प्रयोग किया गया है।
हमारे उदाहरण में हर Tag एक जोडे के रूप में है। Opening Tag व Closing Tag में केवल इतना अन्‍तर होता है कि Closing Tag में हमेंशा एक Forward Slash का प्रयोग किया जाता है। जब एक HTML Tag Pair के बीच कुछ Information Texts को लिखा जाता है, तब बनने वाले पूरे Statement को Element कहा जाता है। 

HTML Tag and Element

पिछले उदाहरण में हमने सबसे पहले <html></html> Tag Pair को उपयोग में लिया है। किसी भी Web Page में लिखा जाने वाला ये एक जरूरी Element है, क्योंकि Web Page में जो कुछ भी दिखाई देता है, वह सबकुछ इसी Tag Pair में लिखा जाना जरूरी होता है।
हर <html></html> Tag Pair के हमेंशा दो हिस्से होते हैं, जिनमें पहला हिस्सा Web Browser व Search Engines से सम्बंधित जानकारियों के लिए होता है। इस हिस्से को <head></head> Tag Pair के रूप में Identify किया जाता है, जबकि दूसरा हिस्सा <body></body> Tag Pair के रूप में होता है और हम अपने Web Page को Structure करने के लिए जितने भी Tags उपयोग में लेते हैं उन सभी Tags को यहीं Use करना होता है।
उदाहरण के लिए Web Page का Title Web Browser के Title Bar में दिखाई देता है, इसलिए <title></title> Tag Pair को हमने <head> Element में उपयोग में लिया है, जबकि अपने Web Page के Contents की Heading को Web Browser में Render करने के लिए हमने <h1> Element का प्रयोग <body> Element में किया है।
हमने पहले भी उल्लेख किया था कि Markup Tags Documents में किसी Text को Highlight करने अथवा उसे Special Meaning देने का काम करते हैं। ये Tags Browser को जो Special Meaning देते हैं, वे Description ही Document को Structure करते हैं। हमारे उदाहरण में जब हम <h1> Opening Tag User करते हैं, तो ये Tab Web Browser को बताता है कि यहां से Heading 1 का Text शुरू हो रहा है, जबकि </h1> Closing Tag Web Browser को बताता है, कि यहां पर Heading 1 का Text समाप्त हो रहा है। यदि हम इन Tags का प्रयोग ना करें, तो सारे Texts Web Browser के लिए सामान्य Texts होंगे और Browser किसी भी Text को अलग तरह से Markup या Highlight नहीं करेगा।
                 विभिन्न प्रकार के HTML Tags ही Web Browser को बताते है, कि किस Text को Heading के रूप में Render करना है और किस Text को सामान्य Paragraph क रूप में। कई बार हमें एक Element के अन्दर दूसरे Element की Nesting करनी पडती है। इस स्थिति में Outer Element Parent Element कहलाता है, जबकि Inner Element Child Element कहलाता है।