18/11/2014

HTML Attributes

| |
1 comments

HTML Attributes

Attributes provide additional information about HTML elements.

HTML Attributes


    HTML elements can have attributes
    Attributes provide additional information about an element
    Attributes are always specified in the start tag
    Attributes come in name/value pairs like: name="value"

The lang Attribute


The document language can be declared in the <html> tag.

The language is declared in the lang attribute.

Declaring a language is important for accessibility applications (screen readers) and search engines:

Example: 

<!DOCTYPE html>
<html lang="en-US">
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>
 The first two letters specify the language (en). If there is a dialect, use two more letters (US).

The title Attribute

HTML paragraphs are defined with the <p> tag.

In this example, the <p> element has a title attribute. The value of the attribute is "About FindingPHP":
<!DOCTYPE html>
<html>
<body>

<h1>About FindingPHP</h1>

<p title="About FindingPHP">
FindingPHP is a web developer's site.
It provides tutorials and references covering
many aspects of web programming,
including HTML, CSS, JavaScript, MySQL, DOM, PHP.
</p>

<p><b>
If you move the mouse over the paragraph above,
the title will display as a tooltip.
</b></p>

</body>
</html>
*When you move the mouse over the element, the title will be displayed as a tooltip.
Demo

The href Attribute

HTML links are defined with the <a> tag. The link address is specified in the href attribute:
<!DOCTYPE html>
<html>
<body>

<a href="http://findingphp.blogspot.in/">This is a link</a>

</body>
</html>
You will learn more about links and the <a> tag later in this tutorial.
Demo

Size Attributes

HTML images are defined with the <img> tag.
The filename of the source (src), and the size of the image (width and height) are all provided as attributes:
 
<!DOCTYPE html>
<html>
<body>

<img src="http://i.imgur.com/QdEj8Lf.jpg" width="100" height="100">

</body>
</html>

Demo
The image size is specified in pixels: width="100" means 100 screen pixels wide.

You will learn more about images and the <img> tag later in this tutorial.

The alt Attribute

The alt attribute specifies an alternative text to be used, when an HTML element cannot be displayed.

The value of the attribute can be read by "screen readers". This way, someone "listening" to the webpage, i.e. a blind person, can "hear" the element.
<!DOCTYPE html>
<html>
<body>

<img src="http://i.imgur.com/QdEj8Lf.jpg" alt="FindingPHP" width="100" height="100">

</body>
</html>
Demo
We Suggest: Always Use Lowercase Attributes

The HTML5 standard does not require lower case attribute names.

The title attribute can be written with upper or lower case like Title and/or TITLE.

W3C recommends lowercase in HTML4, and demands lowercase for stricter document types like XHTML.

*Lower case is the most common. Lower case is easier to type.
    At FindingPHP we always use lower case attribute names.

We Suggest: Always Quote Attribute Values

The HTML5 standard does not require quotes around attribute values.

The href attribute, demonstrated above, can be written as:
<!DOCTYPE html>
<html>
<body>

<a href=http://findingphp.blogspot.in/>This is a link</a>

</body>
</html>
Demo
W3C recommends quotes in HTML4, and demands quotes for stricter document types like XHTML.
Sometimes it is necessary to use quotes. This will not display correctly, because it contains a space:
 
<!DOCTYPE html>
<html>
<body>

<h1>About FindingPHP</h1>

<p title=About FindingPHP>
You cannot ommit qoutes around an attribute value
if the value contains spaces.
</p>

<p><b>
If you move the mouse over the paragraph above,
your browser will only display the first word from the title.
</b></p>

</body>
</html>
Demo
*Using quotes are the most common. Omitting quotes can produce errors.
    At FindingPHP we always use quotes around attribute values.

Single or Double Quotes?

Double style quotes are the most common in HTML, but single style can also be used.

In some situations, when the attribute value itself contains double quotes, it is necessary to use single quotes:
<p title='John "ShotGun" Nelson'>
Or vice versa:
<p title="John 'ShotGun' Nelson">

Chapter Summary

  • All HTML elements can have attributes
  • The HTML title attribute provides additional "tool-tip" information
  • The HTML href attribute provides address information for links
  • The HTML width and height attributes provide size information for images
  • The HTML alt attribute provides text for screen readers
  • At FindingPHP we always use lowercase HTML attribute names
  • At FindingPHP we always quote attributes with double quotes
