Sunday 30 November 2014

Calculating age in years in php

Age calculation in php



Declare a function =>

  1. function getAge( $dob, $date )
  2. {
  3.     $dob=strtotime($dob);
  4.     $date=strtotime($date);
  5.         $age = 0;
  6.         while( $date > $dob = strtotime('+1 year', $dob))
  7.         {
  8.                 ++$age;
  9.         }
  10.         return $age." years";
  11. }

Thursday 2 October 2014

Remove instance of CKEDITOR


I was implementing CKEditor with jQuery so that I can load data dynamically and allow the user to edit using CKEditor. I quickly ran into the issue of the editor not showing up after the first display.
The problem was there of the instance of CKEDITOR.
before submitting the ajax form the instance should be destroyed to make changes effect.
I resolved it using 3 lines of code.
if(CKEDITOR.instances['editor'])
                {
                    CKEDITOR.instances['editor'].destroy();
                }
 

Tuesday 5 August 2014

Galaxy Mega 6.3 GT-I9205 Hard Reset

Before you give your handset to repair shop or buy new handset, please try the following procedure to repair your device. First charge your battery more then 70%, backup your important data like phone-book, message, email, images and settings and in most cases take out SIM card and SD card. After doing hard reset not possible to recover your data, so online backup is always important. For all of your data, a backup should be done on a external device, hard drive, raid system media or SD card.


Galaxy Mega 6.3 GT-I9205 Hard Reset

Hard reset:-
  • Press and hold Volume UP + Power Key Until Samsung menu Appear
  • Now you see android recovery menu
  • Now select Wipe data/factory reset and press power key to confirm
  • Now select Yes -- Delete all user data and press power key to confirm
  • Now reboot device
  • hard reset done



Hard reset by code
  • Enter Dial number *2767*3855#
  • Now you see Factory Format
  • wait until factory format complete
  • after factory format handset will be reboot
  • hard reset done



Samsung T559 Hard Reset

Before you give your handset to repair shop or buy new handset, please try the following procedure to repair your device. First charge your battery more then 70%, backup your important data like phone-book, message, email, images and settings and in most cases take out SIM card and SD card. After doing hard reset not possible to recover your data, so online backup is always important. For all of your data, a backup should be done on a external device, hard drive, raid system media or SD card.


Samsung T559 Hard Reset


  • Enter Dial number *2767*3855#
  • Now you see Factory Format
  • wait until factory format complete
  • after factory format handset will be reboot
  • hard reset done



Samsung T479 Gravity 3 master Hard Reset

Before you give your handset to repair shop or buy new handset, please try the following procedure to repair your device. First charge your battery more then 70%, backup your important data like phone-book, message, email, images and settings and in most cases take out SIM card and SD card. After doing hard reset not possible to recover your data, so online backup is always important. For all of your data, a backup should be done on a external device, hard drive, raid system media or SD card.


Samsung T479 Gravity 3 master Hard Reset


  • Enter Dial number *2767*3855#
  • Now you see Factory Format
  • wait until factory format complete
  • after factory format handset will be reboot
  • hard reset done



Samsung SGH-500 Hard Reset

Before you give your handset to repair shop or buy new handset, please try the following procedure to repair your device. First charge your battery more then 70%, backup your important data like phone-book, message, email, images and settings and in most cases take out SIM card and SD card. After doing hard reset not possible to recover your data, so online backup is always important. For all of your data, a backup should be done on a external device, hard drive, raid system media or SD card.


Samsung SGH-500 Hard Reset


  • Enter Dial number *2767*3855#
  • Now you see Factory Format
  • wait until factory format complete
  • after factory format handset will be reboot
  • hard reset done



Samsung S3770 Hard Reset

Before you give your handset to repair shop or buy new handset, please try the following procedure to repair your device. First charge your battery more then 70%, backup your important data like phone-book, message, email, images and settings and in most cases take out SIM card and SD card. After doing hard reset not possible to recover your data, so online backup is always important. For all of your data, a backup should be done on a external device, hard drive, raid system media or SD card.


Samsung S3770 Hard Reset


  • Enter Dial number *2767*3855#
  • Now you see Factory Format
  • wait until factory format complete
  • after factory format handset will be reboot
  • hard reset done



Samsung Mesmerize i500 Android Hard Reset

