Showing posts with label Html. Show all posts

You can abbreviate a text by putting it inside opening <abbr> and closing </abbr> tags.
If present, the title attribute must contain this full description and nothing else.

[code type="HTML"]
<!DOCTYPE html>
<html>
<head>
<title>Text Abbreviation</title>
</head>
<body>
<p>My best friend's name is <abbr title="Abhishek">Abhy</abbr>.</p>
</body>
</html>
[/code]

This will produce the following result: 


My best friend's name is Abhy.

Anything that appears within <strong>...</strong> element is displayed as important text.

[code type="HTML Code"]
<!DOCTYPE html>
<html>
<head>
<title>Strong Text Example</title>
</head>
<body>
<p>The following word uses a <strong>strong</strong> typeface.</p>
</body>
</html>
[/code]

This will produce the following result:


The following word uses a strong typeface.



Anything that appears with-in <mark>...</mark> element, is displayed as marked with
yellow ink.

[code type="HTML Code"]
<!DOCTYPE html>
<html>
<head>
<title>Marked Text Example</title>
</head>
<body>
<p>The following word has been <mark>marked</mark> with Blue</p>
</body>
</html>
[/code]

This will produce the following result:

[code type="Resul Page"]
The following word has been marked with Blue.
[/code]





Grouping Content  - Html Tutorial :

The <div> and <span> elements help you to group with each other number of elements to make segments or subsegments of a webpage.

Div Element - Grouping Content - Html Tutorial :

For illustration, you might possibly prefer to place all of the footnotes on a webpage inside a<div> element to specify that all of the elements inside that<div> element associate to the footnotes. You might possibly then add a style to this<div> element so that they show up implementing a specific set of style rules.

Example :


<!DOCTYPE html>
<html>
<head>
<title>Div Tag Example</title>
</head>
<body>
<div id="menu" align="middle" >
<a href="/index.htm">HOME</a> |
<a href="/about/contact_us.htm">CONTACT</a> |
<a href="/about/index.htm">ABOUT</a>
</div>
<div id="content" align="left" bgcolor="white">
<h5>Content Articles</h5>
<p>Actual content goes here.....</p>
</div>
</body>
</html>


This will certainly generate the following outcome:

Content Articles
Actual content goes here.....

 Span Element - Grouping Content - Html Tutorial :

The <span> element, conversely may be used to group inline elements only. Hence, if you have a portion of a sentence or paragraph which you would like to group with each other, you may use the element as follows .

Example :


<!DOCTYPE html>
<html>
<head>
<title>Span Tag Example</title>
</head>
<body>
<p>This is the example of <span style="color:green">span tag</span> and the <span style="color:red">div tag</span> alongwith CSS</p>
</body>
</html>


This will certainly generate the following outcome:

This is the example of span tag and the div tag alongwith CSS


These tags are typically combined with CSS to let you affix a style to a segment of a page.

Larger Text - Html Tutorial

The content of the <big>...</big> element is shown a single font size much bigger in comparison with the rest of the text associated with it as demonstrated below:

Example :


<!DOCTYPE html>
<html>
<head>
<title>Larger Text Example</title>
</head>
<body>
<p>The following word uses a <big>big</big> typeface.</p>
</body>
</html>


This will certainly generate the following outcome:

The following word uses a big typeface.

Smaller Text  - Html Tutorial :

The content connected with the <small>...</small> element is exhibited a single font size smaller sized compared to the rest of the words associated with it as demonstrated below:

Example :


<!DOCTYPE html>
<html>
<head>
<title>Smaller Text Example</title>
</head>
<body>
<p>The following word uses a <small>small</small> typeface.</p>
</body>
</html>


This will certainly generate the following outcome:

The following word uses a small typeface.

Inserted Text - Html Tutorial :

Whatever which is found inside of <ins>...</ins> element is exhibited as inserted text.

Example  :


<!DOCTYPE html>
<html>
<head>
<title>Inserted Text Example</title>
</head>
<body>
<p>I want to drink <del>cola</del> <ins>wine</ins></p>
</body>
 </html>

This will generate the following outcome:

I want to drink
colawine

Deleted Text - Html Tutorial :

Whatever which seems inside of <del>...</del> element, is shown as deleted text.

Example :


<!DOCTYPE html>
<html>
<head>
<title>Deleted Text Example</title>
</head>
<body>
<p>I want to drink <del>cola</del> <ins>wine</ins></p>
</body>
</html>

This will produce the following result:


I want to drink
colawine


 Monospaced Font - Html Tutorial :