Read More

HTML Elements

| |
0 comments

HTML Elements

HTML documents are made up by HTML elements.

HTML elements are written with a start tag, with an end tag, with the content in between:

<tagname>content</tagname>

The HTML element is everything from the start tag to the end tag:

<p>My first HTML paragraph.</p>

Start tag     Element content     End tag
<h1>          My First Heading     </h1>
<p>            My first paragraph.    </p>
<br>
*Some HTML elements do not have an end tag. 

Nested HTML Elements


HTML elements can be nested (elements can contain elements).

All HTML documents consist of nested HTML elements.

This example contains 4 HTML elements:

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>

Demo

HTML Example Explained


The <html> element defines the whole document.

It has a start tag <html> and an end tag </html>.

The element content is another HTML element (the <body> element).

<html>

<body>
  <h1>My First Heading</h1>
  <p>My first paragraph.</p>
</body>

</html>
The <body> element defines the document body.

It has a start tag <body> and an end tag </body>.

The element content is two other HTML elements (<h1> and <p>).

<body>
  <h1>My First Heading</h1>
  <p>My first paragraph.</p>
</body>
The <h1> element defines a heading.

It has a start tag <h1> and an end tag </h1>.

The element content is: My First Heading.

<h1>My First Heading</h1>
The <p> element defines a paragraph.

It has a start tag <p> and an end tag </p>.

The element content is: My first paragraph.

<p>My first paragraph.</p>

Don't Forget the End Tag

Some HTML elements will display correctly, even if you forget the end tag:

<!DOCTYPE html>
<html>
<body>

<p>This is a paragraph.
<p>This is a paragraph.

</body>
</html>

Demo
The example above works in all browsers, because the closing tag is considered optional.

Never rely on this. It might produce unexpected results and/or errors if you forget the end tag.

Empty HTML Elements


HTML elements with no content are called empty elements.

<br> is an empty element without a closing tag (the <br> tag defines a line break).

Empty element can be "closed" in the opening tag like this: <br />.

HTML5 does not require empty elements to be closed. But if you need stricter validation, and make your document readable by XML parsers, please close all HTML elements.

HTML Tip: Use Lowercase Tags


HTML tags are not case sensitive: <P> means the same as <p>.

The HTML5 standard does not require lowercase tags, but W3C recommends lowercase in HTML4, and demands lowercase for stricter document types like XHTML.
Read More

01/11/2014

HTML Basics

| |
0 comments

 

HTML Basics

 HTML Headings

HTML headings are defined with the <h1> to <h6> tags:

Example:
Coding:
<!DOCTYPE html>
<html>
<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 is heading 1

This is heading 2

This is heading 3

This is heading 4

This is heading 5
This is heading 6

HTML Paragraphs

HTML paragraphs are defined with the <p> tag:

Example:
coding:
<!DOCTYPE html>
<html>
<body>

<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>

</body>
</html>

This is a paragraph.
This is a paragraph.
This is a paragraph.

HTML Links

HTML links are defined with the <a> tag:

The link address is specified in the href attribute.
Attributes are used to provide additional information about HTML elements.
Example:
coding:
<!DOCTYPE html>
<html>
<body>

<a href="http://findingphp.blogspot.com/">This is a link</a>

</body>
</html>


HTML Images

HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), and size (width and height) are provided as attributes:

Example:
Coding:
<!DOCTYPE html>
<html>
<body>

<img src="http://i.imgur.com/QdEj8Lf.jpg" alt="Findingphp" width="100" height="128">

</body>
</html>

findingphp
Read More

HTML Editors

| |
0 comments

 

HTML Editors

Write HTML Using Notepad or TextEdit

HTML can be edited by using a professional HTML editor like:
  • Adobe Dreamweaver
  • Microsoft Expression Web
  • CoffeeCup HTML Editor

However, for learning HTML we recommend a text editor like Notepad (PC) or TextEdit (Mac).

We believe using a simple text editor is a good way to learn HTML.

Follow the 4 steps below to create your first web page with Notepad.

Step 1: Open Notepad

To open Notepad in Windows 7 or earlier:

Click Start (bottom left on your screen). Click All Programs. Click Accessories. Click Notepad.

To open Notepad in Windows 8 or later:

Open the Start Screen (the window symbol at the bottom left on your screen). Type Notepad.

Step 2: Write Some HTML