Before you give your handset to repair shop or buy new handset, please try the following procedure to repair your device. First charge your battery more then 70%, backup your important data like phone-book, message, email, images and settings and in most cases take out SIM card and SD card. After doing hard reset not possible to recover your data, so online backup is always important. For all of your data, a backup should be done on a external device, hard drive, raid system media or SD card.


Samsung Mesmerize i500 Android Hard Reset


  • Press and hold the Volume Down + VOLUME UP + Power buttons.
  • Now select Wipe data/factory reset and press power key to confirm
  • Now select Yes -- Delete all user data and press power key to confirm
  • Now reboot device
  • hard reset done

Another method:---
  • Enter Dial number *2767*3855#
  • Now you see Factory Format
  • wait until factory format complete
  • after factory format handset will be reboot
  • hard reset done



Samsung B320 Hard Reset

Before you give your handset to repair shop or buy new handset, please try the following procedure to repair your device. First charge your battery more then 70%, backup your important data like phone-book, message, email, images and settings and in most cases take out SIM card and SD card. After doing hard reset not possible to recover your data, so online backup is always important. For all of your data, a backup should be done on a external device, hard drive, raid system media or SD card.


Samsung B320 Hard Reset


  • Enter Dial number *2767*3855#
  • Now you see Factory Format
  • wait until factory format complete
  • after factory format handset will be reboot
  • hard reset done



Samsung B130 Hard Reset

Before you give your handset to repair shop or buy new handset, please try the following procedure to repair your device. First charge your battery more then 70%, backup your important data like phone-book, message, email, images and settings and in most cases take out SIM card and SD card. After doing hard reset not possible to recover your data, so online backup is always important. For all of your data, a backup should be done on a external device, hard drive, raid system media or SD card.


Samsung B130 Hard Reset


  • Enter Dial number *2767*3855#
  • Now you see Factory Format
  • wait until factory format complete
  • after factory format handset will be reboot
  • hard reset done



Samsung A886 Hard Reset

Before you give your handset to repair shop or buy new handset, please try the following procedure to repair your device. First charge your battery more then 70%, backup your important data like phone-book, message, email, images and settings and in most cases take out SIM card and SD card. After doing hard reset not possible to recover your data, so online backup is always important. For all of your data, a backup should be done on a external device, hard drive, raid system media or SD card.


Samsung A886 Hard Reset


  • Enter Dial number *2767*3855#
  • Now you see Factory Format
  • wait until factory format complete
  • after factory format handset will be reboot
  • hard reset done



Monday 4 August 2014

Samsung A500 Hard Reset

Before you give your handset to repair shop or buy new handset, please try the following procedure to repair your device. First charge your battery more then 70%, backup your important data like phone-book, message, email, images and settings and in most cases take out SIM card and SD card. After doing hard reset not possible to recover your data, so online backup is always important. For all of your data, a backup should be done on a external device, hard drive, raid system media or SD card.


Samsung A500 Hard Reset


  • Enter Dial number *2767*3855#
  • Now you see Factory Format
  • wait until factory format complete
  • after factory format handset will be reboot
  • hard reset done


Micromax A72 Canvas Viva Hard Reset

Before you give your handset to repair shop or buy new handset, please try the following procedure to repair your device. First charge your battery more then 70%, backup your important data like phonebook, message, email, images and settings and in most cases take out SIM card and SD card. After doing hard reset not possible to recover your data, so online backup is always important. For all of your data, a backup should be done on a external device, hard drive, raid system media or SD card.

Micromax A72 Canvas Viva Hard Reset

  • Download Tool and Driver
  • open SP Flash Tool and Select Scatter-loading file
  • Use same version file (same color)
  • now click Download and click yes
  • Now switch off handset and connect to PC with USB data cable
  • Now install driver quickly
  • after install driver download to phone not start then disconnect phone and reconnect to PC again
  • now User data image file download and hard reset done
  • any problem contact US




Tuesday 22 July 2014

How to run WAMP Server on Windows 8

How to run WAMP Server on Windows 8


As you might know that the post I made previously was just a way to get around this strange problem. After a long time, I've finally managed to find out the actual reason for this problem, which I want to share with all of you.


The thing is that Windows 8 is an IPV6-first Operating System and WAMP is, by default, configured to run with IPV4 only. This creates a conflict and hence we face this problem. To confirm that Windows 8 uses IPV6. Open the command prompt and type ping localhost and press the Enter key. You'll receive a reply from ::1 which is the loopback address for IPV6. 

