top of page

FOLLOW ME:

HTML Free Tutorial

  • tekslate
  • Jan 2, 2015
  • 5 min read

Introduction to HTML

HTML stands for Hypertext markup language, and it is the most widely used language to write web pages, as its suggests, HTML is a markup language.

Hypertext refers to the way in which web pages(HTML documents) are linked together, when you click a link in a web page, you are using hypertext.

Markup Language describes how HTML works. With a markup language, you simply "mark up" a text document with tags that tell a web browser how to structure it to display.

All you need to do to use HTML is learn what type of markup to use to get the results you want.

HTML Attributes

HTML Class Attribute

The class HTML attribute is used to associate an element with a style sheet, and specifies the class of element, you learn more about the use of the class attribute when you will learn cascading Style sheet(CSS). The value of the attribute may also be a space-separated list of class names.

For example.

class=”className1 classname2 classname3”

The style HTML attribute allows you to specify CSS rules within the element. For example

<p style=”font-family:arial; color:#FF0000;”>Some text… </p>

Attributes

An attribute is used to define the characteristics of an element and is placed inside the element’s opening tag. All attributes are made up of two parts: a name and a value.

The value of the attribute should be put in double quotation marks, and is separated from the name by the equals sign

Many HTML tags have a unique set of their own attributes. Right now we want to focus on a set of generic attributes.

Core Attributes

The four core attributes that can be used on the majority of HTML elements(although not all) are:

id

title

class

style

HTML id Attribute

The id HTML attribute can be used to uniquely identify any element within a page(or style sheet). There are two primary reasons that you might want to use an id attribute on an element:

If an element carries an id attribute as a unique identifier it is possible to identify just that element and its content.

If you have two elements of the same name within a webpage(or style sheet), you can use the id attribute to distinguish between elements that have the same name.

For now, the id attribute could be used to distinguish between two paragraph elements, like so:

<p id=”html”> This para explains what is HTML</p>

<p id=”css”>This para explains what is casecading style sheet<\p>

Note that there are some special rules for the value of the id attribute, it must :

Begin with a letter (A.Z or a.z) and can then be followed by any number of letters, digits(0,9), hyphens, underscores, colons, and periods.

Remain unique within that document; no two attributes may have the same value within that HTML document.

HTML Title Attribute

The title HTML attribute gives a suggested title for the element. The behavior of this attribute will depend upon the element that carries it, although it is often displayed as a tooltip or while the element is loading.

Use Lowercase Attributes

Attribute names and attribute values are case-insensitive.

However, the World Wide Web Consortium(w3c) recommends lowercase attributes/attribute values in their HTML 4 recommendation.

Newer versions of (X) HTML will demand lowercase attributes.

The <html> element is the containing element for the whole HTML document. Each HTML document should have one <html> and each document should end with a closing </html> tag.

Following two elements appear as direct children of an <html> element:

<head>

<body>

The <head> Element

The <head> element is just a container for all other header elements. It should be the first thing to appear after the opening <html> tag

Each <head> element should contain a <title> element indicating the title of the document, although it may also contain any combination of the following elements, in any order :

The <base> tag is used to create a “base” url for all links on the page.

The <object> tag is designed to include images, javascript objects, Flash animations, MP3 files, QuickTime movies and other components of a page.

The <link> tag is used to link to an external file, such as a style sheet or Javascript file

The <style> tag is used to include CSS rules inside the document

The <script> tag is used to include JAVA script or VBscript inside the document

The <meta> tag includes information about the document such as keywords and a description, which are particularly helpful for search applications.

HTML Base Tag

<html>

<head>

<title>practice HTML base tag</title>

<base href=”http://www.sekharit.com” target=”_blank”/>

</head>

<body>

<p> This tag is using base path to display the image. </p>

<img src=”/image/html.gif”/>

<p> This link will open in new window because we have used _blank in base tag.</p>

<p> Try to click this <a href=”/php/index.htm”>PHP tutorial</a>

</body>

</html>

HTML Link Tag

<Link rel=”stylesheet” type=”text/css” href=”/style.css”>

HTML Style Tag

Style sheets describe how documents are presented on screens, in print, or perhaps how they are pronounced. W3C has actively promoted the use of style sheets on the web since the Consortium was founded in 1994.

Cascading Style Sheets(CSS) is a style sheet mechanism that has been specifically developed to meet the needs of web designers and users.

With CSS, you can specify a number of style properties for given HTMl element. Each properly has a name and a value, sperated by a colon(:) Each property declaration is separated by semi-colon(;)

<p style=”color:red:font-size:24px”>Using Style Sheet Rules</p>

The <div> tag is nothing more than a container for other tags, Much like the body tag, Div elements are block elements and work behind the scenes grouping other tags together. Use only the following attributes with your div element.

id

Width

height

title

style

For the purpose of this example, we have included the style attribute in order to color our div tag in order to bring a stronger visualization for our viewer.

<body>

<div style=”background: green”>

<h5>SEARCH LINKS</h5>

<a target=”_blank” href=”http://www.google.com”>Google</a>

</div>

</body>

HTML Div Element

Above is a great visual about how a div plays the role of a container of other HTML elements, applying a background color/image is the only real way to visualize your div tags.

HTML – Links and Anchors

The web got its spidery name from the plentiful connections between web sites. These connections are made using anchor tags to create links. Text, images, and Forms may be used to create these links.

Style Sheets in HTML

External Style Sheet

If you have to give same look and feel to many pages then it is a good idea to keep all the style sheet rules in a single style sheet file and include this file in all the HTML pages. You can include a style sheet file into HTML document using <link> element. Below is an example.

<head>

<link rel=”stylesheet” type=”text/css” href=”yourstyle.css”>

</head>

Internal Style Sheet

If you want to apply style sheet rules to a single document only then you can include those rules into that document only. Below is an example :

<head>

<style type=”text/css”>

body { background-color: pink; }

p{color:blue;20px;font-size:24px}

</style>

</head>

Inline Style Sheet

You can apply style sheet rules directly to any HTML elemet. This should be done only when you are interested to make a particular change in any HTML element only. To use inline styles you use the style attribute in the relevant tag. Below is an example:

<p style=”color:red;font-size:24px;”>Using Style Sheet Rules</p>

To Learn More Follow Below Link:

 
 
 

Comments


  • Facebook Clean Grey
  • Twitter Clean Grey
  • Instagram Clean Grey

RECENT POSTS: 

SEARCH BY TAGS: 

© 2023 by Closet Confidential. Proudly created with Wix.com

  • b-facebook
  • Twitter Round
  • Instagram Black Round
bottom of page