The content material of a <tt>...</tt> element is composed in monospaced font. Almost all of the fonts are identified as variable-width fonts simply because various letters are of various widths (for instance, the letter 'm' is broader when compared with the letter 'i'). With a monospaced font, on the other hand, each and every letter provides the similar breadth.

Example :



<!DOCTYPE html>
<html>
<head>
<title>Monospaced Font Example</title>
</head>
<body>
<p>The following word uses a <tt>monospaced</tt> typeface.</p>
</body>
</html>


This will generate the following outcome :

The following word uses a monospaced typeface.


 Superscript Text - Html Tutorial :


The written content of a <sup>...</sup> element is composed in superscript; the font size utilized is the similar size as the characters surrounding it however is exhibited 50 percent a character's height over the other characters.

Example:



<!DOCTYPE html>
<html>
<head>
<title>Superscript Text Example</title>
</head>
<body>
<p>The following word uses a <sup>superscript</sup> typeface.</p>
</body>
</html>


This will generate the following outcome :

The following word uses a superscript typeface.

Subscript Text  -Html Tutorial :

The written content of a <sub>...</sub> element is composed in subscript; the font size utilized is the similar as the characters surrounding it, however is exhibited half a character's height beneath the other characters.

Example :



<!DOCTYPE html>
<html>
<head>
<title>Subscript Text Example</title>
</head>
<body>
<p>The following word uses a <sub>subscript</sub> typeface.</p>
</body>
</html>


This will generate the following outcome :


The following word uses a subscript typeface. 


In the event that you utilize a Word Processor, you should be acquainted with the capacity to make Text Bold, Italicized, or Underlined; these are only three of the ten alternatives accessible to demonstrate how content can show up in HTML and XHTML.

Html Formatting Bold :

Anything that shows up inside <b>...</b> component, is shown in Bold as demonstrated as follows:

Example :  (html formatting bold)


<!DOCTYPE html>
<html>
<head>
<title>Bold Text Example</title>
</head>
<body>
<p>The following word uses a <b>bold</b> typeface.</p>
</body>
</html>


This will produce the following result:

The following word uses a bold typeface.

Html Formatting Italics :

Anything that shows up inside <i>...</i> component is shown in displayed as demonstrated as follows:

Example : (html formatting italics)


<!DOCTYPE html>
<html>
<head>
<title>Italic Text Example</title>
</head>
<body>
<p>The following word uses a <i>italicized</i> typeface.</p>
</body>
</html>


This will produce the following result:

The following word uses an italicized typeface.

Html Formatting Bold Underline :

Anything that shows up inside <u>...</u> Element, is Displayed with Underline as demonstrated as follows:

Example : (html formatting bold underline)


<!DOCTYPE html>
<html>
<head>
<title>Underlined Text Example</title>
</head>
<body>
<p>The following word uses a <u>underlined</u> typeface.</p>
</body>
</html>


This will produce the following result:

The following word uses an underlined typeface.

Html Formatting Strikethrough:

Anything that shows up inside <strike>...</strike> element is displayed with strikethrough, which is a thin line through the text as shown below:

Example: (html formatting strikethrough)


<!DOCTYPE html>
<html>
<head>
<title>Strike Text Example</title>
</head>
<body>
<p>The following word uses a <strike>strikethrough</strike> typeface.</p>
</body>
</html>


This will produce the following result:

The following word uses a strikethrough typeface.

There are three internationalization attributes, which are available for most XHTML elements.



  • dir 
  • lang 
  • xml:lang 


The dir Attribute:

The dir attribute allows you to indicate to the browser about the direction in which the text should flow. The dir attribute can take one of two values, as you can see in the table that follows:



ltr -> Left to right (the default value)
rtl -> Right to left (for languages such as Hebrew or Arabic that are read right to left)



Example :



<!DOCTYPE html>
<html dir="rtl">
<head>
<title>Display Directions</title>
</head>
<body>
This is how IE 5 renders right-to-left directed text.
</body>
</html>



This will produce the following result:

This is how IE 5 renders right-to-left directed text.



When dir attribute is used within the <html> tag, it determines how text will be presented within the entire document. When used within another tag, it controls the text's direction for just the content of that tag.


The lang Attribute:

The lang attribute allows you to indicate the main language used in a document, but this attribute was kept in HTML only for backwards compatibility with earlier versions of HTML. This attribute has been replaced by the xml:lang attribute in new XHTML documents.

The values of the lang attribute are ISO-639 standard two-character language codes. Check HTML Language Codes: ISO 639 for a complete list of language codes.

Example :



<!DOCTYPE html>
<html lang="en">
<head>
<title>English Language Page</title>
</head>
<body>
This page is using English Language
</body>
</html>



The xml:lang Attribute:



The xml:lang attribute is the XHTML replacement for the lang attribute. The value of thexml:lang attribute should be an ISO-639 country code as mentioned in previous section.



Generic Attributes:

Some other attributes that are readily usable with many of the HTML tags.



align - right, left, center - Horizontally aligns tags
valign - top, middle, bottom - Vertically aligns tags within an HTML element.
bgcolor - numeric, hexidecimal, RGB values - Places a background color behind an element
background - URL - Places a background image behind an element
id - User Defined - Names an element for use with Cascading Style Sheets.
class - User Defined - Classifies an element for use with Cascading Style Sheets.
width - Numeric Value - Specifies the width of tables, images, or table cells.
height - Numeric Value - Specifies the height of tables, images, or table cells.
title - User Defined - "Pop-up" title of the elements.



Core Attributes:


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


  1. Id 
  2. Title
  3. Class
  4. Style


 

The Id Attribute:


The id attribute of an HTML tag can be used to uniquely identify any element within an HTML page. 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 Web page (or style sheet), you can use the id attribute to distinguish between elements that have the same name.

 Example :



<p id="html">This para explains what is HTML</p>
<p id="css">This para explains what is Cascading Style Sheet</p>



 

The title Attribute:


The title attribute gives a suggested title for the element. They syntax for the title attribute is similar as explained for id attribute:
The behavior of this attribute will depend upon the element that carries it, although it is often displayed as a tooltip when cursor comes over the element or while the element is loading.

Example :



<!DOCTYPE html>
<html>
<head>
<title>The title Attribute Example</title>
</head>
<body>
<h3 title="Hello HTML!">Titled Heading Tag Example</h3>
</body>
</html>


This will produce the following result:


Titled Heading Tag Example



 

The class Attribute:


The class attribute is used to associate an element with a style sheet, and specifies the class of element. The value of the attribute may also be a space-separated list of class names. For example:



class="className1 className2 className3"



 

The style Attribute:


The style attribute allows you to specify Cascading Style Sheet (CSS) rules within the element.



<!DOCTYPE html>
<html>
<head>
<title>The style Attribute</title>
</head>
<body>
<p style="font-family:arial; color:#FF0000;">The style attribute allows...</p>
</body>
</html>


This will produce the following result:


The style attribute allows...


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


  • The name is the property you want to set. For example, the paragraph <p> element in the example carries an attribute whose name is align, which you can use to indicate the alignment of paragraph on the page.  
  • The value is what you want the value of the property to be set and always put within quotations. The below example shows three possible values of align attribute: left, center and right.

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.

Example :



<!DOCTYPE html>
<html>
<head>
<title>Align Attribute  Example</title>
</head>
<body>
<p align="left">This is left aligned</p>
<p align="center">This is center aligned</p>
<p align="right">This is right aligned</p>
</body>
</html>


This will display the following result:

This is left aligned
This is center aligned
This is right aligned

An HTML element is defined by a starting tag. If the element contains other content, it ends with a closing tag: <p>....</p> is an HTML element, <h1>...</h1> is another HTML element. There are some HTML elements which don't need to be closed, such as <img.../>, <hr /> and <br /> elements. These are known as void elements.

HTML documents consists of a tree of these elements and they specify how HTML documents should be built, and what kind of content should be placed in what part of an HTML document.

HTML Tag vs. Element :

For example, <p> is starting tag of a paragraph and </p> is closing tag of the same paragraph but <p>This is paragraph</p> is a paragraph element.

Nested HTML Elements:

It is very much allowed to keep one HTML element inside another HTML element:

Example :



<!DOCTYPE html>
<html>
<head>
<title>Nested Elements Example</title>
</head>
<body>
<h1>This is <i>italic</i> heading</h1>
<p>This is <u>underlined</u> paragraph</p>
</body>
</html>


This will display the following result: 

This is italic heading

This is underlined paragraph


Suppose you want to use the phrase "Terminator 2: Judgment Day." Here, you would not want a browser to split the "Terminator, 2:, Judgment" and "Day" across two lines: 

In cases, where you do not want the client browser to break text, you should use a nonbreaking space entity &nbsp; instead of a normal space. For example, when coding the "Terminator 2: Judgment Day" in a paragraph, you should use something similar to the following code:
 

Example :
 


<!DOCTYPE html>
<html>
<head>
<title>Nonbreaking Spaces Example</title>
</head>
<body>
<p>An example of this technique appears in the movie "Terminator&nbsp;2:&nbsp;Judgment&nbsp;Day."</p>
</body>

</html> 



This will produce the following result:  

An example of this technique appears in the movie "Terminator 2: Judgment Day." 


