w3schools    w3Schools
Search W3Schools :
   
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About
ADVERTISEMENTS

XML Certification
Download XML editor
Custom Programming
 
Table of contents
HTML Basic
HTML HOME
HTML Introduction
HTML Get Started
HTML Basic
HTML Headings
HTML Paragraphs
HTML Formatting
HTML Elements
HTML Attributes
HTML Styles
HTML Links
HTML Images
HTML Tables
HTML Lists
HTML Forms
HTML Colors
HTML Colornames
HTML Colorvalues

HTML Quick List

HTML Advanced
HTML Layout
HTML Frames
HTML Fonts
HTML 4.0 Why
HTML CSS
HTML Entities
HTML Head
HTML Meta
HTML URLs
HTML Scripts
HTML Attributes
HTML Events
HTML URL Encode
HTML Webserver
HTML Summary

Examples/Quiz
HTML Examples
HTML Quiz
HTML Exam

References
HTML Tag List
HTML Attributes
HTML Events
HTML Colornames
HTML Character Sets
HTML ASCII
HTML ISO-8859-1
HTML Symbols
HTML URL Encode
HTML Lang Codes
HTTP Messages

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

W3Schools Tutorials
W3Schools Forum

Helping W3Schools

 

HTML Attributes

Previous Next

Attributes provide additional information about HTML elements.


HTML Attributes

  • HTML elements can have attributes
  • Attributes provide additional information about the element
  • Attributes are always specified in the start tag

Attribute Syntax

Attributes always come in name/value pairs like this: name="value".

Examples

border="1"

href="http://www.w3scchools.com"

bgcolor="yellow"


Attributes Example 1:

<table> defines an HTML table. (You will learn more about HTML tables later)

<table border="1">

The border attribute defines a border type for the <table> element.


Attributes Example 2:

<a> defines an anchor (an HTML link). (You will learn more about HTML links  later)

<a href="http://www.w3schools.com">

The href attribute provides the link address for the <a> element.


Attributes Example 3:

<body> defines the body of an HTML document.

<body bgcolor="yellow">

The bgcolor attribute defines the background color for the <body> element.

Note: bgcolor is a "dying" attribute, use styles instead (next chapter).


Always Quote Attribute Values

Attribute values should always be enclosed in quotes. Double style quotes are the most common, but single style quotes are also allowed.

In some rare situations, like when the attribute value itself contains quotes, it is necessary to use single quotes:

name='John "ShotGun" Nelson'


HTML Tip - 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.


HTML Attributes Reference

A full list of attributes for each HTML element is listed in our:

Complete HTML Reference

Below is a list of some attributes that are standard for all HTML elements (with a few exceptions):

Attribute Value Description
class class_rule or style_rule The class of the element
id id_name A unique id for the element
style style_definition An inline style definition
title tooltip_text  A text to display in a tool tip

For more information about standard attributes:

HTML Standard Attributes Reference


Previous Next


Learn how your website performs under various load conditions

Web Load and Performance Testing   

WAPT is a load, stress and performance testing tool for websites and web-based applications. In contrast to "800-pound gorilla" load testing tools, it is designed to minimize the learning curve and give you an ability to create a heavy load from a regular workstation. WAPT is able to generate up to 3000 simultaneously acting virtual users using standard hardware configuration. Virtual users in each profile are fully customizable. Basic and NTLM authentication methods are supported. Graphs and reports are shown in real-time at different levels of detail, thus helping to manage the testing process.

Download the free 30-day trial!


 
WEB HOSTING
E Components
Ecommerce
Components
for ASP.NET
$15 Domain Name
Registration
Save $20 / year!
Buy UK Domain Names
Register Domain Names
Cheap Domain Names
Cheap Web Hosting
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting
WEB BUILDING
Website Templates
Flash Templates
Website Builder
Internet Business Opportunity
Custom Programming
FREE Trial or Demo
Web Content Manager
Forms,Web Alerts,RSS
Download XML editor
FREE Flash Website
FREE Web Templates
EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification
Home HOME or Top of Page Validate   Validate   W3C-WAI level A conformance icon Printer Friendly  Printer Friendly

W3Schools is for training only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user.
While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright 1999-2009 by Refsnes Data. All Rights Reserved.