So in order to properly tackle this problem, there's no need to follow the steps I mentioned in    my earlier post. Although my older post might have solved your problem, it isn't a proper solution. Here's what you should actually be doing.

Step # 1 - Changes in httpd.conf file

Monday 21 July 2014

Forbidden error on windows 8 wamp localhost


Forbidden error on windows 8 wamp localhost


goto: your-wamp-installation-folder\bin\apache\Apache2.2.22\conf\httpd.conf
Replace: Listen 80
With: Listen 0.0.0.0:80

Note: have tested for Apache2.2.21 and 2.2.22

How To Update Sony Xperia To Android 4.2.2

How To Update Sony Xperia To Android 4.2.2


When Google rolls out an update for Android Jelly Bean it takes some time for phone manufactures to work the update into their customized versions of Android.
Sony Mobile the maker to the famous Xperia line of Android Smartphones has many different Xperias they need to update to the latest Android Version called Jelly Bean or 4.2.2.
There are two ways that Sony delivers to the update to the Xperia phone.

Update Method One is OTA (Over the Air):--
You can go into your Xperia and find the “Settings” button.
If you scroll down to the bottom you will see it says “About Phone”, click on that.
The top button should read “System Updates”, click it.
It will may say “Your system is up to date”, however you want to look lower down and see if you can find the “Check Now” button.
When you click it, it will check to see if your device has the 4.2.2 update available.
If you have an update available it will give you the option to “Update Now”.

Update Method Two is PC Companion:--
Occasionally a notice will appear on the top of your phones status bar that says Sony Xperia Update Available.
When you click it nothing happens!
What you need to do to update your phone is connect it to you laptop or computer.
Then you need to install Sony PC Companion software which you can find here.
Once you install Sony PC Companion you need it to detect your attached phone. Sometimes by disconnecting and connecting your phone to your computer will make it show up in PC companion.
Then follow the instructions in Sony PC companion to install the Update for your Android Xperia.
It may take as long as 30 minutes for your Sony Xperia to receive and install the new Android Update so only do this when you have time to spare and you will not need your phone.
After the update is installed, your phone will reboot. It can take 5 minutes just for your phone to reboot!

Tuesday 3 June 2014

Android 4.4.2 KitKat For Samsung Galaxy S Advance I9070: How To Install It Using Carbon Custom ROM [Tutorial]

Android 4.4.2 KitKat For Samsung Galaxy S Advance I9070: How To Install It Using Carbon Custom ROM [Tutorial]


Users of Samsung Electronics Co.’s (KRX:005935) Galaxy S Advance I9070 can now update their handsets to the latest Android 4.4.2 KitKat by flashing a new build of the Carbon custom ROM, which is developed based on the new Android version.

Being an unofficial firmware, the Carbon ROM requires a custom recovery such as ClockworkMod in order to install the software and Google Apps zip files on the phone.
Check out the tutorial below to flash the custom ROM on the Galaxy S Advance I9070 using Odin.
Note: We are not responsible if anything goes wrong. Users should proceed at their own risk.
Points To Remember
- This tutorial is only for Samsung Galaxy S Advance I9070 handsets.
- The device must be rooted and have ClockWorkMod Recovery installed.
- Back-up all the data in your phone properly.
- The device must have at least 80 percent battery power.
- The USB driver must be installed for the device in your PC.
- Enable USB Debugging via Setting > Developer options > USB Debugging.
- If the device gets stuck on booting or experiences a boot loop issue, perform wipe cache partition and wipe dalvik cache a few more times before rebooting.
Tutorial
Step 1: Download Carbon custom ROM for the Galaxy S Advance.
Step 2: Download Google Apps package.
Step 3: Connect the device to the computer via USB and copy the ROM and Google Apps zip files to the root folder of your handset’s SD card. But do not extract them.
Step 4: Disconnect USB and turn off the phone.
Step 5: Now, get into the Recovery Mode by pressing and holding Volume Up, Home and Power buttons together.
Step 6: Once you are in the Recovery Mode, select “wipe data/factory reset.” Use the Power button to select options. After that, perform a cache wipe by selecting “wipe cache partition.”
Step 7: From CWM recovery, go to “Advanced” menu and then select “wipe dalvik cache.”
Step 8: Go back to the main recovery screen and select “install zip from sdcard” and then select “choose zip from sdcard.”
Step 9: Use the Volume keys to go to the Android 4.4.2 ROM zip file copied to the SD card and select it using the Power button.
Step 10: Repeat the previous step to install Google Apps.
Step 11: Once the installation process is complete, press the “+++Go back+++” button to go back to the main recovery menu and select “reboot system now.” The phone will take about five minutes to restart.

