HTML
HTML
HTML
You will learn
• Languages and Tools for Web Development
• Key Concepts (URL, HTTP)
• How Websites Work (in short what happens under the hood)
• Basics of HTML and CSS
• Validating web pages
Languages and Tools for Web
Development
HTML CSS JS
HTML (Hypertext Markup
Languages)
• HTML stands for Hyper Text Markup Language
• HTML is the standard markup language for creating Web pages
• HTML describes the structure of a Web page
• HTML consists of a series of elements
• HTML elements tell the browser how to display the content
• HTML elements label pieces of content such as "this is a heading",
"this is a paragraph", "this is a link", etc.
Case Sensitivity
NO
Session – 1: Practice
HTML Attributes
It is used to add more information corresponding to an HTML tag
Example: <a href=“https://facebook.com”> Mark Zuckerberg </a>
Anchor tag attribute
<body leftmargin="200" rightmargin = "200" text = "white" bgcolor = "black">
Anchor Tag
The <a> tag defines a hyperlink, which is used to link from one page to
another.
<a href=“https://google.com”> Click here </a>
<P align= "justify"> <font size = "3" color = "red">
Web browsers receive HTML documents from a web server or from local
storage and render the documents into multimedia web pages. HTML
describes the structure of a web page semantically and originally
included cues for the appearance of the document.
</font> </p>
<p align="justify">
<p align="center">
<p align="left">
<p align="right">
<font face="Verdana, Arial, Helvetica, sans-serif"> </font>
<font color="#FF00CC"> </font>
Image Tag
The <img> tag is used to embed an image in an HTML page.
The <img> tag has two required attributes:
1. src - Specifies the path to the image
2. alt - Specifies an alternate text for the image (if image is not displayed)
This text is <sup> superscript </sup> text This text contains superscript text
Pre Tag
The <pre> tag defines preformatted text. The text will be
displayed exactly as written in the HTML source code.
<pre>
This is Written
using pre
tag
</pre>
Session 2 - Practice
<ol type="A">
<li> Phone </li>
<li> PC </li>
<li> Laptop</li>
</ol>
Tables
The <table> tag defines an HTML table. An HTML table consists of one <table>
element and one or more <tr>, <th>, and <td> elements.
1. The <tr> element defines a table row,
2. the <th> element defines a table header, and
3. the <td> element defines a table cell.
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
Colspan
The colspan attribute when used with <td> tag determines the number
of standard cells it should span.
<td colspan="2">
Rowspan
It contains a value i.e number Which specify the number of rows that a
table cell should span
<td rowspan=“2">
Cellspacing
The HTML <table> cellspacing Attribute is used to specify the space
between the cells. The cellspacing attribute is set in terms of pixels.
<table cellspacing="1“>
Cellpadding
The HTML <table> cellpadding Attribute is used to specify the space
between the cell content and cell wall. The cellpadding attribute is set
in terms of pixels.
<table cellpadding="1“>
<table width="941" height="355" border="2" cellspacing="1"
cellpadding="1" align="center">
<tr>
<th>Month</th>
<th>Savings</th>
<th>Savings for holiday!</th>
</tr>
<tr>
<td rowspan="2"> January</td>
<td>$100</td>
<td>$80</td>
</tr>
<tr>
<td>90</td>
<td>$80</td>
</tr>
</table>
Session 3 - Practice
This tutorial will teach you everything you need to know about CSS
</p>
Session – 2 (CSS)
Internal CSS
CSS Basic Syntax
Index.html stylefile.css
<head>
<link rel= “stylesheet” href= p{
“stylefile.css”> Color: yellow;
}
</head>
Session – 4 (CSS)
Internal and External CSS
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSS Tutorial</title>
<style>
Internal CSS
p{
color:rgb(245, 184, 245);
Out of Internal or
background-color: seagreen;
external, which ever will
} come at the end, that
</style> styling will be followed
l C SS
<link rel="stylesheet" href=“stylefile.css"> rna
e
</head> Ext
<body>
<h3>This is CSS Tutorial</h3>
<!-- <p style="color: red; background-color: yellow;">This tutorial will teach you HTML/CSS</p> -->
<p>This tutorial will teach you everything you need to know about HTML/CSS</p>
</body>
</html>
Session – 5 (CSS)
CSS Selectors
• CSS selectors are used to select any content you want to
style.
• CSS selectors select HTML elements according to its id, class,
attribute, etc.
• Selectors make it easy for us to easily target single/multiple
HTML elements in the markup.
• Four types of CSS Selectors:
• CSS element Selector
• CSS id Selector
• CSS class Selector
• The CSS grouping Selector
Element Selector
<!DOCTYPE html>
<html lang="en">
<head>
<title> CSS selectors </title>
<style>
p{
color: red;}
</style>
</head>
<body>
<h3> CSS selectors </h3>
<p>This tutorial will teach you everything you need to know about HTML/CSS</p>
</body>
</html>
ID Selector
<!DOCTYPE html>
<html lang="en">
<head>
<title> CSS selectors </title>
<style> ID is unique ie. Can be
#option{
color: red;} used in only one tag
</style> like: website logo
</head>
External CSS
• The <link> element can be used to include an external stylesheet file
in your HTML document.
• An external style sheet is a separate text file with .css extension. You
define all the Style rules within this text file and then you can include
this file in any HTML document using <link> element.
<head>
<link rel="stylesheet" href="mycss.css">
</head>
Example:
• Consider a simple style sheet file with a name mystyle.css having the
following rules:
h1, h2, h3 { color: blue;
text-transform: lowercase; }
<head>
<link rel="stylesheet" href="mycss.css">
</head>
ID vs. Class CSS: Which Should You
Use?
You should use a class if you need to
use the same selector more than once
within a page or a site. While an ID is
specific to a single element, classes
can be assigned to multiple elements
on a page or throughout the website.
They are not unique.
CSS Comments
• CSS comments are the same as what you must have learnt in any
technical language. It is written to explain the code and is helpful for
the users who read that code so that they can understand it easily.
• Comments are ignored by browsers, and the syntax to write them is:
/* Your comment */
The CSS Box Model
Every element composed of:
• content
• a border around the element
• padding between the content and the border
• a margin between the border and other content