What is Markup Language?
A Markup language provides a way to describe the structure of a web page. Specifying how text or graphics are displayed on the web page.
Types of web pages:-
Static:- The static web pages are delivered to the users exactly as these are stored.
Dynamic:- In dynamic web pages the content is rendered at the time of request.
HTML Page Contains following structural Tags:-
- <!Doctype Html>
<!Doctype Html>:- Provides an instruction to the browser about the version of the HTML.
<HTML>:- Specifies to the browser that a document is an HTML document.
<Head>:- Used to describe the header of the HTML document.
<Body>:- The <Body> tag sets the boundary for the content in HTML document.
-------Global settings using tags used within head section--------
Contains the main content of the web page
Exploring the Head Tag:-
Title:- Title tag defines the title of the document that appears in the title bar of the browser window.
<title> Write the title here</title>
Meta:- The <Meta> tag provides the additional information about the current document in the form of name and value pairs, such as the expiry date, author name and list of keywords.
<Meta name=”description” content = “HTML Content”>
<Meta name =”Keywords” content = “ Rahul, Sharma’s, Personal, Blog”>
<Meta name = “author” content = “Rahul Sharma”>
- Author:- Specifies the name of the author who has created the document.
- Description:- Specifies a short summary of the content of the web page.
- Keywords:- Specifies the keywords used in the web page.
<Base>:- The Base tag specifies a base URL or address of the related links on a page.
<Base href = “D:/images”> /* Absolute path of the folder that contains all the image*/
<img src = “imagename.jpg”> /* Just specify the name of the image with their extension*/
<Style>:- The style tag defines the style information associated with the HTML document.
<style type = “text/css”>
------Write CSS Code here----
<Link>:- The Link tag is used to establish the relationship of the current document with other documents in a website.
<Noscript>:- Noscript tag displays an alternate content on the browsers on which the script have been disabled or on the browser that do not support the client side scripting.
Alert(“Welcome to Rahul Sharma’s Blog”);
Your browser does not support scripts.
Exploring the Body Tag:-
<H1> To <H6>. <h1> being the biggest and <h6> being the smallest.
<h1>Heading Tag Demo</h1>
<h2>Heading Tag Demo</h2>
<h3>Heading Tag Demo</h3>
<h4>Heading Tag Demo</h4>
<h5>Heading Tag Demo</h5>
<h6>Heading Tag Demo</h6>
The <p> tag adds a new paragraph in the HTML document. It specifies that there is a break in the content to begin a new paragraph.
The details tag specifies the additional content that a user can view and hide as per the requirement.
Summary tag specifies a heading for the details tag.
<p>Welcome to Rahul Sharma's Blog</p>
The <div> tag is used to define a section in a document.
The <span> tag enables you to group and apply styles to inline elements.
<p>This is the<span style="color:red;"> demo</span> of div tag</p>
Formatting a web page:-
The <B> tag is used to make the text boldface.
The <I> tag is used to italicize the text.
The <u> tag is used to underline the text.
The <LI> tag is used to create list.
Types of lists used in HTML:-
- Ordered numbered list
- Unordered or bulleted list
- Definition list
An ordered list represents a set of items in a sequence or an order. The tag for the ordered list is <OL>.
An unordered list represents a set of related items that do not need to follow a specific order. The tag used for unordered list is <UL> tag.
A definition list is used when one or more terms and their definitions are to be included in an HTML document. The definition list is represented by the <DL> tag. It contains two other tags <DT> and <DD>.
<DT>:- Stands for Data Term.
<DD>:- stands for Data Definition.
The <br> tag is used to insert a single line break.
The <HR> tag adds a horizontal rule in a web page. A rule is a straight line. The <HR> tag is an empty tag.
<p>Welcome to Rahul Sharma's Blog</p>
<p><b><i><u>This is the formatting of a web page</u></i></b></p>
<DD>Hyper Text Markup Language</DD>
Types of TAG:-
Paired Tag:- Needs to be closed.
For e.g:- <HTML></HTML>, <P></p> etc.
Empty Tag:- No need to be closed.
For e.g:- <HR>
Inserting Image :-
<img src=”path of the image here” height=”200” width=”300” alt=”alternate text for image”>
The alt attribute is used to specify an alternate text for an image. This text is displayed if the image cannot be displayed on the browser.
Adding Navigation Links:-
<a href=”name of the html page you want to navigate”> Text to display the user here</a>
The href attribute specifies the url of the documents that opens on clicking the Hyperlink.
Adding Multimedia Components:-
<Audio>:- Used to add an audio file on web page.
<Audio src=”path of the audio file” autoplay=”autoplay” controls=”controls” loop=”loop”></audio>
<Video>:- Used to add video file on web page.
<video src=”Path of the video file” autoplay=”autoplay” controls=”controls” loop=”loop” height=”300” width=”400”></video>
Measuring Data and
Displaying Progress Bar:-
The <Meter> tag specifies a scalar measurement within a known range. It is also known as gauge. It can be used to display disk usage.
<Meter value=”4” min=”0” max=”10”></Meter>
The <Progress> tag is used to display a progress of a task.
Max:-Specifies the amount of work a task requires.
Value:-Specifies the amount of task that has been completed.
<Progress value=”12” max=”100”></Progress>
Identifying Semantic Tags:-
Consider a situation where you need to group related headings and sub titles together.
<h1>Book Your Hotel</h1>
<h2>Rating of the hotels</h2>
The <ARTICLE> tag defines an independent or a self contained content. It is mostly used to specify independent entry for a blog or a magazines.
The <Aside> tag specifies the content other than the main tag, such as a note or a tip. However, it should related to the main content.
The <Header> tag is used to group introductory headings or navigational links. You can use multiple <Header> tags in your documents.
The <Footer> tag is used to represent footer for a web page or a section of a web page.
The <nav> tag enables you to group links created by using the <A> tag in such a way that looks more semantic and structured. All the major navigational links are generally grouped inside the <nav> tag.
The <Figure> tag is used to specify the self-contained content, such as images, Diagrams, Photos and code and associated caption with it.
Working with Tables and Frames
Tables are used for structuring and displaying complex information in a structured format on a web page. Tables are used in web pages to enhance the readability by presenting information in a structured way.
The table is divided into the following logical sections:-
Specifying Table Body:-
The table body contains data arranged in rows. Each row further comprises one or multiple columns. The rows of the body of a table can be grouped by using the <TBody> Tag. You can use more than one <TBODY> tag inside the table.
For adding rows to a table, the <TR> tag is used. The contents of a row are placed between the <tr> and </tr> container tags.
For adding columns to a row, the <td> tag is used. The <td> tag specifies the content of the columns. The content is enclosed within the <td> and </td> container tags.
Combining Multiple rows and columns into a single cell
Creating Heading for the table column:-
To create the headings for the table column you can use the <th> tag. The <th> tag displays the heading in bold and is centrally aligned.
Specifying Table Footer:-
Specifying the Table Caption:-
To create a Form on the web page you need to use <Form> Tag. The <Form> tag helps you define a form. It has an opening <Form> tag and closing </Form> tag.
The Form tag supports the following attributes:-
The name attribute is used to specify a unique name for a form. It is used to uniquely identify a form in the get and post methods at the time of form submission.
The Id attribute is used to specify a unique Id for a form element on a web page. The Id attribute should be unique in the entire HTML document.
The action attribute specifies the URL of the page to which the contents of the form are submitted. If this attribute is missing, the URL of the document itself is assumed as the location for the form submission.
The method attribute is used to specify the format in which the data will be submitted to file or the URL specified in the action attribute.
It can take either of the following values:-
The get value appends the form data to the URL of the form as the name value pair at the time of form submission. Since the data is appended to the URL, it is always visible to the users. The size of data that can be submitted using the get method is limited to only 3000 characters.
The post value does not append the form data to the URL of the form when it is submitted. Therefore the data is not shown in the URL and offers a secure way of submitting the data. Also, a large amount of data can be sent using the post method.
The autocomplete attribute is used to specify whether a form should have the autocomplete feature on or off. If it is on, the browser automatically completes the values in the fields based on the values that the user has entered before.
The novalidate attribute specifies that the data in the form should not be validated by the browser at the time of data submission. It is an empty attribute that does not contain any value.
The target attribute is used to specify the name of the frame or the window in which the response obtained after submitting the form needs to be displayed.
The target attribute can have one of the following values:-
Specifies that the response should be displayed in a new frame or window.
Specifies that the response should be displayed in the same frame.
Specifies that the response should be displayed in the parent frame or window.
Specifies that the response should be displayed in the full body of the window.
Specifies that the response should be displayed in the specified frame.
Exploring Form Elements:-
The <input> tag is used to create input fields inside a form. These fields are used to accept input from users. Input fields are of various types, such as textbox, radio button or check box. The <input> tag has some important attributes such as type, value, name , ID, autocomplete, autofocus, form, required, pattern, placeholder.
Defining the type attribute:-
The type attribute has the following values:-
create a single line editable text field. When the value of type attribute is text, two additional attributes size and maxlength can also be specified.
<input type=”text” name”fname” size=”20” maxlength=”20”>
Creates a password field, which will not display the characters being typed by the user.
Creates a radio button, which lets the user select one of the options from a set of given options.
When the value of the type attribute is radio, an additional attribute checked ca also be specified. The checked attribute is used to specify that the radio button appears pre-selected when the page loads.
create a check box which lets the user select one or more options from a set of given options.
Creates a submit button, which submits the form data to the location specified in the action attribute of the form. When the value of type attribute is submit some additional attributes , such as formaction, formmethod, formtarget and formnovalidate can also be specified.
It is used to specify a URL where the form data would be submitted when the submit button is clicked. The URL specified in the formaction attribute of the submit button overrides the URL specified in the action attribute of the <Form> tag.
It is used to specify the method, such as get and post, using which the form data will be sent to the file or URL specified in the action attribute of the form. The value specified for the formmethod attribute of the submit button overrides the value of the method attribute of the <Form> tag.
It is used to specify the name of the frame or the window in which the response would be displayed when the form is submitted.
Every form is validated by default, unless you use the novalidate attribute with the <Form> tag.
Creates a reset button, which clears the values entered by a user in the form field.
Adds a field that is used to enter the url of a website. The value in this field is automatically validated for correctness when the form is submitted.
Creates a field in an HTML form to accept the email address from the users.
Creates a slider control to enter a numeric value within a range. The default range of the slider is 0 to 100. When the value of the type attribute is range, additional attributes such as min,max,value and step can also be specified. Min for minimum value, Max for maximum value, value attributes for current value within the range field.
<input type=”range” max=”50” min=”10” step=”5” value=”10”>
Is used to define a date field in an HTML form. It allows a user to select a date.
Is used to define a time field in an HTML form. It allows a user to select time.
Is used to create an input field for entering a numeric value.
Is used to accept a telephone number from the user.
is used to specify an image to be used as a submit button. When the value of a type attribute as image, some additional attributes such as height, width, alt and src can also be specified.
Height and width:- Specify the height and width for the image.
Alt:- use to display an alternative text if image not displayed.
Src:- Specify the URL or address of the image.
Some attributes list:-
The select tag is a container tag. It creates a drop down list on the form. It has the following
Multiple:- Is used to allows the user to select more than one value from the drop down list by using the ctrl key.
Name:- Is used to specify the name of the selection list that will be used at the time of submitting the form.
Size:- Is used to specify the number of visible items in the drop down list.
Autofocus:- Is used to ensure the focus is on the drop down list when the page loads.
Form:- Is used to specify the name of one or more forms to which the <select> tag belongs.
Defining the <Option> tag:-
It is always used within the <select> tag and cannot be used as a standalone tag. It is used to create a list of options in the drop down list and has the following attributes:-
Selected:- Is used to indicate that a particular option comes pre-selected when the page loads in the browser.
Value:- Is used to indicate the value of the option to be sent on the form submission when that option is selected by the user.
Disabled:- Is used to indicate that an option should be disabled when the page loads.
Defining <OPTGROUP> tag:-
The <OPTGROUP> tag is used to group the related options in one group. It is generally used when you have a long list of options and you want to group the related options in one to make it simpler.
Disabled:- Is used to indicate that an option group should be shown disabled when the page loads.
Label:- Is used to specify a label for the option group .
The <label> tag is used to define a table for the input fields. You can also define a label for the output tag.
For:- Is used to bind the <label> tag with the input field and should have the same value as the ID attribute of the input field.
From:- Is used to specify the name of one or more forms to which the <label> tag belongs.
The <FIELDSET> tag is used to combine and group related fields in a form. It creates a box around the selected field. You can also define the description for the fieldset by using the <Legend> tag. The <legend> tag is used to define the caption for the fieldset tag.
Disabled:- The disabled attribute is used to indicate that a group of fields should be shown disabled when the page loads.
Form:- The form attribute is used to specify the name of one or more forms to which the <fieldset> tag belongs.
Name:- The name attribute is used to specify the name for the fieldset.
The <textarea> tag creates a field in which user can enter a large amount of text.
Rows:-The rows attribute helps to set the number of rows of text that will be visible without scrolling up or down in the field.
Cols:- The cols attribute helps to set the number of columns of text that will be visible without scrolling right or left in the field.
The <DATALIST> tag is used to create a list of pre-defined options for an input field. It is used to provide an autocomplete feature on input fields so that the user can view the drop down list of pre- defined options whenever they input data.
The <KEYGEN> tag is used to specify a key pair generated field in a form. Whenever the form is submitted, the private and public keys are generated, where the private key is stored locally, and public key is sent to the server. As a public key is stored in the server it can be used to authenticate a user in the future.
Autofocus:- Is used to specify that the <KEYGEN> tag automatically gets the focus when a web page loads.
Disabled:- Is used to indicate that a <KEYGEN> tag should be shown disabled when page loads.
Name:- Used to specify a name for the <KEYGEN> tag.
Keytype:- Is used to specify the security algorithm of the key. It accepts the name of the various security algorithms, such as rsa, dsa, andec as its value.
Form:- Is used to specify the name of one or more forms to which the <KEYGEN> tag belongs.
The <OUTPUT> tag is used to represent the result of a calculation.
For:- Is used to specify the relationship between the input fields used and result generated for the calculation.
Form:- Is used to specify the name of one or more forms to which the <OUTPUT> tag belongs.
Name:- Is used to specify the name for the <OUTPUT> tag.
The <Button> tag is used to create a button. However unlike, input type submit you can specify text or an image within the button by using the <p> or <img> tags.
- Type:- values are button, submit and reset.