Category: HTML

How to add image in page title

If you want to show an icon image in title, then use the following code in <head></head> tags <link rel="shortcut icon" href="your_image_path_and_name.ico" /> If you want to show “png” image in title, then use the following code in <head></head> tags <link rel="shortcut icon" href="/favicon.png" type="image/png">

Difference between form method get and post

When we define a form in HTML, we can set “method” property of form to be either “get” or “post”. When the form property is set as “get”, the form data is set as name/value pairs and is shown in URL. For example: <html> <body> <form id="frm" name="frm" action="target.php" method="get">   First name: <input id="fname"

meta tags in html

HTML allows several meta tags that appear between <head></head> tags. Meta tags serve various purposes. The contain a metadata (information about information) about the web page. The crawlers from search engines visit and collect information provided in meta tags and put in the search engine’s database. Meta tags can also be used set expiry time

iframe tag

<iframe></iframe> tag is very useful when we want to display content from other web page in our page. <iframe> tag allows scrolling, so in this way, the data from other page can be fit in a small window. Suppose we have an html file containing a large sized table data.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML

How to embed google map in html

Sometimes it is required to embed a google map in our application to inform people about exact location of some place. Using the following steps, we can embed a google map in our application. Step 1: Open maps.google.com Step 2: Zoom in to the location that you want to embed, right click. A context menu

Presenting text using <span> tag

<span></span> tags are very useful for styling the text. The span tag can present the text as per the css class provided to the span tag. For example: <span class=”bigbox”>This is text </span>. The other way is to use embedded styles in span tag, e.g., <span style="color:blue; font-size:14px">This is text</span> Or we can just put

Creating HTML blocks using DIV tag

<div></div> tag is a powerful element in HTML. It helps in organizing HTML code in different blocks. We can hide/unhide blocks using javascript or php. We can also overwrite the contents of <div> tag using javascript by setting innerHTML property of div. div tags are also useful for setting the layout of html document. We

Creating sub options in a html dropdown <select>

Sometimes it is good to create sub options of an HTML drop down list <select></select> For that purpose, <optgroup></optgroup> tags are used. Here is an example: <form id="form2" name="form2" method="post" action=""> <select id="ddlcountries" name="ddlcountries"> <option>--Select City--</option> <optgroup label="America"> <option>United States</option> <option>Brazil</option> <option>Bostwana</option> </optgroup> <optgroup label="Asia"> <option>Pakistan</option> <option>Afghanistan</option> <option>China</option> </optgroup> <optgroup label="Africa"> <option>South Africa</option> <option>Sudan</option> <option>Ethopia</option>

HTML5 based Form Validation

HTML5 provides a builtin way of form validation by setting the type properties of the form elements. In the following code, 4 fields are validated using HTML5 based validation: <form id="form1" name="form1" method="post" action=""> <table border="1"> <tr> <td>Select Date</td> <td> <input id="txtdate" name="txtdate" type="date" /> </td> </tr> <tr> <td>Select Date Time</td> <td> <input id="txtdatetime" name="txtdatetime"