Post published by - Kapil Kumar

Wednesday 21 May 2014

Let's get started html website development


In this first lesson, you will get a brief presentation of the tools you need to make a website.

What is needed?

Most likely you already have everything you need.
You have a "browser". A browser is the program that makes it possible to browse and open websites. Right now you are looking at this page in your browser.
It is not important which browser you use. The most common is Microsoft Internet Explorer. But there are others such as Opera and Mozilla Firefox and they can all be used.
You might have heard about, or even used, programs such as Microsoft FrontPage, Macromedia Dreamweaver or even Microsoft Word, which can - or claim that they can - create websites for you. Forget these programs for now! They are not of any help to you when learning how to code your own website.
Instead, you need a simple text editor. If you are using Windows you can use Notepad, which is usually found in the start menu under Programs in Accessories:

If you are not using Windows, you can use a similar simple text editor. For example, Pico (Linux) or TextEdit (Mac).
Notepad is a very basic text editing program which is excellent for coding because it does not interfere with what you are typing. It gives you complete control. The problem with many of the programs that claim they can create websites is that they have a lot of standard functions, which you can choose from. The downside is that, everything needs to fit into these standard functions. Thus, this type of programs often cannot create a website exactly as you want it. Or - even more annoyingly - they make changes to your hand-written code. With Notepad or other simple text editors, you only have yourself to thank for your successes and errors.
A browser and Notepad (or a similar simple text editor) are all you need to go through this tutorial and make your own websites.

Do I need to be online?

You do not need to be connected to the Internet - neither while reading this tutorial, nor while making your websites.
If you want to avoid being online while reading this tutorial, you can either print it out or simply disconnect from the Internet while reading on screen. You can make the website on your computer's hard disk and upload it to the Internet when it is finished.

What's next?

Go to the next lesson and read about HTML

A few more elements


Did you manage to make a few pages on your own? If not, here is an example:

 
 <html>

   <head>
   <title>My website</title>
   </head>

   <body>
   <h1>A Heading</h1>
   <p>text, text text, text</p>
   <h2>Subhead</h2>
   <p>text, text text, text</p>
   </body>
   
 </html>
 
 

Now what?

Now it is time to learn seven new elements.
In the same way you emphasise the text by putting it between the openning tag <em> and the closing tag </em>, you can give stronger emphasis by using the openning tag <strong> and the closing tag </strong>.

Example 1:
 
 <strong>Stronger emphasis.</strong>
 
 
Will look like this in the browser:
Stronger emphasis.
Likewise, you can make your text smaller using small:

Example 2:
 
 <small>This should be in small.</small>
 
 
Will look like this in the browser:
This should be in small.

Can I use several elements at the same time?

You can easily use several elements at the same time as long as you avoid overlapping elements. This is best illustrated by an example:

Example 3:

If you want to emphasise small text, it must be done like this:
 
 <em><small>Emphasised small text</small></em>
 
 
And NOT like this:
 
 <em><small>Emphasise small text</em></small>
 
 
The difference is that in the first example, we closed the tag we first opened last. This way we avoid confusing both ourselves and the browser.

More elements!

As mentioned in Lesson 3 there are elements which are opened and closed in the same tag. These so-called empty elements are not connected to a specific passage in the text but rather are isolated labels. An example of such a tag is <br /> which creates a forced line break:

Example 4:
 
 Some text<br /> and some more text in a new line 
 
 
Will look like this in the browser:
Some text
and some more text in a new line
Notice that the tag is written as a contraction of an opening and closing tag with an empty space and a forward slash at the end: <br />.
Another element that is opened and closed in the same tag is <hr /> which is used to draw a horizontal line ("hr" stands for "horizontal rule"):

Example 5:
 
 <hr />
 
 
Will look like this in the browser:

Examples of elements that needs both an opening tag and a closing tag - as most elements do - is ulol and li. These elements are used when you want to make lists.
ul is short for "unordered list" and inserts bullets for each list item. ol is short for "ordered list" and numbers each list item. To make items in the list use the li tag ("list item"). Confused? See the examples:

