Introduction of HTML-2

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

Introduction of html

Explain with Tags


HTML is the standard markup language for creating
Web pages.
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.
A Simple HTML Document

Example

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>
Example Explained

•The <!DOCTYPE html> declaration defines that this document is an HTML5


document
• The <html> element is the root element of an HTML page
• The <head> element contains meta information about the HTML page
• The <title> element specifies a title for the HTML page (which is shown in the
browser's title bar or in the page's tab)
• The <body> element defines the document's body, and is a container for all the
visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists,
etc.
• The <h1> element defines a large heading
• The <p> element defines a paragraph

Web Browsers
The purpose of a web browser (Chrome, Edge, Firefox, Safari)
is to read HTML documents and display them correctly.

A browser does not display the HTML tags, but uses them to
determine how to display the document:
A table in HTML consists of table cells inside rows
and columns.
Example:

A simple HTML table:


<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr></table>
<table>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
Try it Yourself »
CSS is the language we use to style a Web page.

What is CSS?
•CSS stands for Cascading Style Sheets
•CSS describes how HTML elements are to be displayed on
screen, paper, or in other media
•CSS saves a lot of work. It can control the layout of multiple
web pages all at once
•External style sheets are stored in CSS files
Why Use CSS?

CSS is used to define styles for your web pages,


including the design, layout and variations in
display for different devices and screen sizes.

CSS Example
body {
background-color: lightblue;
}

h1 {
color: white;
text-align: center;
}

p{
font-family: verdana;
font-size: 20px;
}
CSS Syntax

A CSS rule consists of a selector and a declaration block


The selector points to the HTML element you want to
style.
The declaration block contains one or more declarations
separated by semicolons.
Each declaration includes a CSS property name and a
value, separated by a colon.
Multiple CSS declarations are separated with semicolons,
and declaration blocks are surrounded by curly braces.
Example
<!DOCTYPE html>
<html>
<head>
<style>
p{
color: red;
text-align: center;
}
</style>
</head>
<body>

<p>Hello World!</p>
<p>These paragraphs are styled with CSS.</p>

</body>
</html>

OUTPUT:- Hello World!


These paragraphs are styled with CSS.
Example Explained
•p is a selector in CSS (it points to the HTML element you
want to style: <p>).
•color is a property, and red is the property value
•text-align is a property, and center is the property
value
An HTML form is used to collect user input. The
user input is most often sent to a server for
processing.
he <form> Element
The HTML
<form> element is used to create an HTML form
for user input:
</form>
<!DOCTYPE html>
<html>
<body>

<h2>HTML Forms</h2>

<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"
value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname"
value="Doe"><br><br>
<input type="submit" value="Submit">
</form>

<p>If you click the "Submit" button, the form-


data will be sent to a page called
"/action_page.php".</p>

</body>
</html>

You might also like