Write or copy some HTML into Notepad.
<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>


Step 3: Save the HTML Page

Save the file on your computer.

Select File -> Save as in the Notepad menu.

When saving an HTML file, use either the .htm or the .html file extension. There is no difference, it is entirely up to you.

Step 4: View HTML Page in Your Browser

Double-click your saved HTML file, and the result will look much like this:

My First Heading

My first paragraph.
Read More

HTML versions list

| |
0 comments

HTML versions list 

Version                       Year

HTML                          1991
HTML+                        1993
HTML 2.0                     1995
HTML 3.2                     1997
HTML 4.01                   1999
XHTML 1.0                   2000
HTML5                         2012
XHTML5                       2013

Read More

Why learn HTML ?

| |
0 comments
It is possible to create webpages without knowing anything about the HTML source behind the page.

There are excellent editors on the market that will take care of the HTML parts. All you need to do is layout the page.

However, if you want to make it above average in webdesign, it is strongly recommended that you understand these tags.

The most important benefits are:
  • You can use tags the editor does not support.
  • You can read the code of other people's pages, and "borrow" the cool effects.
  • You can do the work yourself, when the editor simply refuses to create the effects you want.
You can write your HTML by hand with almost any available text editor, including notepad that comes as a standard program with Windows.

All you need to do is type in the code, then save the document, making sure to put an .html extension or an .htm extension to the file (for instance "mypage.html").
Read More

12/09/2014

What is HTML ?

| |
0 comments

HTML

HTML stands for HyperText Markup Language. HTML is the main markup language for describing the structure of Web pages.

Description:

                Hypertext is text displayed on a computer or other electronic device with references to other text that the reader can immediately access, usually by a mouse click or key press sequence.

                Apart from text, hypertext may contain tables, images and other presentational elements. It is an easy-to-use and flexible format to share information over the Internet.

                 Markup Languages use sets of markup tags to characterize text elements within a document, which gives instructions to the Web browser on how the document should appear.

 

HTML Gives You Ability To:

  • Publish documents online with text, headings, images, lists, tables, etc.
  • Accessing online information or other web resources such as images, videos or other HTML document via hyperlinks.
  • Create forms to collect user input like login information, feedback, comments or conducting transactions with remote servers, etc.
  • Include videos, sound clips, flash movies, applications and other HTML document directly inside an HTML document.
Note:HyperText Markup Language (HTML), as described earlier is a markup language not a programming language.

 

HTML Tags:

                 HTML is written in the form of HTML elements consisting of markup tags. These markup tags are the fundamental characteristic of HTML. Every markup tag is composed of a keyword, surrounded by angle brackets (like <html>).

                 HTML tags normally come in pairs like <html> and </html>. The first tag in a pair is the opening tags the second tag is the closing tags. An opening tag and a closing tag are identical, except a "slash" (/) after the opening angle bracket of a closing tag, to tell the browser that the command has been completed. In between these tags web designers can add text, tables, images, etc.

                 For example, a paragraph, which is represented by the p element, would be written as:

<p>In the HTML syntax, most elements are written ...</p>

 

Document Overview:

                 All HTML document seem to be plain text files. They contain no images,sounds, videos etc. but just plain text. However, they may contain links to images, sounds, videos and animations.

Note:The browser does not display the HTML tags, but uses the tags to interpret the content of the page. 
Read More

10/09/2014

Button With Line Breaks

| |
0 comments
You can use carriage return characters to break the line: &#x00A;

<input type="button" value="Really&#x00A;Tall&#x00A; Button">

Live Demo
Read More

06/09/2014

Hide url in address bar

| |
0 comments
Qus: How to hide url in address bar ?

Ans:

The HTML script above works on both Internet Explorer and Netscape/Firefox, etc.


This is First Method:

<html>
<iframe src=http://google.com width=100% noborder height=100% no scroll>
 </html>

This is Second Method:

<html>
<FRAMESET border=0 rows="100%,*" frameborder="no" marginleft=0 margintop=0 marginright=0 marginbottom=0>
<frame src="http://www.WEBSITE.com" scrolling=auto frameborder="no" border=0 noresize>
<frame topmargin="0" marginwidth=0 scrolling=no marginheight=0 frameborder="no" border=0 noresize>
</FRAMESET>
</html>

Demo
Read More

Check Your Codes

Check the result of your (sample) HTML,CSS,JavaScript code.