Example 7:
 
 <ul>
   <li>A list item</li>
   <li>Another list item</li>
 </ul>
 
 
will look like this in the browser:
  • A list item
  • Another list item
Example 8:
 
 <ol>
   <li>First list item</li>
   <li>Second list item</li>
 </ol>
 
 
will look like this in the browser:
  1. First list item
  2. Second list item


Create your first website


With what you learned in the previous lessons, you are now only minutes away from making your first website.

How?

In Lesson 1 we looked at what is needed to make a website: a browser and Notepad (or similar text editor). Since you are reading this, you most likely already have your browser open. The only thing you need to do is to open an extra browser window (open the browser one more time) so you can read this tutorial and see your new website at the same time.
Also, open Notepad (in Accessories under Programs in the Start menu):

Now we are ready!

What can I do?

Let us start with something simple. How about a page that says: "Hurrah! This is my first website." Read on and you'll find out how simple it is.
HTML is simple and logical. The browser reads HTML like you read English: from the top down and from left to right. Thus, an simple HTML document begins with what should come first and ends with what should come last.
The first thing you need to do is to tell the browser that you will "talk" to it in the language HTML. This is done with the tag <html> (no surprises there). So before you do anything else type "<html>" in the first line of your document in Notepad.
As you may recall from the previous lessons, <html> is an opening tag and must be closed with a closing tag when you are finished typing HTML. So to make sure you don't forget the HTML close tag now type "</html>" a couple of lines down and write the rest of the document between <html> and</html>.
The next thing your document needs is a "head", which provides information about your document, and a "body", which is the content of the document. Since HTML is nothing if not logical, the head (<head> and </head>) is on top of the body (<body> and </body>).
Your document should now look like this:
 
 <html>

   <head>
   </head>

   <body>
   </body>

 </html>
 
 
Note how we structured the tags with new lines (using the Enter key) as well as indents (using the Tab key). In principle, it does not matter how you structure your HTML document. But to help you, and others reading your coding, to keep an overview, it is strongly recommended that you structure your HTML in a neat way with line breaks and indents, like the above example.
If your document looks like the above example, you have made your first website - a particularly boring website and probably not what you dreamt of when you started this tutorial but still some sort of a website. What you have made will be the basic template for all your future HTML documents.

So far so good, but how do I add content to my website?

As you learnt earlier, your HTML document has two parts: a head and a body. In the head section you write information about the page, while the body contains the information that constitutes the page.
For example, if you want to give the page a title which will appear in the top bar of the browser, it should be done in the "head" section. The element used for a title is title. I.e. write the title of the page between the opening tag <title> and the closing tag </title>:
 
 <title>My first website</title>
 
 
Note that this title will not appear on the page itself. Anything you want to appear on the page is content and must therefore be added between the "body" tags.
As promised, we want the page to say "Hurrah! This is my first website." This is the text that we want to communicate and it therefore belongs in the body section. So in the body section, type the following:
 
 <p>Hurrah! This is my first website.</p>
 
 
The p in <p> is short for "paragraph" which is exactly what it is - a text paragraph.
Your HTML document should now look like this:
 
 <html>

   <head>
   <title>My first website </title>
   </head>

   <body>
   <p>Hurrah! This is my website.</p>
   </body>

 </html>
 
 
Done! You have now made your first real website!
Next all you have to do is to save it to your hard drive and then open it in your browser:
  • In Notepad choose "Save as..." under "File" in the top menu.
  • Choose "All Files" in the "Save as type" box. This is very important - otherwise, you save it as a text document and not as an HTML document.
  • Now save your document as "page1.htm" (the ending ".htm" indicates that it is an HTML document. ".html" gives the same result. I always use ".htm", but you can choose whichever of the two extensions you prefer). It doesn't matter where you save the document on your hard drive - as long as you remember where you saved it so you can find it again.
Now go to the browser:
  • In the top menu choose "Open" under "File" (or press CTRL+O).
  • Click "Browse" in the box that appears.
  • Now find your HTML document and click "Open".
It now should say "Hurrah! This is my first website." in your browser. Congratulations!

Tables of html

Tables are used when you need to show "tabular data" i.e. information that is logically presented in rows and columns.