Sometimes, you want your text to follow the exact format of how it is written in the HTML document. In these cases, you can use the preformatted tag <pre>.
Any text between the opening <pre> tag and the closing </pre> tag will preserve the formatting of the source document.

Example :


<!DOCTYPE html>
<html>
<head>
<title>Preserve Formatting Example</title>
</head>
<body>
<pre>
function testFunction( strText ){
   alert (strText)
}
</pre>
</body>
</html>


This will produce the following result: 

function testFunction( strText ){
   alert (strText)


Try using the same code without keeping it inside <pre>...</pre> tags


Horizontal lines are used to visually break-up sections of a document. The <hr> tag creates a line from the current position in the document to the right margin and breaks the line accordingly.

For example, you may want to give a line between two paragraphs as in the given example below:

Example :


<!DOCTYPE html>
<html>
<head>
<title>Horizontal Line Example</title>
</head>
<body>
<p>This is paragraph one and should be on top</p>
<hr />
<p>This is paragraph two and should be at bottom</p>
</body>
</html>


This will produce the following result: 

This is paragraph one and should be on top

This is paragraph two and should be at bottom 

Again <hr /> tag is an example of the empty element, where you do not need opening and closing tags, as there is nothing to go in between them.

The <hr /> element has a space between the characters hr and the forward slash. If you omit this space, older browsers will have trouble rendering the horizontal line, while if you miss the forward slash character and just use <hr> it is not valid in XHTML



You can use <center> tag to put any content in the center of the page or any table cell.

Example:



<!DOCTYPE html>
<html>
<head>
<title>Centring Content Example</title>
</head>
<body>
<p>This text is not in the center.</p>
<center>
<p>This text is in the center.</p>
</center>
</body>
</html>


This will produce the following result:

 This text is not in the center.


This text is in the center. 


Whenever you use the <br /> element, anything following it starts from the next line. This tag is an example of an empty element, where you do not need opening and closing tags, as there is nothing to go in between them. The <br /> tag has a space between the characters br and the forward slash. If you omit this space, older browsers will have trouble rendering the line break, while if you miss the forward slash character and just use <br> it is not valid in XHTML.
 

Example :
 


<!DOCTYPE html>
<html>
<head>
<title>Line Break  Example</title>
</head>
<body>
<p>Hello<br />
You delivered your assignment on time.<br />
Thanks<br />
Mahnaz</p>
</body>
</html>


 

This will produce the following result: 
 
Hello 

You delivered your assignment on time. 
Thanks 
Mahnaz 


The <p> tag offers a way to structure your text into different paragraphs. Each paragraph of text should go in between an opening <p> and a closing </p> tag as shown below in the example:
 

Example :
 



<!DOCTYPE html>
<html>
<head>
<title>Paragraph Example</title>
</head>
<body>
<p>Here is a first paragraph of text.</p>
<p>Here is a second paragraph of text.</p>
<p>Here is a third paragraph of text.</p>
</body>
</html>
 




This will produce the following result:



 

Any document starts with a heading. You can use different sizes for your headings. HTML also has six levels of headings, which use the elements <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>. While displaying any heading, browser adds one line before and one line after that heading.
 

Example:



<!DOCTYPE html>
<html>
<head>
<title>Heading Example</title>
</head>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
</body>
</html> 



 
This will produce the following result: 


You should  learn the key concept of creating any web page: how to give it  structure . You need to add structure to a document so that web browsers can present the page to people who visit your site in a way they will understand. To give a document structure, you ’ ll need to learn how to create web pages using HTML.

A Web of Structured Documents:

Before we create our first web page, let ’ s just take a moment to look at the printed information we see every day,   and how it compares to what we see on the Web. Every day, you come across all kinds of printed documents    newspapers, train timetables, insurance forms. You can think of the Web as being a sea of documents that all link together, and bear a strong similarity to the printed documents that you meet in everyday life. 

Every morning we used to read a newspaper. A newspaper is made up of several stories or articles (and probably a fair smattering of advertisements, too). Each story has a headline and then some paragraphs, perhaps a subheading, and then some more paragraphs; it may also include a picture or two.
The structure of articles on news web sites is very similar to the structure of articles in newspapers. Each article is made up of headings, paragraphs of text, and some pictures (sometimes the pictures might be replaced by a video). The parallel is quite clear; the only real difference is that in a newspaper you may have several stories on a single page, whereas on the Web each story tends to get its own page. The news web sites also often use homepages that display the headline and a brief summary of the stories. 

A typical HTML document will have the following structure: 



Document declaration tag 
<html>
   <head>
       Document header related tags
   </head> 
   <body>
       Document body related tags
   </body>
</html>




 

TECH SHARPENER

.
Powered by Blogger.