Category Archives: html

HTML Image Links

An Image can be linked to another URL by just wrapping a hyperlink around the image. It makes your images “clickable” so that when a user clicks the image, it opens another URL.

Example:

Output:
W3school.in

HTML Text Links

HTML Text Links are formally know as hyperlinks or link. Link allows visitors to navigate the website from one page to another page.

A link is created using <a href=””> tag known as anchor tag and value of href attribute is the URL or PATH where the link is pointing to.

Syntax:

Anchor Attributes

Hypertext references ( href )

This attribute specifies the target url for the linked element. A target can be absolute, relative or root relative URLs.

  • Absolute URLs – It refers the full path for the target location. Example – http://www.w3adda.com
  • Relative URLs- It refers the target location’s path relative to current location. Example – if we are at http://www.w3adda.com/ and want to navigate to http://www.w3adda.com/php then we just specify it by “/php”.
  • Root Relative URLs- It refers path relative to the domain’s root.

It specifies where to open the selected link.

  • _blank – It opens new page in new window to display the target location.
  • _self – It opens new page in the current window to display the target location.
  • _parent – It opens new page into a parent frame.
  • _top – It opens new page into the current browser window, cancelling all frames.

Base href

It is not always required you to complete URL for every link but we can specify a default URL for all links on the page.This can be achieved by putting base tag in the HTML document’s <head> section.

Example:

 

HTML Images

Images plays a very important role in presenting the information.We can also embed the images into the HTML Document, this can be accomplished using <img> tag.

Syntax:

Image Tag Attributes

Attribute Value
width This optional attribute specifies the width of the image element.
height This optional attribute specifies the height of the image element.
border This attribute specifies the border around the image.
src This attribute specifies the path to the image. It can be either an absolute path, or a relative path, it is required attribute
alt This attribute specifies the alternative text to be displayed when the browser can’t find or render the image.
align This attribute specifies the horizontal alignment of the image. Example -left, right or center.

Example:

Output:
W3school.in

HTML Marquees

HTML Marquee used to set a scrolling (vertically or horizontally) text or image. Using <marquee> tag we can set text/images scroll from right to left, left to right, top to bottom, or bottom to top.

Syntax:

Marquee Tag Attributes:

Attribute Value
direction This attribute specifies the direction of scroll. Example – up, down, left or right.
behavior This attribute specifies the type of scrolling. Example- scroll, slid and alternate.
scrolldelay This attribute specifies the interval between each jump.
scrollamount This attribute specifies the amount of jump.
loop This attribute specifies the number of time text/image will scroll.

Examples:

Output:

Your scrolling text

HTML Fonts

HTML <font></font> tags is used to specify the size, color, and face of the text presented on the HTML Document.

Note:- The font tags is deprecated and removed in HTML5.

Here is list of basic attributes for <font></font> tag –

Attribute Value Description
color #RRGGBB or #RGB

rgb(rrr%,ggg%,bbb%) or rgb(rrr,ggg,bbb)

colorname

This attribute specifies the color of text
face ont_family This attribute specifies the font of text
size Number This attribute specifies the size of text

Example:

Output:
This is example text

HTML Formatting

HTML Formatting Tags enable us to organize the HTML Element in manner that enhance the readability of the webpage. Formatting tags allows us to define the proper format or structure for the information to be presented on the webpage. A well organized information is combination of heading, paragraph, listing element, space, line breaks etc.

Headings

HTML Heading tags are used to add heading element in a webpage, there are six level available for heading elements.

Example –

output:

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Paragraph

Paragraph can be created using <p></p> tag on webpage.

Example:

Output:

Here is a first paragraph of text.

Preserved Formatting

Sometimes we need a paragraph or text to keep its formatting as it is, this can be achieved using <pre> tag.

Example:

Output:

Centering Text

Text on a webpage can be aligned center using <center> tag.

Example:

Output:

 

 

 

This paragraph is aligned center.
 

 

 

Line Break

Line break (<BR>) tag is used to insert a break of one line in text or paragraph.

Example –

Output:

We are going to insert
line break.

Horizontal Rule

We can add a Horizontal Rule in webpage using <hr> tag.

Example:

Output:
We are going to insert horizontal rule…


…that was a horizontal rule.

Unordered List

Some times we need to represent the text in the form of list of items. An unordered list items can be created using <ul> tag.

Example:

Output:

  • Item 1
  • Item 2

Ordered List

A numbered list of items can be created using <ol> tag.

Example:

Output:

  1. Item 1
  2. Item 2

Some Basic Text Formatting

Example:

Output:

An example of Bold Text

An example of Emphasized Text

An example of Strong Text

An example of Italic Text

An example of superscripted Text