Is it difficult?

Building tables in HTML may at first seem complicated but if you keep cool and watch your step, it is actually strictly logical - just like everything else in HTML.
Example 1:
 
 <table>
   <tr>
  <td>Cell 1</td>
  <td>Cell 2</td>
   </tr>
   <tr>
  <td>Cell 3</td>
  <td>Cell 4</td>
   </tr>
 </table>
 
 
Will look like this in the browser:
Cell 1Cell 2
Cell 3Cell 4

What's the difference between <tr> and <td>?

As you will see from the above example, this is probably the most complicated HTML example we have given you so far. Let's break it down and explain the different tags:
3 different elements are used to insert tables:
  • The opening tag <table> and the closing tag </table> starts and ends the table. Logical.
  • <tr> stands for "table row" and starts and ends horizontal rows. Still logical.
  • <td> is short for "table data". This tag starts and ends each cell in the rows of your table. All simple and logical.
Here is what happens in Example 1: the table starts with a <table>, followed by a <tr>, which indicates the beginning of a new row. Two cells are inserted in this row: <td>Cell 1</td> and <td>Cell 2</td>. The row is hereafter closed with a </tr> and a new row <tr> begins immediately after. The new row also contains two cells. The table is closed with </table>.
Just to make it clear: rows are horizontal lines of cells and columns are vertical lines of cells:
Cell 1Cell 2
Cell 3Cell 4
Cell 1 and Cell 2 form a row. Cell 1 and Cell 3 form a column.
In the above example, the table has two rows and two columns. However, a table can have an unlimited number of rows and columns.
Example 2:
 
 <table>
   <tr>
  <td>Cell 1</td>
  <td>Cell 2</td>
  <td>Cell 3</td>
  <td>Cell 4</td>
   </tr>
   <tr>
  <td>Cell 5</td>
  <td>Cell 6</td>
  <td>Cell 7</td>
  <td>Cell 8</td>
   </tr>
   <tr>
  <td>Cell 9</td>
  <td>Cell 10</td>
  <td>Cell 11</td>
  <td>Cell 12</td>
   </tr>
 </table>
 
 
Will look like this in the browser:
Cell 1Cell 2Cell 3Cell 4
Cell 5Cell 6Cell 7Cell 8
Cell 9Cell 10Cell 11Cell 12

Are there any attributes?

Of course there are attributes. For example, the border attribute is used to specify the thickness of the border around your table:
Example 3:
 
 <table border="1">
   <tr>
  <td>Cell 1</td>
  <td>Cell 2</td>
   </tr>
   <tr>
  <td>Cell 3</td>
  <td>Cell 4</td>
   </tr>
 </table>
 
 
Will look like this in the browser:
Cell 1Cell 2
Cell 3Cell 4
The thickness of the border is specified in pixels.

As with images, you can also set the width of a table in pixels - or alternatively in percentage of the screen:
Example 4:
 
 <table border="1" width="30%">
 
 
This example will be displayed in the browser as a table with the width of 30% of the screen. Try it yourself.

More attributes?

There are lots of attributes for tables. Here are two more:
  • align: specifies the horizontal alignment of the content in the entire table, in a row or in a single cell. For example, left, center or right.
  • valign: specifies the vertical alignment of the content in a cell. For example, top, middle or bottom.
Example 5:


 
 <td align="right" valign="top">Cell 1</td>
 
 

What can I insert in my tables?

Theoretically, you can insert anything in tables: text, links and images... BUT tables are meant for presenting tabular data (i.e. data which can be meaningfully presented in columns and rows) so refrain from putting things into tables simply because you want them to be placed next to each other.
In the old days on the Internet - i.e. a few years ago - tables were often used as a layout tool. But if you want to control the presentation of texts and images there is a much cooler way to do it (hint: CSS). But more about that later.
Now, put what you just learned to practice and design a number of tables in different sizes, with different attributes and content. This should keep you busy for hours.

Attributes

You can add attributes to a number of elements.

What is an attribute?

As you probably remember, elements give structure to a HTML document and tells the browser how you want your website to be presented (for example,<br /> informs the browser to make a line break). In some elements you can add more information. Such additional information is called an attribute.
Example 1:
 
 <h2 style="background-color:#ff0000;">My friendship with HTML</h2>
 
 
