HTML Introduction
HTML Introduction
HTML Introduction
HTML Syntax
<!DOCTYPE HTML>
<html>
<head>
<title>Your title goes here</title>
</head>
<body>
Your content goes here
</body>
</html>
1. <br> br stands for break line, it breaks the line of the code. It is
useful for writing a poem or an address, where the division of
lines is significant.
2. <pre> tag represents preformatted text. Whitespace inside this
element is displayed as typed.
3. <code> tag is used for indicating a piece of code. The code
tag surrounds the code being marked up.The code being
marked up could represent an XML element name, a filename,
a computer program, or any other string that a computer
would recognize.
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<pre>
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks
</pre>
HTML Headings
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
</body>
</html>
HTML Paragraphs
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>
HTML Formatting
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<b>This text is bold</b>
<strong>This text is strong</strong>
<i>This text is italic</i>
<em>This text is emphasized</em>
<h2>HTML <small>Small</small> Formatting</h2>
<h2>HTML <mark>Marked</mark> Formatting</h2>
<p>My favorite color is <del>blue</del> red.</p>
HTML Comments
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
Hello Welcome To HTML Tutorials
<!-- Write your comments here -->
<!-- Programming Tutorials In Telugu -->
</body>
</html>
HTML Background
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
HTML Images
1. You can insert any image in your web page by using <img>
tag.
2. The simple syntax to use this tag is <img src="Image URL" ...
attributes-list/>
3. The src attribute is used to give the address of the image with
extension.
4. The alt attribute is a mandatory attribute which specifies an
alternate text for an image, if the image cannot be displayed.
5. You can set image width and height based on your
requirement using&n width and height attributes.
6. By default image will have a border around it, you can specify
border thickness in terms of pixels/value using border
attribute. A thickness of 0 means, no border around the
picture.
7. By default image will align at the left side of the page, but you
can use align attribute to set it in the center or right.
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<img src="html.png" alt="HTML5" height="200" width="250">
<img src="css3.png" alt="css3" height="200" width="250">
</body>
</html>
HTML Tables
1. The HTML tables allow to arrange data like text, images, links,
other tables, etc. into rows and columns of cells.
2. The HTML tables are created using the <table> tag in which
the <tr> tag is used to create table rows and <td>tag is used
to create data cells.
3. Here border is an attribute of <table> tag and it is used to put
a border across all the cells. If you do not need a border then
you can use border="0".You can also set border color also
using bordercolor attribute.
4. Table heading can be defined using <th> tag. This tag will be
put to replace <td> tag, which is used to represent actual data
cell.
5. There are two attribiutes called cellpadding and cellspacing
which you will use to adjust the white space in your table cells.
6. cellpadding represents the distance between cell borders and
the content within a cell.
7. The cellspacing attribute defines the width of the border.
8. You will use colspan attribute if you want to merge two or
more columns into a single column. Similar way you will use
rowspan if you want to merge two or more rows.
9. bgcolor attribute is used to set background color for whole
table or just for one cell.
10. background attribute is used to set background image for
whole table or just for one cell.
11. You can set a table width and height using width and
height attrubutes.
12. The caption tag will serve as a title or explanation for the
table and it shows up at the top of the table.
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<table border="2" cellpadding="3" cellspacing="3"
bgcolor="aqua">
<tr>
<th colspan="3" bgcolor="red">Programming Tutorials</th>
</tr>
<tr>
<td bgcolor="white">HTML</td>
<td rowspan="4" bgcolor="orange">In Telugu</td>
<td bgcolor="white">CSS</td>
</tr>
<tr>
<td bgcolor="pink">SQL</td>
<td bgcolor="pink">Java</td>
</tr>
<tr>
<td bgcolor="lightgreen">JavaScript</td>
<td bgcolor="lightgreen">Python</td>
</tr>
<tr>
<td bgcolor="yellow">PHP</td>
<td bgcolor="yellow">go</td>
</tr>
</table>
</body>
</html>
HTML Lists
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<h2>An Unordered HTML List</h2>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul<
<h2>An Ordered HTML List</h2>
<ol>
<li>SQL</li>
<li>Java</li>
<li>Python</li>
</ol>
<h2>HTML Description Lists</h2>
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<ul type="square">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul<
<ul type="circle">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<ol type="a">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol<
<ol type="i">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
HTML Links
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
If you want to goto google
<a href="http://www.google.com" target="_blank">Click Here</a>
</body>
</html>
HTML Fonts
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<font size="3" color="red">This is some text!</font> <br>
<font size="7" color="blue">This is some text!</font> <br>
<font face="verdana" color="green">This is some text!</font><br>
</body>
</html>
HTML Forms
1. HTML Forms are required when you want to collect some data
from the site visitor.For example during user registration you
would like to collect information such as name, email address,
credit card, etc.
2. There are various form elements available like text fields,
textarea fields, drop-down menus, radio buttons, checkboxes,
etc.
3. The HTML <form> tag is used to create an HTML form.
4. Apart from common attributes, following is a list of the most
frequently used form attributes:
action Backend script ready to process your passed data.
method Method to be used to upload data. The most
frequently used are GET and POST methods.
target Specify the target window or frame where the result of
the script will be displayed. It takes values like _blank, _self,
_parent etc.
5. There are different types of form controls that you can use to
collect data using HTML form:
Those are:
Single-line text input controls <input type="text"
name="name"/>
Password input controls <input type="password"
name="pwd" />
Email input controls <input type="email" name="email" />
Number input controls <input type="number"
name="number" />
Date input controls <input type="date" name="date" />
Multi-line input controls <textarea rows="5" cols="50"
name="description"/>
Checkbox controls <input type="checkbox" name="m1" />
Radio Button controls <input type="radio" name="male" />
Select Box controls <select name="select" ><option
value="Maths">Maths</option>
File upload box <input type="file" name="fileupload"
accept="image/*" />
Button controls <input type="submit" name="submit"
value="Submit" />
<input type="reset" name="reset" value="Reset" />
<input type="button" name="ok" value="OK" />
<input type="image" name="imagebutton"
src="/html/images/logo.png" />
<input type="color" name="color" />
search <input type="search" name="search" />
url <input type="url" name="url" />
6. Some attributes of form controls size, maxlength, checked,
multiple, placeholder, value, pattern
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<form action="html.html" method="get" target="_self">
Name: <input type="text" name="fname"><br><br>
Password: <input type="password" name="pwd">br><br>
Email: <input type="email" name="email">
Phone Number:<input type="number" name="number">
DOB:<input type="date" name="date">
Address:<textarea rows="5" cols="50" name="description">
</textarea>
Hobbies:<input type="checkbox" name="m1">
Gender:<input type="radio" name="male">
Branch:<select name="select" ><option
value="cse">CSE</option>
Photo:<input type="file" name="fileupload" accept="image/*">
Search:<input type="search" name="search">
url: <input type="url" name="url">
<input type="submit" value="Submit">
<input type="reset" name="reset" value="Reset">
<input type="button" name="ok" value="OK">
<input type="color" name="color">
</form>
</body>
</html>
HTML Marquee
<body>
<marquee>This is basic example of marquee</marquee>
<marquee direction = "right">The direction of text
will be from left to right.</marquee>
<marquee scrolldelay="10">Using Scroll Delay</marquee>
<marquee scrollamount="2">Using Scroll Amount</marquee>
<marquee bgcolor="yellow">Using Background Color</marquee>
</body>
</html>
HTML Audio
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<audio controls autoplay loop>
<source src="audio.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
</body>
</html>
HTML Video
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<video width="300" height="200" controls autoplay loop>
<source src="video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>
HTML 5
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<nav>
<a href="/html.html">HTML</a> |
<a href="/css.html">CSS</a> |
<a href="/js/">JavaScript</a> |
<a href="/jquery/">jQuery</a>
</nav>
<br><br>
<progress value="35" max="100">
</body>
</html>
HTML Canvas
Creating Canvas
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<canvas id="myCanvas" width="300"
height="200" style="border:1px solid red;">
</canvas>
</body>
</html>
Drawing Lines
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<canvas id="myCanvas" width="300"
height="200" style="border:1px solid red;">
</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.moveTo(0,0);
ctx.lineTo(200,100);
ctx.stroke();
</script>
</body>
</html>
Drawing Circles
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<canvas id="myCanvas" width="300"
height="200" style="border:1px solid red;">
</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.arc(95,50,40,0,2*Math.PI);
ctx.stroke();
</script>
</body>
</html>
Adding Text
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<canvas id="myCanvas" width="300"
height="200" style="border:1px solid red;">
</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.font = "23px Arial";
ctx.fillText("Programming Tutorials",10,50);
ctx.strokeText("In Telugu",170,100);
</script>
</body>
</html>
Linear Gradient
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<canvas id="myCanvas" width="300"
height="200" style="border:1px solid red;">
</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var grd = ctx.createLinearGradient(0,0,200,0);
grd.addColorStop(0,"green");
grd.addColorStop(1,"white");
ctx.fillStyle = grd;
ctx.fillRect(10,10,150,80);
</script>
</body>
</html>
Radial Gradient
<!DOCTYPE HTML>
<html>
<head>
<title>Programming Tutorials In Telugu</title>
</head>
<body>
<canvas id="myCanvas" width="300"
height="200" style="border:1px solid red;">
</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var grd = ctx.createRadialGradient(75,50,5,90,60,100);
grd.addColorStop(0,"red");
grd.addColorStop(1,"aqua");
ctx.fillStyle = grd;
ctx.fillRect(10,10,150,80);
</script>
</body>
</html>