An example of subscripted Text

An example of struckthrough Text

An example of Computer Code Text

HTML Attributes

HTML Elements can have an optional list of modifiers added to the tag. This modifiers are known as HTML attributes, they defines the characteristics of the HTML Elements on which they are applied.

Whenever HTML Elements is rendered by browser, the attributes gives the more information about the appearance and the behavior the HTML Elements.

Attributes made of a name and a value pair separated by the equals (=) sign.

Syntax:

List of some of the Basic Attribute –

Attribute Attribute Values Description
align right, left, center This attribute specifie the horizontal alignment of an HTML element.
valign top, middle, bottom This attribute specifie the vertical alignment of an HTML element.
bgcolor numeric, hexidecimal, RGB values This attribute specifie background color for an HTML Element
background URL This attribute specifie background image for an HTML Element
id User Defined This attribute used to specify the unique identifier for the HTML Element.
class User Defined This attribute specifies the CSS Class for the HTML Elemetns.
width Numeric Value This attribute specifies the width of HTML Elemetns like tables, images, or table cells.
height Numeric Value This attribute specifies the height of HTML Elemetns like tables, images, or table cells.
title User Defined This attribute specifies title of HTML Elements.

HTML Meta Tags

Meta Tag is a singular HTML Tag placed inside the head section, used to provide information about the document such as the author, keywords or relationships to other documents, all this details is represented using <META> tag’s attribute. All the meta information provided in this section is used by search engines to find and rank the page.

Basic Meta Tags Examples –

Keywords META

This meta tag is used to set the keywords for the web page. Used to by search engines to find the most relevant search item.

Description META

This meta tag is used to provide the description of the web page, giving an appropriate description of the page helps better search engine indexing for relevant search item.

Author META

This META Tag helps to specify the author name for a web page.

Refreshing page using META Tag

HTML document can be set to refresh after a defined set of interval using META Tag.

Redirecting page using META Tag

HTML document can also be redirected to another web page using META Tag, we can also set interval for the redirection action.

 

HTML Basic Tags

Let’s take a look at the basic HTML Page Structure –

As we can see a basic web page can be created with the following tags –

Tag Description
<html>…</html> All HTML documents should begin with <HTML> and end with </HTML> tags. The <HTML> element indicates to the browser that this is an HTML document.
<head>…</head> This section provides the information about the document, such as the title, author, keywords or relationships to other documents, all this details is placed inside <HEAD>…</HEAD> element.The beginning of the head section is marked by the <HEAD> tag, and the end of the head section with the </HEAD> tag.Elements that go in the head part are advanced stuff used by search engines.
<head>…</head> This section provides the information about the document, such as the title, author, keywords or relationships to other documents, all this details is placed inside <HEAD>…</HEAD> element.The beginning of the head section is marked by the <HEAD> tag, and the end of the head section with the </HEAD> tag.Elements that go in the head part are advanced stuff used by search engines.
<title>…</title> Title tag is used to represent the title of the web page. Page title appears at the very top of your browser’s window when you view the page.No other HTML Elements placed between this tag.The beginning of the title is marked by the <TITLE> tag, and the end with the </TITLE> tag.Titles should be short, descriptive, and limited.
<body>…</body> The Body section contains all the HTML Elements that is supposed to be presented on the web page. Everything between those two tags will be visible on your page.The beginning of the body section is marked by the <BODY> tag, and the end of the body section with the </BODY> tag

HTML Introduction

HTML is the acronym stands for Hypertext Markup Language.

Hypertext – It defines the the way webpages are linked together and you can move around webpages using a special text which linked to other webpage is known as Hyperlinks.

Markup Language – HTML is a language used to markup the plain text using various Markup Tags.

HTML is a easy to use and understandable scripting language used to develop website. First invented in year 1990 with the sole purpose of presenting information on internet. HTML defines the logical organization and formatting of the HTML Entities or content on document.HTML documents are also known as Web Pages, what we see when we view a web page on the browser is the interpretation of HTML.

Hyper Text Markup Language is a set of special short codes formally know as HTML Markup Tags which can be embedded in text to add formatting and linking of information.

Note:- HTML documents are just text files with the “.html” extension.

HTML Files can be created with the any simple text-editor program like notepad. Some popular HTML editors are FrontPage and Dreamweaver.

Example – Basic HTML page structure

How does HTML work?

HTML Document is just a text file which contains the series of markup tags, this text files is saved as HTML file with an “.html” extension. This HTML document is viewed using web browser like Internet Explorer, Mozilla Firefox etc. Web Browser reads this html files and interprate them into visible form by rendering it on the screen. HTML document can contain the Rich Text Media like text, powerfull graphics ,audio and videos etc.