Attributes are always written within a start tag and are followed by an equals sign and the attribute details written between inverted commas. The semicolon after the attribute is for separating different style commands. We will get back to that later.

What is the catch?

There are many different attributes. The first one you will learn is style. With the style attribute you can add layout to your website. For instance a background colour:
Example 2:
 
 <html>
   
   <head>
   </head>

   <body style="background-color:#ff0000;">
   </body>

 </html>
 
 
will show a completely red page in the browser - go ahead and see for yourself. We will explain in greater detail how the colour system works in a few moments.
Note that some tags and attributes use US spelling i.e. color instead of colour. It is important that you are careful to use the same spelling as we use in the examples in this tutorial - otherwise, browsers will not be able to understand your codes. Also, don't forget to always close the inverted commas (quotation marks) after an attribute.

How did the page become red?

In the above example, we asked for the background colour with the code "#ff0000". This is the colour code for red using so called hexadecimal numbers (HEX). Each colour has its own hexadecimal number. Here are some examples:
White: #ffffff
Black: #000000 (zeros)
Red: #ff0000
Blue: #0000ff
Green: #00ff00
Yellow: #ffff00
A hexadecimal colour code consists of # and six digits or letters. There are more than 1000 HEX codes and it is not easy to figure out which HEX code is tied to a specific colour.

You can also use the English name for the most common colours (white, black, red, blue, green and yellow).
Example 3:
 
 <body style="background-color: red;">
 
 
Enough about colours. Let's get back to the attributes.

Which elements can use attributes?

Different attributes can be applied to most elements.
You will often use attributes in tags such as the body tag while you will rarely use attributes in, for example, a br tag since a line break normally is a line break without any parameters to adjust.
Just as there are many different elements, so there are many different attributes. Some attributes are tailor made for one particular element while others can be used for many different element. And vice versa: some elements can only contain one kind of attribute while others can contain many.
It may sound a bit confusing but once you get acquainted with the different attributes it is actually very logical and you will soon see how easy they are to use and how many possibilities they provide.
This tutorial will introduce you to the most important attributes.

Exactly what parts does an element consist of?

Generally an elements consist of a start tag with or without one or more attributes, some content and an end tag.

More about tables

The title "More about tables" may sound a bit boring. But look at the positive side, when you master tables, there is absolutely nothing about HTML that will knock you out.

What is left then?

The two attributes colspan and rowspan are used when you want to create fancy tables.
Colspan is short for "column span". Colspan is used in the <td> tag to specify how many columns the cell should span:
Example 1:
 
 <table border="1">
   <tr>
  <td colspan="3">Cell 1</td>
   </tr>
   <tr>
  <td>Cell 2</td>
  <td>Cell 3</td>
  <td>Cell 4</td>
   </tr>
 </table>
 
 
Will look like this in the browser:
Cell 1
Cell 2Cell 3Cell 4
By setting colspan to "3", the cell in the first row spans three columns. If we instead had set colspan to "2", the cell would only have spanned two columns and it would have been necessary to insert an additional cell in the first row so that the number of columns will fit in the two rows.
Example 2:
 
 <table border="1">
   <tr>
  <td colspan="2">Cell 1</td>
  <td>Cell 2</td>
   </tr>
   <tr>
  <td>Cell 3</td>
  <td>Cell 4</td>
  <td>Cell 5</td>
   </tr>
 </table>
 
 
Will look like this in the browser:
Cell 1Cell 2
Cell 3Cell 4Cell 5

What about rowspan?

As you might already have guessed, rowspan specifies how many rows a cell should span over:
Example 3:
 
 <table border="1">
   <tr>
  <td rowspan="3">Cell 1</td>
  <td>Cell 2</td>
   </tr>
   <tr>
  <td>Cell 3</td>
   </tr>
   <tr>
  <td>Cell 4</td>
   </tr>
 </table>
 
 
Will look like this in the browser:
Cell 1Cell 2
Cell 3
Cell 4
In the example above rowspan is set to "3" in Cell 1. This specifies that the cell must span over 3 rows (its own row plus an additional two). Cell 1 and Cell 2 are thereby in the same row, while Cell 3 and Cell 4 form two independent rows.
Confused? Well, it is not uncomplicated and it is easy to lose track. Therefore, it might be a good idea to draw the table on a piece of paper before you begin with the HTML.
Not confused? Then go ahead and create a couple of tables with both colspan and rowspan on your own.