How To Learn PHP Programming Beginners Guide
How To Learn PHP Programming Beginners Guide
What does a Web developer have to know? W3Schools will answer this, and help you become a professional Web developer, well prepared for the future. For the beginner: Go to our Web Building Primer For the developer: Go to our Web Building Tutorial
Web Primer
Every Web developer has to know the building blocks of the Web:
How the WWW works The HTML language The use of CSS (style sheets) JavaScript programming The XML standards Server Scripting technologies Managing data with SQL
The Structured Query Language (SQL) is the common standard for accessing databases such as SQL Server, Oracle, Sybase, and Access. Any webmaster should know that SQL is the true engine for interacting with databases on the Web.
Web WWW
WWW Primer
What is the WWW? How does it work? What is a browser? What is a server?
WWW stands for the World Wide Web The World Wide Web is most often called the Web The Web is a network of computers all over the world All the computers in the Web can communicate with each other All the computers use a communication standard called HTTP
Web information is stored in documents called Web pages Web pages are files stored on computers called Web servers Computers reading the Web pages are called Web clients Web clients view the pages with a program called a Web browser Popular browsers are Internet Explorer and Mozilla Firefox
A request is a standard HTTP request containing a page address A page address looks like: http://www.someone.com/page.htm
All Web pages contain instructions on how to be displayed The browser displays the page by reading these instructions The most common display instructions are called HTML tags The HTML tag for a paragraph looks like this: </p> A paragraph in HTML is defined like this <p>This is a Paragraph</p>
The Web standards are not made up by Netscape or Microsoft The rule-making body of the Web is the W3C W3C stands for the World Wide Web Consortium W3C puts together specifications for Web standards The most essential Web standards are HTML, CSS and XML The latest HTML standard is XHTML 1.0
Web HTML
HTML Primer
What is an HTML File?
HTML stands for Hyper Text Markup Language An HTML file is a text file containing small markup tags The markup tags tell the Web browser how to display the page An HTML file must have an htm or html file extension An HTML file can be created using a simple text editor
If you are running Windows, start Notepad. If you are on a Mac, start SimpleText. In OSX start TextEdit and change the following preferences: Open the the "Format" menu and select "Plain text" instead of "Rich text". Then open the "Preferences" window under the "Text Edit" menu and select "Ignore rich text commands in HTML files". Your HTML code will probably not work if you do not change the preferences above! Type in the following text:
<html> <head> <title>Title of page</title> </head> <body> This is my first homepage. <b>This text is bold</b> </body> </html>
Save the file as "mypage.htm". Start your Internet browser. Select "Open" (or "Open Page") in the File menu of your browser. A dialog box will appear. Select "Browse" (or "Choose File") and locate the HTML file you just created "mypage.htm" - select it and click "Open". Now you should see an address in the dialog box, for example "C:\MyDocuments\mypage.htm". Click OK, and the browser will display the page.
Example Explained
The first tag in your HTML document is <html>. This tag tells your browser that this is the start of an HTML document. The last tag in your document is </html>. This tag tells your browser that this is the end of the HTML document. The text between the <head> tag and the </head> tag is header information. Header information is not displayed in the browser window. The text between the <title> tags is the title of your document. The title is displayed in your browser's caption. The text between the <body> tags is the text that will be displayed in your browser. The text between the <b> and </b> tags will be displayed in a bold font.
When you save an HTML file, you can use either the .htm or the .html extension. We have used .htm in our examples. It might be a bad habit inherited from the past when some of the commonly used software only allowed three letter extensions. With newer software we think it will be perfectly safe to use .html.
HTML Tutorials
Web CSS
CSS Primer
What is CSS?
CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles are normally stored in Style Sheets Styles were added to HTML 4 to solve a problem External Style Sheets can save you a lot of work External Style Sheets are stored in CSS files Internal and external style sheets will Cascade into one
CSS Demo
With CSS, your HTML documents can be displayed using different output styles: See how it works
To solve this problem, the World Wide Web Consortium (W3C) - the non profit, standard setting consortium, responsible for standardizing HTML - created STYLES in addition to HTML 4.0. All major browsers support Cascading Style Sheets.
CSS Tutorials
Study our CSS QuickStart Study our Complete CSS tutorial.
Web JavaScript
JavaScript Primer
An HTML file can contain text, HTML tags and scripts. Scripts in an HTML file can be executed by the browser.
What is JavaScript?
JavaScript is a scripting language A scripting language is a lightweight programming language A JavaScript is lines of executable computer code A JavaScript is usually embedded directly into HTML pages
JavaScript is used in millions of Web pages to improve the design, validate forms, detect browsers, create cookies, and much more. JavaScript is the most popular scripting language on the internet, and works in all major browsers.
Client-Side Scripting
JavaScript is about "programming" the behavior of the browser. This is called client-side scripting or browser scripting. Server-side scripting is about "programming" the behavior of the server (see Web Scripting chapter).
The HTML <script> tag is used to insert a JavaScript into an HTML page:
<html> <body> <script type="text/javascript"> document.write("Hello World!") </script> </body> </html>
The code above will produce this output: Hello World! Example Explained To insert a script in an HTML page, we use the <script> tag. The type attribute defines the scripting language:
<script type="text/javascript">
Then the JavaScript starts: The JavaScript command for writing some output to a page is document.write
document.write("Hello World!")
Try-It-Yourself Examples
Write text How to write text on a page. Write text with formatting How to format the text on your page with HTML tags.
JavaScript Tutorials
Study our JavaScript QuickStart Study our Complete JavaScript tutorial.
Web XML
XML Primer
XML was designed to describe data and to focus on what data is. HTML was designed to display data and to focus on how data looks.
What is XML?
XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to describe data XML tags are not predefined. You must define your own tags XML uses a Document Type Definition (DTD) or an XML Schema to describe the data XML with a DTD or XML Schema is designed to be self-descriptive XML is a W3C Recommendation
The note has a header and a message body. It also has sender and receiver information. But still, this XML document does not DO anything. It is just pure information wrapped in XML tags. Someone must write a piece of software to send, receive or display it.
We have been participating in XML development since its creation. It has been amazing to see how quickly the XML standard has been developed and how quickly a large number of software vendors have adopted the standard. We strongly believe that XML will be as important to the future of the Web as HTML has been to the foundation of the Web and that XML will be the most common tool for all data manipulation and data transmission.
XML Tutorial
Study our Complete XML Tutorial
Web Scripting
Server-side Scripting
Server-side scripting is about "programming" the behavior of the server. This is called server-side scripting or server scripting. Client-side scripting is about "programming" the behavior of the browser. (see Web JavaScript chapter).
Dynamically edit, change or add any content of a Web page Respond to user queries or data submitted from HTML forms Access any data or databases and return the results to a browser Customize a Web page to make it more useful for individual users Provide security since your server code cannot be viewed from the browser
Important: Because the scripts are executed on the server, the browser that displays the ASP file does not need to support scripting at all!
ASP Examples
Write text with ASP How to write text with ASP. Add some HTML to the text How to format the text with HTML tags.
Scripting Tutorials
Study our Complete ASP tutorial, or our Complete PHP tutorial.
Web SQL
SQL Primer
SQL is a standard computer language for accessing and manipulating databases.
What is SQL?
SQL stands for Structured Query Language SQL allows you to access a database SQL is an ANSI standard computer language SQL can execute queries against a database SQL can retrieve data from a database SQL can insert new records in a database SQL can delete records from a database SQL can update records in a database SQL is easy to learn
Note: Most of the SQL database programs also have their own proprietary extensions in addition to the SQL standard!
The table above contains three records (one for each person) and four columns (LastName, FirstName, Address, and City).
SQL Queries
With SQL, we can query a database and have a result set returned. A query like this:
SELECT LastName FROM Persons
Gives a result set like this: LastName Hansen Svendson Pettersen Note: Some database systems require a semicolon at the end of the SQL statement. We don't use the semicolon in our tutorials.
SELECT - extracts data from a database table UPDATE - updates data in a database table DELETE - deletes data from a database table INSERT INTO - inserts new data into a database table
CREATE TABLE - creates a new database table ALTER TABLE - alters (changes) a database table DROP TABLE - deletes a database table CREATE INDEX - creates an index (search key) DROP INDEX - deletes an index
SQL Tutorial
Study our Complete SQL tutorial.
Web Building
Every Web developer has to know the building blocks of the Web:
HTML 4.01 The use of CSS (style sheets) XHTML XML and XSLT Client side scripting Server side scripting Managing data with SQL
HTML 4.01
HTML is the language of the Web, and every Web developer should have a basic understanding of it. HTML 4.01 is an important Web standard. and very different from HTML 3.2. When tags like <font> and color attributes were added to HTML 3.2, it started a developer's nightmare. Development of web sites where font information must be added to every single Web page is a long and expensive pain. With HTML 4.01 all formatting can be moved out of the HTML document and into a separate style sheet. HTML 4.01 is also important because XHTML 1.0 (the latest HTML standard) is HTML 4.01 "reformulated" as an XML application. Using HTML 4.01 in your pages makes the future upgrade from HTML to XHTML a very simple process. Make sure you use the latest HTML 4.01 standard. Study our Complete HTML 4.01 reference.
XHTML is a reformulation of HTML 4.01 in XML and can be put to immediate use with existing browsers by following a few simple guidelines. To prepare for the future: Read how this site was converted to XHTML.
Client-Side Scripting
Client-side scripting is about "programming" the behavior of an Internet browser. To be able to deliver more dynamic web site content, you should teach yourself JavaScript:
JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages.
JavaScript can put dynamic text into an HTML page - A JavaScript statement like this: document.write("<h1>" + name + "</h1>") can write a variable text into an HTML page. JavaScript can react to events - A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element. JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element. JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server, this will save the server from extra processing.
Server-Side Scripting
Server-side scripting is about "programming" an Internet server. To be able to deliver more dynamic web site content, you should teach yourself server-side scripting. With server-side scripting, you can:
Dynamically edit, change, or add any content of a Web page Respond to user queries or data submitted from HTML forms Access any data or databases and return the results to a browser Access any files or XML data and return the results to a browser Transform XML data to HTML data and return the results to a browser Customize a Web page to make it more useful for individual users Provide security and access control to different Web pages Tailor your output to different types of browsers Minimize the network traffic
At W3Schools we demonstrate server-side scripting by using Active Server Pages (ASP) and PHP: Hypertext Preprocessor (PHP). Make sure you study our ASP tutorial or our PHP tutorial.
One important thing to know is that the functionality of Web Sites will change very drastically. We will see a huge shift from sites displaying "static content" to data driven sites delivering "dynamic content". We will also see a lot of new browsers, like the browsers found in mobile devices, and we will see a lot more use of XML to communicate data between servers, and between servers and browsers.
Web Design
Less Is More
Try to keep all sentences as short as possible. Try to keep your paragraphs as short as possible. Try to keep your chapters as short as possible. Try to keep your pages as short as possible. Use a lot of space between your paragraphs and chapters. Pages overloaded with text will kill your audience. Don't place too much content on a single page. If you have a lot to say, try to break your information into smaller chunks and place it on different pages. Don't expect any visitor to scroll all the way down to the bottom of a page with thousands of words.
Navigation
Try to create a navigation structure that is common for all the pages in your Web. Keep the use of hyperlinks inside your text paragraphs to a minimum. Don't use hyperlinks inside text paragraphs to send your visitors to every random page of your Web. That will destroy the feeling of a consistent navigation structure. If you must use hyperlinks, add them to the bottom of a paragraph or to the navigation menus of your site.
Download Speed
A common mistake made by many web designers is to develop a site on a local machine with direct access to the data, or to develop the site over a high-speed Internet connection. Sometimes developers are not aware of the fact that some of their pages take a long time to download. Internet usability studies tell us that most visitors will leave a Web page that takes more than 7 seconds to download. Before you publish any content heavy pages, make sure they are tested over a low-speed modem connection. If your pages take a long time to download, you might consider removing some of your graphic or multimedia content.
Web Users
Your users will use different hardware and software. The important thing is to KNOW YOUR AUDIENCE.
Some elements in your Web pages, like sound and video clips or other multimedia content, might require the use of separate programs (helper applications or plug-ins). Don't use such elements in your Web pages unless you are sure that your visitors have access to the software needed to view them.
Web Standards
Web Standards
Web Standards will help us fulfill the WWW dream. Web Standards make Web Development easier.
With its tremendous growth, the Web needs standards to realize its full potential. Web standards ensure that everyone has access to the same information. Future use of the Web, including applications that we only dream of today, will not be possible without world wide standards. Web standards also make site development faster and more enjoyable. Future Web sites will have to be coded according to standards to shorten both development and maintenance time. Developers should not have to struggle with several versions of code to accomplish the same result.
Other Considerations
When Web developers follow Web standards, web development teamwork is simplified, since it is easier for the developers to understand each other's coding. Some developers think that standards are the same as restrictions, and that taking advantage of nice browser-specific features will add credit to their work. But future adjustments to these Web pages will become more and more difficult as the variety of access methods increases. Following standards is your first step to solve this problem. Using only Web standards will help you to ensure that all browsers, old and new, will display your site properly, without frequent and time-consuming rewrites. Standardization can increase the access to your site. Does it make sense to limit your audience to only those with a particular browser? Standard Web documents are easier for search engines to access, and easier to index more accurately. Standard Web documents are easier to convert to other formats. Standard Web documents are easier to access with program code (like JavaScript and the DOM). Want to save yourself a lot of time? Make a habit of validating your pages with a validation service. Validation keeps your documents up to the standards and free of nasty errors.
Accessibility
Accessibility is an important part of the HTML standard. Standards make it easier for people with disabilities to use the Web. Blind people can use computers that read Web pages for them. People with poor sight can rearrange and magnify standard Web pages. Simple Web standards like HTML 4 and CSS, will make your Web pages much easier to understand by special devices like voice browsers, or other unusual output devices.
ECMA
The European Computer Manufacturers Association (ECMA) , based in Switzerland, was founded in 1961 in order to meet the need for standardizing computer languages and input/output codes. ECMA is not an official standardization institute, but an association of companies that collaborate with other official institutes like the International Organization for Standardization (ISO) and the European Telecommunications Standards Institute (ETSI). To Web developers, the most important standard is ECMAScript, the standardization of JavaScript. ECMAScript is a standardized scripting language to manipulate Web page objects specified by the W3C Document Object Model (DOM). With ECMAScript, DOM objects can then be added, deleted, or changed. The ECMAScript standard is based on Netscape's JavaScript and Microsoft's JScript. The latest ECMAScript specification is ECMA-262: http://www.ecma-international.org/publications/standards/ECMA-262.HTM
Web Validation
Web W3C
The World Wide Web Consortium (W3C) creates the WWW standards. W3C's mission is to lead the Web to its full potential, which it does by developing specifications, guidelines, software, and tools.
"The dream behind the Web is of a common information space in which we communicate by sharing information."
The World Wide Web Consortium (W3C), founded in 1994, is an international consortium dedicated to "lead the Web to its full potential". W3C Stands for the World Wide Web Consortium W3C was created in October 1994 W3C was created by Tim Berners-Lee W3C was created by the Inventor of the Web W3C is organized as a Member Organization W3C is working to Standardize the Web W3C creates and maintains WWW Standards W3C Standards are called W3C Recommendations The most important work done by the W3C is the development of Web specifications (called "Recommendations") that describe communication protocols (like HTML and XML) and other building blocks of the Web. As developers, especially when creating educational Web sites, we can help turn this dream into reality. The most important W3C standards are: HTML XHTML CSS XML XSL DOM You can read more about W3C in our W3C tutorial.
Web Security
Web Security
You are offering your IP address to the entire world at this very moment.
Make sure you are not offering access to your private data at the same time.
Internet Protocol TCP/IP If your setup allows NetBIOS over TCP/IP, you have a security problem: Your files can be shared all over the Internet Your logon-name, computer-name, and workgroup-name are visible to others. If your setup allows File and Printer Sharing over TCP/IP, you also have a problem: Your files can be shared all over the Internet Computers that are not connected to any network can also have dangerous network settings because the network settings were changed when Internet was installed.
Click OK You must also disable the TCP/IP Bindings to Client for Microsoft Networks and File and Printer Sharing: Open Windows Explorer Right-click on My Network Places Select: Properties Select: Internet Protocol TCP/IP Click on Properties Select the Bindings tab Uncheck: Client for Microsoft Networks Uncheck: File and Printer Sharing Click OK If you get a message with something like: "You must select a driver.........", ignore the message and click on YES to continue, and click OK to close the other setup windows. If you still want to share your Files and Printer over the network, you must use the NetBEUI protocol instead of the TCP/IP protocol. Make sure you have enabled it for your local network: Open Windows Explorer Right-click on My Network Places Select: Properties Select: NetBEUI Click on Properties Select the Bindings tab Check: Client for Microsoft Networks Check: File and Printer Sharing Click OK You should restart your computer after the changes.
iisPROTECTquota: All of the features of iisPROTECT plus: prevent concurrent logins and password cracking attempts, set quotas on hits, logins, kb per user. Read more about iisPROTECT.
Web Glossary
Web Glossary
This is an alphabetical list of Web Building Glossary Terms. Access (Microsoft Access) A database system developed by Microsoft. Part of Microsoft Office Professional. Mostly used on low traffic web sites running on the Windows platform. ActiveMovie A web technology for streaming movies from a web server to a web client. Developed by Microsoft. ActiveX A programming interface (API) that allows web browsers to download and execute Windows programs. (See also Plug-In) Address See Web Address. Anchor In web terms: The starting point or ending point of a hyperlink. Learn more about links in our HTML tutorial Anonymous FTP See FTP Server. ANSI (American National Standards Institute) An organization that creates standards for the computer industry. Responsible for the ANSI C standard. ANSI C An international standard for the C programming language. ADO (ActiveX Data Object) A Microsoft technology that provides data access to any kind of data store. Learn more about ADO in our ADO tutorial
ADSL (Asymmetric Digital Subscriber Line) A special type of DSL line where the upload speed is different from the download speed. Amaya An open source web browser editor from W3C, used to push leading-edge ideas in browser design. Animation A set of pictures simulating movement when played in series. Anti-Virus Program A computer program made to discover and destroy all types of computer viruses. Apache An open source web server. Mostly for Unix, Linux and Solaris platforms. Applet See web applet. Archie A computer program to locate files on public FTP servers. API (Application Programming Interface) An interface for letting a program communicate with another program. In web terms: An interface for letting web browsers or web servers communicate with other programs. (See also Active-X and PlugIn) ARPAnet The experimental network tested in the 1970's which started the development of the Internet. Authentication In web terms: the method used to verify the identity of a user, program or computer on the web. ASCII (American Standard Code for Information Interchange) A set of 128 alphanumeric and special control characters used for computer storing and printing of text. Used by HTML when transmitting data over the web. See the full list of ASCII codes in our HTML Reference ASF (Advanced Streaming Format) A multimedia streaming format. Developed by Microsoft for Windows Media. ASP (Active Server Pages) A Microsoft technology allowing the insertion of server executable scripts in web pages. Learn more about ASP in our ASP tutorial ASX (ASF Streaming Redirector) An XML format for storing information about ASF files. Developed by Microsoft for Windows Media.
AVI (Audio Video Interleave) File format for video files. Video compression technology developed by Microsoft. Banner Ad A (most often graphic) advertisement placed on a web page, which acts as a hyperlink to an advertiser's web site. Bandwidth A measure for the speed (amount of data) you can send through an Internet connection. The more bandwidth, the faster the connection. Baud The number of symbols per second sent over a channel. BBS (Bulletin Board System) A web based public system for sharing discussions, files, and announcements. Binary Data Data in machine readable form. Bit (Binary Digit) The smallest unit of data stored in a computer. A bit can have the value of 0 or 1. A computer uses 8 bits to store one text character. BMP (Bitmap) A format for storing images. Bookmark In web terms: A link to a particular web site, stored (bookmarked) by a web user for future use and easy access. Browse Term to describe a user's movement across the web, moving from page to page via hyperlinks, using a web browser. (See Web Browser). BPS (Bits Per Second) Term to describe the transmission speed for data over the web. Browser See Web Browser. Byte (Binary Term) A computer storage unit containing 8 bits. Each byte can store one text character. C An advanced programming language used for programming advanced computer applications.
C++ (C Plus Plus) The same as C with added object-oriented functions. C# (C Sharp) A Microsoft version of C++ with added Java-like functions. Case Sensitive A term used to describe if it is of importance to use upper or lower case letters. Cache In web terms: A web browser or web server feature which stores copies of web pages on a computer's hard disk. Chat An on-line text-based communication between Internet users. CGI (Common Gateway Interface) A set of rules that describes how a CGI program communicates with a web server. CGI Bin The folder (or directory) on a web server that stores CGI programs. CGI Program A small program that handles input and output from a web server. Often CGI programs are used for handling forms input or database queries. Cinepac A codec for computer video. Client See Web Client. Client/Server In web terms: The communication and separation of workload between a web client and a web server. Click In web terms: A mouse click on a hyperlink element (such as text or picture) on a web page which creates an event such as taking a visitor to another web page or another part of the same page. Clickthrough Rate The number of times visitors click on a hyperlink (or advertisement) on a page, as a percentage of the number of times the page has been displayed. Codec (Compressor / Decompressor) Common term for the technology used for compressing and decompressing data.
Communication Protocol A standard (language and a set of rules) to allow computers to interact in a standard way. Examples are IP, FTP, and HTTP. Learn more about Communication Protocols in our TCP/IP tutorial Compression A method of reducing the size (compress) of web documents or graphics for faster delivery via the web. Computer Virus A computer program that can harm a computer by displaying messages, deleting files, or even destroying the computer's operating system. Cookie Information from a web server, stored on your computer by your web browser. The purpose of a cookie is to provide information about your visit to the website for use by the server during a later visit. ColdFusion Web development software for most platforms (Linux, Unix, Solaris and Windows). CSS (Cascading Style Sheets) A W3C recommended language for defining style (such as font, size, color, spacing, etc.) for web documents. Learn more about CSS in our CSS tutorial Database Data stored in a computer in such a way that a computer program can easily retrieve and manipulate the data. Learn more about databases in our SQL tutorial Database System A computer program (like MS Access, Oracle, and MySQL) for manipulating data in a database. DB2 A database system from IBM. Mostly for Unix and Solaris platforms. DBA (Data Base Administrator) The person (or the software) who administers a database. Typical task are: backup, maintenance and implementation. DHCP (Dynamic Host Configuration Protocol) An Internet standard protocol that assigns new IP addresses to users as need.
DHTML (Dynamic HTML) A term commonly to describe HTML content that can change dynamically. Learn more about DHTML in our DHTML tutorial Dial-up Connection In web terms: A connection to Internet via telephone and modem. Discussion Group See Newsgroup. DNS (Domain Name Service) A computer program running on a web server, translating domain names into IP addresses. Learn more about DNS in our Web Hosting tutorial DNS Server A web server running DNS. DOM (Document Object Model) A programming model for web page objects. (See HTML DOM and XML DOM) Domain Name The name that identifies a web site. (like: W3Schools.com) Learn more about domains in our Web Hosting tutorial DOS (Disk Operating System) A general disk based computer operating system (see OS). Originally developed by Microsoft for IBM personal computers. Often used as a shorthand for MS-DOS. Download To transfer a file from a remote computer to a local computer. In web terms: to transfer a file from a web server to a web client. (see also Upload). DSL (Digital Subscriber Line) An Internet connection over regular telephone lines, but much faster. Speed may vary from 128 kilobit per second, up to 9 megabit per second. DTD (Document Type Definition) A set of rules (a language) for defining the legal building blocks of a web document like HTML or XML. Learn more about DTD in our DTD tutorial Dynamic IP An IP address that changes each time you connect to the Internet. (See DHCP and Static IP). E-mail (Electronic Mail) Messages sent from one person to another via the Internet.
E-mail Address The address used for sending e-mails to a person or an organization. Typical format is username@hostname. E-mail Server A web server dedicated to the task of serving e-mail. Encryption To convert data from its original form to a form that can only be read by someone that can reverse the encryption. The purpose of encryption is to prevent unauthorized reading of the data. Error See Web Server Error. Ethernet A type of local area network (see LAN). Firewall Software that acts as a security filter that can restrict types of network communication. Most often used between an individual computer (or a LAN) and the Internet. Flash A vector-based multimedia format developed by Macromedia for use on the web. Learn more about Flash in our Flash tutorial Form See HTML Form. Forum In web terms: The same as Newsgroup. Frame In web terms: A part of the browser screen displaying a particular content. Frames are often used to display content from different web pages. FrontPage Web development software for the Windows platform. Developed by Microsoft. FTP (File Transfer Protocol) One of the most common methods for sending files between two computers. FTP Server A web server you can logon to, and download files from (or upload files to). Anonymous FTP is a method for downloading files from an FTP server without using a logon account.
Gateway A computer program for transferring (and reformatting) data between incompatible applications or networks. GIF (Graphics Interchange Format) A compressed format for storing images developed by CompuServe. One of the most common image formats on the Internet. GB Same as Gigabyte. 10GB is ten gigabytes. Gigabyte 1024 megabytes. Commonly rounded down to one billion bytes. Graphics In web terms graphics describe pictures (opposite to text). Graphic Monitor A display monitor that can display graphics. Graphic Printer A printer that can print graphics. Graphical Banner See Banner Ad. Helper application In web terms: A program helping the browser to display, view, or work with files that the browser cannot handle itself. (See Plug-In). Hits The number of times a web object (page or picture) has been viewed or downloaded. (See also Page Hits). Home Page The top-level (main) page of a web site. The default page displayed when you visit a web site. Host See Web Host. Hosting See Web Hosting. Hotlink See Hyperlink.
Trojan Horse Computer program hidden in another computer program with the purpose of destroying software or collecting information about the use of the computer. HTML (Hypertext Markup Language) HTML is the language of the web. HTML is a set of tags that are used to define the content, layout and the formatting of the web document. Web browsers use the HTML tags to define how to display the text. Learn more about HTML in our HTML tutorial HTML Document A document written in HTML. HTML DOM (HTML Document Object Model) A programming interface for HTML documents. Learn more about HTML DOM in our HTML DOM tutorial HTML Editor A software program for editing HTML pages. With an HTML editor you can add elements like lists, tables, layout, font size, and colors to a HTML document like using a word processor. An HTML editor will display the page being edited exactly the same way it will be displayed on the web (See WYSIWYG). HTML Form A form that passes user input back to the server. Learn more about HTML forms in our HTML tutorial HTML Page The same as an HTML Document. HTML Tags Code to identify the different parts of a document so that a web browser will know how to display it. Learn more about HTML tags our HTML tutorial HTTP (Hyper Text Transfer Protocol) The standard set of rules for sending text files across the Internet. It requires an HTTP client program at one end, and an HTTP server program at the other end. HTTP Client A computer program that requests a service from a web server. HTTP Server A computer program providing services from a web server.
HTTPS (Hyper Text Transfer Protocol Secure) Same as HTTP but provides secure Internet communication using SSL. (see also SSL) Hyperlink A pointer to another document. Most often a pointer to another web page. A hyperlink is a synonym for a hotlink or a link, and sometimes called a hypertext connection to another document or web page. Hypermedia An extension to hypertext to include graphics and audio. Hypertext Hypertext is text that is cross-linked to other documents in such a way that the reader can read related documents by clicking on a highlighted word or symbol. (see also hyperlink) IAB (Internet Architecture Board) A council that makes decisions about Internet standards. (See also W3C). IE (Internet Explorer) See Internet Explorer. IETF (Internet Engineering Task Force) A subgroup of IAB that focuses on solving technical problems on the Internet. IIS (Internet Information Server) A web server for Windows operating systems. Developed by Microsoft. IMAP (Internet Message Access Protocol) A standard communication protocol for retrieving e-mails from an e-mail server. IMAP is much like POP but more advanced. Learn more about IMAP in our TCP/IP tutorial Indeo A codec for computer video developed by Intel. Internet A world wide network connecting millions of computers. (See also WWW) Internet Browser See Web Browser. Internet Explorer A browser by Microsoft. The most commonly used browser today. Learn more about browsers in our browser section Internet Server See Web Server
Intranet A private (closed) Internet, running inside a LAN (Local Area Network). IP (Internet Protocol) See TCP/IP. IP Address (Internet Protocol Address) A unique number identifying every computer on the Internet (like 197.123.22.240) IP Number (Internet Protocol Number) Same as an IP address. IP Packet See TCP/IP Packet. IRC (Internet Relay Chat) An Internet system that enables users to take part in on-line discussions. IRC Client A computer program that enables a user to connect to IRC. IRC Server An Internet server dedicated to the task of serving IRC connections. ISAPI (Internet Server API) Application Programming Interface (See API) for Internet Information Server (See IIS). ISDN (Integrated Services Digital Network) A telecommunication standard that uses digital transmission to support data communications over regular telephone lines. ISP (Internet Service Provider) Someone that provides access to the Internet and web hosting. Java A programming language developed by SUN. Mostly for programming web servers and web applets. Java Applet See Web Applet. JavaScript The most popular scripting language on the internet, developed by Netscape. Learn more about JavaScript in our JavaScript tutorial. JPEG (Joint Photographic Expert Group) The organization that promotes the JPG and JPEG graphic formats for storing compressed images. JPEG and JPG Graphic formats for storing compressed images.
JScript Microsoft's version of JavaScript. JSP (Java Server Pages) A Java based technology allowing the insertion of server executable scripts in web pages. Mostly used on Linux, Unix and Solaris platforms. K Same as kilobyte 10K is ten kilobytes.. KB Same as kilobyte 10KB is ten kilobytes.. Keyword In web terms: A word used by a search engine to search for relevant web information. In database terms: A word (or index) used to identify a database record. Kilobyte 1024 bytes. Often called 1K, and rounded down to 1000 bytes. LAN (Local Area Network) A network between computers in a local area (like inside a building), usually connected via local cables. See also WAN. Link The same as a hyperlink. Linux Open source computer operating system based on Unix. Mostly used on servers and web servers. Mail In web terms: the same as e-mail. Mail Server See e-mail server. MB Same as Megabyte. 10MB is ten megabytes. Megabyte 1024 kilobytes. Commonly rounded down to one million bytes. Meta Data Data that describes other data. (See also Meta Tags). Meta Search The method of searching for meta data in documents.
Meta Tags Tags inserted into documents to describe the document. Learn more about meta tags in our HTML tutorial MIDI (Musical Instrument Digital Interface) A standard protocol for communication between computers and musical instruments. Learn more about MIDI in our Media tutorial MIME (Multipurpose Internet Mail Extensions) An Internet standard for defining document types. MIME type examples: text/plain, text/html, image/gif, image/jpg. Learn more about MIME types in our Media tutorial MIME Types Document types defined by MIME. Modem Hardware equipment to connect a computer to a telephone network Typically used to connect to the Internet via a telephone line. Mosaic The first commonly available web browser. Mosaic was released in 1993 and started the popularity of the web. MOV A codec for computer video developed by Apple. Common file extension for QuickTime multimedia files. MP3 (MPEG-1 Audio Layer-3) An audio compression format specially designed for easy download over the Internet. MP3 File An file containing audio compressed with MP3. Most often a music track. MPEG (Moving Picture Expert Group) An ISO standard codec for computer audio and video. MPG Common file extension for MPEG files. MS-DOS (Microsoft Disk Operating System) A general disk based computer operating system (See OS). Originally developed by Microsoft for IBM computers, then developed by Microsoft as a basis for the first versions of Windows. Multimedia In web terms: A presentation combining text with pictures, video, or sound.
MySQL Free open source database software often used on the web. NetBEUI (Net Bios Extended User Interface) An enhanced version of NetBIOS. NetBIOS (Network Basic Input Output System) An application programming interface (API) with functions for local-area networks (LAN). Used by DOS and Windows. Navigate In web terms: The same as Browse. Netscape The browser from the company Netscape. The most popular browser for many years. Today IE has the lead. Learn more about browsers in our browser section Newsgroup An on-line discussion group (a section on a news server) dedicated to a particular subject of interest. News Reader A computer program that enables you to read (and post messages) from an Internet newsgroup. News Server An Internet server dedicated to the task of serving Internet newsgroups. Node In web terms: A computer connected to the Internet, most often used to describe a web server. Opera The browser from the company Opera. Learn more about browsers in our browser section OS (Operating System) The software that manages the basic operating of a computer. Packet See TCP/IP Packet. Page Hits The number of times a web page has been visited by a user. Page Impressions The same as Page Hits. Page Views The same as Page Hits.
PDF (Portable Document Format) A document file format developed by Adobe. Most often used for text documents. Perl (Practical Extraction and Reporting Language) A scripting language for web servers. Most often used on Unix servers. PHP (PHP: Hypertext Preprocessor) A technology allowing the insertion of server executable scripts in web pages. Mostly for Unix, Linux and Solaris platforms. Learn more about PHP in our PHP tutorial. Ping A method used to check the communication between two computers. A "ping" is sent to a remote computer to see if it responds. Platform In web terms: The computer's operating system like Windows, Linux, or OS X. Plug-In An application built into another application. In web terms: A program built in (or added) to a web browser to handle a special type of data like e-mail, sound, or movie files. (See also ActiveX) PNG (Portable Network Graphics) A format for encoding a picture pixel by pixel and sending it over the web. A W3C recommendation for replacing GIF. POP (Post Office Protocol) A standard communication protocol for retrieving e-mails from an e-mail server. (See also IMAP). Learn more about POP and IMAP in our TCP/IP tutorial Port A number that identifies a computer IO (input/output) channel. In web terms: A number that identifies the I/O channel used by an Internet application (A web server normally uses port 80). Protocol See Communication Protocol. PPP (Point to Point Protocol) A communication protocol used for direct connection between two computers. Proxy Server An Internet server dedicated to improve Internet performance. Router A hardware (or software) system that directs (routes) data transfer to different computers in a network.
QuickTime A multimedia file format created by Apple. Learn more about QuickTime in our Media tutorial RAID (Redundant Array of Independent Disks) A standard for connecting multiple disks to the same server for higher security, speed and performance. Often used on web servers. RDF (Resource Description Framework) A framework for constructing languages for describing web resources. Learn more about RDF in our RDF tutorial Real Audio A common multimedia audio format created by Real Networks. Learn more about Real Audio in our Media tutorial Real Video A common multimedia video format created by Real Networks. Learn more about Real Video in our Media tutorial Redirect In web terms: The action when a web page automatically forwards (redirects) the user to another web page. RGB (Red Green Blue) The combination of the three primary colors that can represent a full color spectrum. Learn more about RGB in our HTML tutorial Robot See Web Robot. Schema See XML Schema. Script A collection of statements written in a Scripting Language. Scripting Language In web terms: A simple programming language that can be executed by a web browser or a web server. See JavaScript and VBScript. Scripting Writing a script. Shareware Software that you can try free of charge, and pay a fee to continue to use legally.
Shockwave A format (technology) developed by Macromedia for embedding multimedia content in web pages. Search Engine Computer program used to search and catalog (index) the millions of pages of available information on the web. Common search engines are Google and AltaVista. Semantic Web A web of data with a meaning in the sense that computer programs can know enough about the data to process it. Server See Web Server. Server Errors See Web Server Errors. SGML (Standard Generalized Markup Language) An international standard for markup languages. The basis for HTML and XML. SMIL (Synchronized Multimedia Integration Language) A W3C recommended language for creating multimedia presentations. Learn more about SMIL in our SMIL tutorial SMTP (Simple Mail Transfer Protocol) A standard communication protocol for sending e-mail messages between computers. Learn more about SMTP in our TCP/IP tutorial SOAP (Simple Object Access Protocol) A standard protocol for letting applications communicate with each other using XML. Learn more about SOAP in our SOAP tutorial Solaris Computer operating system from SUN. SPAM In web terms: The action of sending multiple unwelcome messages to a newsgroup or mailing list. Spider See Web Spider. Spoofing Addressing a web page or an e-mail with a false referrer. Like sending an e-mail from a false address.
Spyware Computer software hidden in a computer with the purpose of collecting information about the use of the computer. SQL (Structured Query Language) An ANSI standard computer language for accessing and manipulating databases. Learn more about SQL in our SQL tutorial. SQL Server A database system from Microsoft. Mostly used on high traffic web sites running on the Windows platform. SSI (Server Side Include) A type of HTML comment inserted into a web page to instruct the web server to generate dynamic content. The most common use is to include standard header or footer for the page. SSL (Secure Socket Layer) Software to secure and protect web site communication using encrypted transmission of data. Static IP (address) An IP address that is the same each time connect to the Internet. (See also Dynamic IP). Streaming A method of sending audio and video files over the Internet in such a way that the user can view the file while it is being transferred. Streaming Format The format used for files being streamed over the Internet. (See Windows Media, Real Video and QuickTime). SVG (Scalable Vector Graphics) A W3C recommended language for defining graphics in XML. Learn more about SVG in our SVG tutorial Tag In web terms: Notifications or commands written into a web document. (See HTML Tags) TCP (Transmission Control Protocol) See TCP/IP. TCP/IP (Transmission Control Protocol / Internet Protocol) A collection of Internet communication protocols between two computers. The TCP protocol is responsible for an error free connection between two computers, while the IP protocol is responsible for the data packets sent over the network. Learn more about TCP/IP in our TCP/IP tutorial
TCP/IP Address See IP Address. TCP/IP Packet A "packet" of data sent over a TCP/IP network. (data sent over the Internet is broken down into small "packets" from 40 to 32000 bytes long). UDDI (Universal Description Discovery and Integration) A platform-independent framework for describing services, discovering businesses, and integrating business services using the Internet. Learn more about UDDI in our WSDL tutorial Unix Computer operating system, developed by Bell Laboratories. Mostly used for servers and web servers. UNZIP To uncompress a ZIPPED file. See ZIP. Upload To transfer a file from a local computer to a remote computer. In web terms: to transfer a file from a web client to a web server. (see also Download). URI (Uniform Resource Identifier) Term used to identify resources on the internet. URL is one type of an URI. URL (Uniform Resource Locator) A web address. The standard way to address web documents (pages) on the Internet (like: http://www.w3schools.com/) USENET A world wide news system accessible over the Internet. (See Newsgroups) User Agent The same as a Web Browser. VB (Visual Basic) See Visual Basic. VBScript A scripting language from Microsoft. VBScript is the default scripting language in ASP. Can also be used to program Internet Explorer. Learn more about VBScript in our VBScript tutorial. Virus Same as Computer Virus.
Visit In web terms: A visit to a web site. Commonly used to describe the activity for one visitor of a web site. Visitor In web terms: A visitor of a web site. Commonly used to describe a person visiting (viewing) a web site. Visual Basic A programming language from Microsoft. VPN (Virtual Private Network) A private network between two remote sites, over a secure encrypted virtual Internet connection (a tunnel). VRML (Virtual Reality Modeling Language) A programming language to allow 3D effects to be added to HTML documents. W3C (World Wide Web Consortium) The organization responsible for managing standards for the WWW. Learn more about W3C in our W3C tutorial WAN (Wide Area Network) Computers connected together in a wide network, larger than a LAN, usually connected via phone lines. See also LAN. WAP (Wireless Application Protocol) A leading standard for information services on wireless terminals like digital mobile phones. Learn more about WAP in our WAP tutorial Web Address The same as an URL or URI. See URL. Web Applet A program that can be downloaded over the web and run on the user's computer. Most often written in Java. Web Client A software program used to access web pages. Sometimes the same as a Web Browser, but often used as a broader term. Web Browser A software program used to display web pages. Learn more about browsers in our Browser section
Web Document A document formatted for distribution over the web. Most often a web document is formatted in a markup language like HTML or XML. Web Error See Web Server Error. Web Form See HTML Form. Web Host A web server that "hosts" web services like providing web site space to companies or individuals. Web Hosting The action of providing web host services. Web Page A document (normally an HTML file) designed to be distributed over the Web. Web Robot See Web Spider. Web Server A server is a computer that delivers services or information to other computers. In web terms: A server that delivers web content to web browsers. Web Server Error A message from a web server indicating an error. The most common web server error is "404 File Not Found". Learn more about web server error messages in our HTML tutorial Web Services Software components and applications running on web servers. The server provides these services to other computers, browsers or individuals, using standard communication protocols. Web Site A collection of related web pages belonging to a company or an individual. Web Spider A computer program that searches the Internet for web pages. Common web spiders are the one used by search engines like Google and AltaVista to index the web. Web spiders are also called web robots or wanderers. Web Wanderer See Web Spider.
Wildcard A character used to substitute any character(s). Most often used as an asterix (*) in search tools. Windows 2000, Windows NT, Windows 95/98, Windows XP Computer operating systems from Microsoft. Windows Media Audio and video formats for the Internet, developed by Microsoft. (See ASF, ASX, WMA and WMF). Learn more about Windows Media in our Media tutorial WINZIP A computer program for compressing and decompressing files. See ZIP. WMA Audio file format for the Internet, developed by Microsoft. (See also WMV). Learn more about media formats in our Media tutorial. WMV Video file format for the Internet, developed by Microsoft. (See also WMA). Learn more about media formats in our Media tutorial WML (Wireless Markup Language) A standard for information services on wireless terminals like digital mobile phones, inherited from HTML, but based on XML, and much stricter than HTML. Learn more about WML in our WAP tutorial WML Script Scripting language (programming language) for WML. Learn more about WMLScript in our WMLScript tutorial Worm A computer virus that can make copies of itself and spread to other computers over the Internet. WSDL (Web Services Description Language) An XML-based language for describing Web services and how to access them. Learn more about WSDL in our WSDL tutorial WWW (World Wide Web) A global network of computers using the internet to exchange web documents. (See also Internet) WWW Server The same as a Web Server. WYSIWYG (What You See Is What You Get) In Web terms: To display a web page being edited exactly the same way it will be displayed on the web.
XForms A future version of HTML Forms, based on XML and XHTML. Differs from HTML forms by separating data definition and data display. Providing richer and more device independent user input. Learn more about XForms in our XForms tutorial XHTML (Extensible Hypertext Markup Language) HTML reformulated as XML. XHTML is the latest version of HTML. Developed by W3C. Learn more about XHTML in our XHTML tutorial XPath XPath is a set of syntax rules (language) for defining parts of an XML document. XPath is a major part of the W3C XSL standard. Learn more about XPath in our XPath tutorial XQuery XQuery is a set of syntax rules (language) for extracting information from XML documents. XQuery builds on XPath. XQuery is developed by W3C. Learn more about XQuery in our XQuery tutorial XML (Extensible Markup Language) A simplified version of SGML especially designed for web documents, developed by the W3C. Learn more about XML in our XML tutorial XML Document A document written in XML. XML DOM (XML Document Object Model) A programming interface for XML documents developed by W3C. Learn more about XML DOM in our XML DOM tutorial XML Schema A document that describes, in a formal way, the syntax elements and parameters of a web language. Designed by W3C to replace DTD. Learn more about Schema in our XML Schema tutorial XSD (XML Schema Definition) The same as XML Schema. XSL (Extensible Stylesheet Language) A suite of XML languages developed by W3C, including XSLT, XSL-FO and XPath. Learn more about XSL in our XSL tutorial
XSL-FO (XSL Formatting Objects) An XML language for formatting XML documents. A part of XSL developed by W3C. Learn more about XSL-FO in our XSL-FO tutorial XSLT (XSL Transformations) An XML language for transforming XML documents. A part of XSL developed by W3C. Learn more about XSLT in our XSLT tutorial ZIP A compressing format for computer files. Commonly used for compressing files before downloading over the Internet. ZIP files can be compressed (ZIPPED) and decompressed (UNZIPPED) using a computer program like WINZIP.
Web Search
Google http://www.google.com/addurl.html Yahoo! http://docs.yahoo.com/info/suggest/ Altavista http://www.altavista.com/addurl/ AllTheWeb http://www.alltheweb.com/add_url.php Dmoz http://www.dmoz.org/help/submit.html Webcrawler http://www.webcrawler.com Dogpile http://www.dogpile.com MetaCrawler http://www.metacrawler.com LookSeek http://www.lookseek.com
Web Awards
Website Awards
Have you ever seen an award winning Web Site? Do you wonder how they got the award? This page will help you to understand, and maybe one day your page will receive an award...
Award Sites
TechSightings gives you weekly reviews of the Best High-Tech Sights on the Net. They review pages in different categories. If your site wins, you will receive a prize that you can add to your page. You can suggest your site or another site via an input form.
The DailyWebSite introduces websites that they find very useful and interesting. You can suggest your site or another site via an input form.
WebBuilder reviews Web Sites which you send them via e-mail. They also rate the award giving Web Site. WebbyAwards is the Internet's Oscar Prize. The awards are given once each year, in several categories. Each category has 2 winners, The Webby Award given by the judges, and the People's Voice award, given by the people. You can suggest your site as a nominee for the next year's award.
The GoldenWebAward Presented by The International Association of Web Masters and Designers. In Recognition for creativity, integrity and excellence. The Golden Web Award is a free service, presented to those sites whose web design and content have achieved levels of excellence deserving of recognition. You can suggest your site or another site via an input form.
The Webmaster Award is a special Internet award given only to those elite webmasters responsible for creating those websites that keep us up so late night after night. You can suggest your site or another site via an input form.
The Surfers Choice is a Best of the Web Portal specializing in content rich, high quality Websites. The goal is to provide you with a special service that will promote your site in a small, manageable database where surfers can find the best and most relevant sites. You can suggest your site via an input form. The Golden Crane Creativity Award (GCCA) is awarded to sites providing free instructional information in arts, crafts, music, and other creative activities. If you would like to nominate a site for this award, you can add the URL to their directory for review.
HTML Tutorial
HTML Tutorial
In this HTML tutorial you will learn how to use HTML to create your own Web site. HTML is very easy to learn!
HTML Examples
Learn by 100 examples! With our editor, you can edit HTML, and click on a test button to view the result. Try-It-Yourself!
HTML References
At W3Schools you will find complete HTML references about tags, attributes, colors, entities, and more. HTML 4.01 References
HTML Introduction
Introduction to HTML
HTML stands for Hyper Text Markup Language An HTML file is a text file containing small markup tags The markup tags tell the Web browser how to display the page An HTML file must have an htm or html file extension An HTML file can be created using a simple text editor
Save the file as "mypage.htm". Start your Internet browser. Select "Open" (or "Open Page") in the File menu of your browser. A dialog box will appear. Select "Browse" (or "Choose File") and locate the HTML file you just created "mypage.htm" - select it and click "Open". Now you should see an address in the dialog box, for example "C:\MyDocuments\mypage.htm". Click OK, and the browser will display the page.
Example Explained
The first tag in your HTML document is <html>. This tag tells your browser that this is the start of an HTML document. The last tag in your document is </html>. This tag tells your browser that this is the end of the HTML document. The text between the <head> tag and the </head> tag is header information. Header information is not displayed in the browser window. The text between the <title> tags is the title of your document. The title is displayed in your browser's caption. The text between the <body> tags is the text that will be displayed in your browser. The text between the <b> and </b> tags will be displayed in a bold font.
changed a page, the browser doesn't know that. Use the browser's refresh/reload button to force the browser to read the edited page. Q: What browser should I use? A: You can do all the training with all of the common browsers, like Internet Explorer, Mozilla, Netscape, or Opera. However, some of the examples in our advanced classes require the latest versions of the browsers. Q: Does my computer have to run Windows? What about a Mac? A: You can do all your training on a non-Windows computer like a Mac. However, some of the examples in our advanced classes require a newer version of Windows, like Windows 98 or Windows 2000.
HTML Elements
HTML Elements
HTML documents are text files made up of HTML elements. HTML elements are defined using HTML tags.
HTML Tags
HTML tags are used to mark-up HTML elements HTML tags are surrounded by the two characters < and > The surrounding characters are called angle brackets HTML tags normally come in pairs like <b> and </b> The first tag in a pair is the start tag, the second tag is the end tag The text between the start and end tags is the element content HTML tags are not case sensitive, <b> means the same as <B>
HTML Elements
Remember the HTML example from the previous page:
<html> <head> <title>Title of page</title>
</head> <body> This is my first homepage. <b>This text is bold</b> </body> </html>
The HTML element starts with a start tag: <b> The content of the HTML element is: This text is bold The HTML element ends with an end tag: </b> The purpose of the <b> tag is to define an HTML element that should be displayed as bold. This is also an HTML element:
<body> This is my first homepage. <b>This text is bold</b> </body>
This HTML element starts with the start tag <body>, and ends with the end tag </body>. The purpose of the <body> tag is to define the HTML element that contains the body of the HTML document.
Tag Attributes
Tags can have attributes. Attributes provide additional information to an HTML element. The following tag defines an HTML table: <table>. With an added border attribute, you can tell the browser that the table should have no borders: <table border="0"> Attributes always come in name/value pairs like this: name="value".
Attributes are always specified in the start tag of an HTML element. Attributes and attribute values are also case-insensitive. However, the World Wide Web Consortium (W3C) recommends lowercase attributes/attribute values in their HTML 4 recommendation, and XHTML demands lowercase attributes/attribute values.
Headings
Headings are defined with the <h1> to <h6> tags. <h1> defines the largest heading. <h6> defines the smallest heading.
<h1>This is a heading</h1> <h2>This is a heading</h2> <h3>This is a heading</h3> <h4>This is a heading</h4> <h5>This is a heading</h5> <h6>This is a heading</h6>
HTML automatically adds an extra blank line before and after a heading.
Paragraphs
Paragraphs are defined with the <p> tag.
<p>This is a paragraph</p> <p>This is another paragraph</p>
HTML automatically adds an extra blank line before and after a paragraph.
Line Breaks
The <br> tag is used when you want to end a line, but don't want to start a new paragraph. The <br> tag forces a line break wherever you place it.
<p>This <br> is a para<br>graph with line breaks</p>
Comments in HTML
The comment tag is used to insert a comment in the HTML source code. A comment will be ignored by the browser. You can use comments to explain your code, which can help you when you edit the source code at a later date.
<!-- This is a comment -->
Note that you need an exclamation point after the opening bracket, but not before the closing bracket.
More Examples
More paragraphs This example demonstrates some of the default behaviors of paragraph elements. Line breaks This example demonstrates the use of line breaks in an HTML document. Poem problems This example demonstrates some problems with HTML formatting. Headings This example demonstrates the tags that display headings in an HTML document. Center aligned heading This example demonstrates a center aligned heading. Horizontal rule This example demonstrates how to insert a horizontal rule. Hidden comments This example demonstrates how to insert a hidden comment in the HTML source code.
HTML Formatting
Examples
Text formatting This example demonstrates how you can format text in an HTML document. Preformatted text This example demonstrates how you can control the line breaks and spaces with the pre tag. "Computer output" tags This example demonstrates how different "computer output" tags will be displayed. Address This example demonstrates how to write an address in an HTML document. Abbreviations and acronyms This example demonstrates how to handle an abbreviation or an acronym.
Text direction This example demonstrates how to change the text direction. Quotations This example demonstrates how to handle long and short quotations. Deleted and inserted text This example demonstrates how to mark a text that is deleted or inserted to a document.
Defines a variable Defines preformatted text Deprecated. Use <pre> instead Deprecated. Use <pre> instead Deprecated. Use <pre> instead
HTML Entities
Character Entities
Some characters have a special meaning in HTML, like the less than sign (<) that defines the start of an HTML tag. If we want the browser to actually display these characters we must insert character entities in the HTML source. A character entity has three parts: an ampersand (&), an entity name or a # and an entity number, and finally a semicolon (;). To display a less than sign in an HTML document we must write: < or <
The advantage of using a name instead of a number is that a name is easier to remember. The disadvantage is that not all browsers support the newest entity names, while the support for entity numbers is very good in almost all browsers. Note that the entities are case sensitive. This example lets you experiment with character entities: Character Entities IE only
Non-breaking Space
The most common character entity in HTML is the non-breaking space. Normally HTML will truncate spaces in your text. If you write 10 spaces in your text HTML will remove 9 of them. To add spaces to your text, use the character entity.
To see a full list of HTML character entities go to our HTML Entities Reference.
HTML Links
HTML Links
HTML uses a hyperlink to link to another document on the Web.
Examples
Create hyperlinks This example demonstrates how to create links in an HTML document. An image as a link This example demonstrates how to use an image as a link. (You can find more examples at the bottom of this page)
The <a> tag is used to create an anchor to link from, the href attribute is used to address the document to link to, and the words between the open and close of the anchor tag will be displayed as a hyperlink. This anchor defines a link to W3Schools:
<a href="http://www.w3schools.com/">Visit W3Schools!</a>
The line above will look like this in a browser: Visit W3Schools!
The name attribute is used to create a named anchor. The name of the anchor can be any text you care to use. The line below defines a named anchor:
<a name="tips">Useful Tips Section</a>
You should notice that a named anchor is not displayed in a special way. To link directly to the "tips" section, add a # sign and the name of the anchor to the end of a URL, like this:
<a href="http://www.w3schools.com/html_links.asp#tips"> Jump to the Useful Tips Section</a>
A hyperlink to the Useful Tips Section from WITHIN the file "html_links.asp" will look like this:
<a href="#tips">Jump to the Useful Tips Section</a>
If a browser cannot find a named anchor that has been specified, it goes to the top of the document. No error occurs.
More Examples
Open a link in a new browser window This example demonstrates how to link to another page by opening a new window, so that the visitor does not have to leave your Web site. Link to a location on the same page This example demonstrates how to use a link to jump to another part of a document. Break out of a frame This example demonstrates how to break out of a frame, if your site is locked in a frame. Create a mailto link This example demonstrates how to link to a mail message (will only work if you have mail installed). Create a mailto link 2 This example demonstrates a more complicated mailto link.
Link Tags
Tag <a> Description Defines an anchor
HTML Frames
HTML Frames
With frames, you can display more than one Web page in the same browser window.
Examples
Vertical frameset This example demonstrates how to make a vertical frameset with three different documents. Horizontal frameset This example demonstrates how to make a horizontal frameset with three different documents. (You can find more examples at the bottom of this page)
Frames
With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and each frame is independent of the others. The disadvantages of using frames are:
The web developer must keep track of more HTML documents It is difficult to print the entire page
The <frameset> tag defines how to divide the window into frames Each frameset defines a set of rows or columns The values of the rows/columns indicate the amount of screen area each row/column will occupy
The <frame> tag defines what HTML document to put into each frame
In the example below we have a frameset with two columns. The first column is set to 25% of the width of the browser window. The second column is set to 75% of the width of the browser window. The HTML document "frame_a.htm" is put into the first column, and the HTML document "frame_b.htm" is put into the second column:
<frameset cols="25%,75%"> <frame src="frame_a.htm"> <frame src="frame_b.htm"> </frameset>
More Examples
How to use the <noframes> tag This example demonstrates how to use the <noframes> tag. Mixed frameset This example demonstrates how to make a frameset with three documents, and how to mix them in rows and columns. Frameset with noresize="noresize" This example demonstrates the noresize attribute. The frames are not resizable. Move the mouse over the borders between the frames and notice that you can not move the borders. Navigation frame This example demonstrates how to make a navigation frame. The navigation frame contains a list of links with the second frame as the target. The file called "tryhtml_contents.htm" contains three links. The source code of the links: <a href ="frame_a.htm" target ="showframe">Frame a</a><br> <a href ="frame_b.htm" target ="showframe">Frame b</a><br> <a href ="frame_c.htm" target ="showframe">Frame c</a> The second frame will show the linked document. Inline frame This example demonstrates how to create an inline frame (a frame inside an HTML page). Jump to a specified section within a frame This example demonstrates two frames. One of the frames has a source to a specified section in a file. The specified section is made with <a name="C10"> in the "link.htm" file.
Jump to a specified section with frame navigation This example demonstrates two frames. The navigation frame (content.htm) to the left contains a list of links with the second frame (link.htm) as a target. The second frame shows the linked document. One of the links in the navigation frame is linked to a specified section in the target file. The HTML code in the file "content.htm" looks like this: <a href ="link.htm" target ="showframe">Link without Anchor</a><br><a href ="link.htm#C10" target ="showframe">Link with Anchor</a>.
Frame Tags
Tag <frameset> <frame> <noframes> <iframe> Description Defines a set of frames Defines a sub window (a frame) Defines a noframe section for browsers that do not handle frames Defines an inline sub window (frame)
HTML Tables
HTML Tables
With HTML you can create tables.
Examples
Tables This example demonstrates how to create tables in an HTML document. Table borders This example demonstrates different table borders. (You can find more examples at the bottom of this page)
Tables
Tables are defined with the <table> tag. A table is divided into rows (with the <tr> tag), and each row is divided into data cells (with the <td> tag). The letters td stands for "table data," which is the content of a data cell. A data cell can contain text, images, lists, paragraphs, forms, horizontal rules, tables, etc.
<table border="1"> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr> </table>
How it looks in a browser: row 1, cell 1 row 1, cell 2 row 2, cell 1 row 2, cell 2
Headings in a Table
Headings in a table are defined with the <th> tag.
<table border="1">
<tr> <th>Heading</th> <th>Another Heading</th> </tr> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr> </table>
How it looks in a browser: Heading Another Heading row 1, cell 1 row 1, cell 2 row 2, cell 1 row 2, cell 2
How it looks in a browser: row 1, cell 1 row 1, cell 2 row 2, cell 1 Note that the borders around the empty table cell are missing (NB! Mozilla Firefox displays the border).
To avoid this, add a non-breaking space ( ) to empty data cells, to make the borders visible:
<table border="1"> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td> </td> </tr> </table>
More Examples
Table with no border This example demonstrates a table with no borders. Headings in a table This example demonstrates how to display table headers. Empty cells This example demonstrates how to use " " to handle cells that have no content. Table with a caption This example demonstrates a table with a caption. Table cells that span more than one row/column This example demonstrates how to define table cells that span more than one row or one column.
Tags inside a table This example demonstrates how to display elements inside other elements. Cell padding This example demonstrates how to use cellpadding to create more white space between the cell content and its borders. Cell spacing This example demonstrates how to use cellspacing to increase the distance between the cells. Add a background color or a background image to a table This example demonstrates how to add a background to a table. Add a background color or a background image to a table cell This example demonstrates how to add a background to one or more table cells. Align the content in a table cell This example demonstrates how to use the "align" attribute to align the content of cells, to create a "nice-looking" table. The frame attribute This example demonstrates how to use the "frame" attribute to control the borders around the table. The frame and border attributes How to use the "frame" and "border" attributes to control the borders around the table.
Table Tags
Tag <table> <th> <tr> <td> <caption> <colgroup> <col> <thead> <tbody> <tfoot> Description Defines a table Defines a table header Defines a table row Defines a table cell Defines a table caption Defines groups of table columns Defines the attribute values for one or more columns in a table Defines a table head Defines a table body Defines a table footer
HTML Lists
HTML Lists
HTML supports ordered, unordered and definition lists.
Examples
An unordered list This example demonstrates an unordered list. An ordered list This example demonstrates an ordered list. (You can find more examples at the bottom of this page)
Unordered Lists
An unordered list is a list of items. The list items are marked with bullets (typically small black circles). An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
<ul> <li>Coffee</li> <li>Milk</li> </ul>
Coffee Milk
Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.
Ordered Lists
An ordered list is also a list of items. The list items are marked with numbers. An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
<ol> <li>Coffee</li>
<li>Milk</li> </ol>
Here is how it looks in a browser: 1. Coffee 2. Milk Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.
Definition Lists
A definition list is not a list of items. This is a list of terms and explanation of the terms. A definition list starts with the <dl> tag. Each definition-list term starts with the <dt> tag. Each definition-list definition starts with the <dd> tag.
<dl> <dt>Coffee</dt> <dd>Black hot drink</dd> <dt>Milk</dt> <dd>White cold drink</dd> </dl>
Here is how it looks in a browser: Coffee Black hot drink Milk White cold drink Inside a definition-list definition (the <dd> tag) you can put paragraphs, line breaks, images, links, other lists, etc.
More Examples
Different types of ordered lists This example demonstrates different types of ordered lists. Different types of unordered Lists This example demonstrates different types of unordered lists. Nested list This example demonstrates how you can nest lists.
Nested list 2 This example demonstrates a more complicated nested list. Definition list This example demonstrates a definition list.
List Tags
Tag <ol> <ul> <li> <dl> <dt> <dd> <dir> <menu> Description Defines an ordered list Defines an unordered list Defines a list item Defines a definition list Defines a definition term Defines a definition description Deprecated. Use <ul> instead Deprecated. Use <ul> instead
HTML Forms
Examples
Text fields This example demonstrates how to create text fields on an HTML page. A user can write text in a text field. Password fields This example demonstrates how to create a password field on an HTML page. (You can find more examples at the bottom of this page)
Forms
A form is an area that can contain form elements. Form elements are elements that allow the user to enter information (like text fields, textarea fields, drop-down menus, radio buttons, checkboxes, etc.) in a form. A form is defined with the <form> tag.
<form> <input> <input> </form>
Input
The most used form tag is the <input> tag. The type of input is specified with the type attribute. The most commonly used input types are explained below.
Text Fields
Text fields are used when you want the user to type letters, numbers, etc. in a form.
<form> First name: <input type="text" name="firstname"> <br> Last name: <input type="text" name="lastname"> </form>
How it looks in a browser: First name: Last name: Note that the form itself is not visible. Also note that in most browsers, the width of the text field is 20 characters by default.
Radio Buttons
Radio Buttons are used when you want the user to select one of a limited number of choices.
<form> <input type="radio" name="sex" value="male"> Male <br> <input type="radio" name="sex" value="female"> Female </form>
How it looks in a browser: Male Female Note that only one option can be chosen.
Checkboxes
Checkboxes are used when you want the user to select one or more options of a limited number of choices.
<form> I have a bike: <input type="checkbox" name="vehicle" value="Bike" /> <br /> I have a car: <input type="checkbox" name="vehicle" value="Car" /> <br /> I have an airplane: <input type="checkbox" name="vehicle" value="Airplane" /> </form>
How it looks in a browser: Username: If you type some characters in the text field above, and click the "Submit" button, you will send your input to a page called "html_form_action.asp". That page will show you the received input.
Submit
More Examples
Checkboxes This example demonstrates how to create check-boxes on an HTML page. A user can select or unselect a checkbox. Radio buttons This example demonstrates how to create radio-buttons on an HTML page. Simple drop down box This example demonstrates how to create a simple drop-down box on an HTML page. A drop-down box is a selectable list. Another drop down box This example demonstrates how to create a simple drop-down box with a pre-selected value. Textarea This example demonstrates how to create a text-area (a multi-line text input control). A user can write text in the text-area. In a text-area you can write an unlimited number of characters. Create a button This example demonstrates how to create a button. On the button you can define your own text. Fieldset around data This example demonstrates how to draw a border with a caption around your data.
Form Examples
Form with input fields and a submit button This example demonstrates how to add a form to a page. The form contains two input fields and a submit button.
Form with checkboxes This form contains two checkboxes, and a submit button. Form with radio buttons This form contains two radio buttons, and a submit button. Send e-mail from a form This example demonstrates how to send e-mail from a form.
Form Tags
Tag <form> <input> <textarea> <label> <fieldset> <legend> <select> <optgroup> <option> <button> <isindex> Description Defines a form for user input Defines an input field Defines a text-area (a multi-line text input control) Defines a label to a control Defines a fieldset Defines a caption for a fieldset Defines a selectable list (a drop-down box) Defines an option group Defines an option in the drop-down box Defines a push button Deprecated. Use <input> instead
HTML Images
HTML Images
With HTML you can display images in a document.
Examples
Insert images This example demonstrates how to display images in your Web page.
Insert images from different locations This example demonstrates how to display images from another folder or another server in your Web page. (You can find more examples at the bottom of this page)
The URL points to the location where the image is stored. An image named "boat.gif" located in the directory "images" on "www.w3schools.com" has the URL: http://www.w3schools.com/images/boat.gif. The browser puts the image where the image tag occurs in the document. If you put an image tag between two paragraphs, the browser shows the first paragraph, then the image, and then the second paragraph.
The "alt" attribute tells the reader what he or she is missing on a page if the browser can't load images. The browser will then display the alternate text instead of the image. It is a good practice to include the "alt" attribute for each image on a page, to improve the display and usefulness of your document for people who have text-only browsers.
If an HTML file contains ten images - eleven files are required to display the page right. Loading images take time, so my best advice is: Use images carefully.
More Examples
Background image This example demonstrates how to add a background image to an HTML page. Aligning images This example demonstrates how to align an image within the text. Let the image float This example demonstrates how to let an image float to the left or right of a paragraph. Adjust images to different sizes This example demonstrates how to adjust images to different sizes. Display an alternate text for an image This example demonstrates how to display an alternate text for an image. The "alt" attribute tells the reader what he or she is missing on a page if the browser can't load images. It is a good practice to include the "alt" attribute for each image on a page. Make a hyperlink of an image This example demonstrates how to use an image as a link. Create an image map This example demonstrates how to create an image map, with clickable regions. Each of the regions is a hyperlink. Turn an image into an image map This example demonstrates how to turn an image into an image map. You will see that if you move the mouse over the image, the coordinates will be displayed on the status bar.
Image Tags
Tag <img> <map> <area> Description Defines an image Defines an image map Defines a clickable area inside an image map
HTML Background
HTML Backgrounds
A good background can make a Web site look really great.
Examples
Good background and text color An example of a background color and a text color that makes the text on the page easy to read. Bad background and text color An example of a background color and a text color that makes the text on the page difficult to read. (You can find more examples at the bottom of this page)
Backgrounds
The <body> tag has two attributes where you can specify backgrounds. The background can be a color or an image.
Bgcolor
The bgcolor attribute specifies a background-color for an HTML page. The value of this attribute can be a hexadecimal number, an RGB value, or a color name:
<body bgcolor="#000000"> <body bgcolor="rgb(0,0,0)"> <body bgcolor="black">
Background
The background attribute specifies a background-image for an HTML page. The value of this attribute is the URL of the image you want to use. If the image is smaller than the browser window, the image will repeat itself until it fills the entire browser window.
<body background="clouds.gif">
<body background="http://www.w3schools.com/clouds.gif">
The URL can be relative (as in the first line above) or absolute (as in the second line above). Note: If you want to use a background image, you should keep in mind:
Will the background image increase the loading time too much? Will the background image look good with other images on the page? Will the background image look good with the text colors on the page? Will the background image look good when it is repeated on the page? Will the background image take away the focus from the text?
More Examples
Good background image An example of a background image and a text color that makes the text on the page easy to read. Good background image 2 An example of a background image and a text color that makes the text on the page easy to read. Bad background image An example of a background image and a text color that makes the text on the page very difficult to read.
HTML Colors
HTML Colors
Colors are displayed combining RED, GREEN, and BLUE light sources.
Color Values
Colors are defined using a hexadecimal notation for the combination of Red, Green, and Blue color values (RGB). The lowest value that can be given to one light source is 0 (hex #00). The highest value is 255 (hex #FF). This table shows the result of combining Red, Green, and Blue light sources:. Color Color HEX #000000 #FF0000 #00FF00 #0000FF #FFFF00 #00FFFF #FF00FF #C0C0C0 #FFFFFF Color RGB rgb(0,0,0) rgb(255,0,0) rgb(0,255,0) rgb(0,0,255) rgb(255,255,0) rgb(0,255,255) rgb(255,0,255) rgb(192,192,192) rgb(255,255,255)
Color Names
A collection of 147 color names are supported by popular browsers. View the 147 color names
003300 006600 009900 00CC00 00FF00 330000 333300 336600 339900 33CC00 33FF00 660000 663300 666600 669900 66CC00 66FF00 990000 993300 996600 999900 99CC00 99FF00 CC0000 CC3300 CC6600 CC9900 CCCC00 CCFF00 FF0000 FF3300 FF6600 FF9900 FFCC00 FFFF00
003333 006633 009933 00CC33 00FF33 330033 333333 336633 339933 33CC33 33FF33 660033 663333 666633 669933 66CC33 66FF33 990033 993333 996633 999933 99CC33 99FF33 CC0033 CC3333 CC6633 CC9933 CCCC33 CCFF33 FF0033 FF3333 FF6633 FF9933 FFCC33 FFFF33
003366 006666 009966 00CC66 00FF66 330066 333366 336666 339966 33CC66 33FF66 660066 663366 666666 669966 66CC66 66FF66 990066 993366 996666 999966 99CC66 99FF66 CC0066 CC3366 CC6666 CC9966 CCCC66 CCFF66 FF0066 FF3366 FF6666 FF9966 FFCC66 FFFF66
003399 006699 009999 00CC99 00FF99 330099 333399 336699 339999 33CC99 33FF99 660099 663399 666699 669999 66CC99 66FF99 990099 993399 996699 999999 99CC99 99FF99 CC0099 CC3399 CC6699 CC9999 CCCC99 CCFF99 FF0099 FF3399 FF6699 FF9999 FFCC99 FFFF99
0033CC 0066CC 0099CC 00CCCC 00FFCC 3300CC 3333CC 3366CC 3399CC 33CCCC 33FFCC 6600CC 6633CC 6666CC 6699CC 66CCCC 66FFCC 9900CC 9933CC 9966CC 9999CC 99CCCC 99FFCC CC00CC CC33CC CC66CC CC99CC CCCCCC CCFFCC FF00CC FF33CC FF66CC FF99CC FFCCCC FFFFCC
0033FF 0066FF 0099FF 00CCFF 00FFFF 3300FF 3333FF 3366FF 3399FF 33CCFF 33FFFF 6600FF 6633FF 6666FF 6699FF 66CCFF 66FFFF 9900FF 9933FF 9966FF 9999FF 99CCFF 99FFFF CC00FF CC33FF CC66FF CC99FF CCCCFF CCFFFF FF00FF FF33FF FF66FF FF99FF FFCCFF FFFFFF
HTML Colorvalues
Color Values
HTML colors are defined using a hexadecimal notation for the combination of Red, Green, and Blue color values (RGB). The lowest value that can be given to one of the light sources is 0 (hex #00). The highest value is 255 (hex #FF).
Red Light
HEX #000000 #080000 #100000 #180000 #200000 #280000 #300000 #380000 #400000 #480000 #500000 #580000 #600000 #680000 #700000 #780000 #800000 #880000 #900000 #980000 #A00000 #A80000 #B00000 #B80000 #C00000 #C80000 #D00000 #D80000 #E00000 #E80000 #F00000 #F80000 #FF0000
RGB rgb(0,0,0) rgb(8,0,0) rgb(16,0,0) rgb(24,0,0) rgb(32,0,0) rgb(40,0,0) rgb(48,0,0) rgb(56,0,0) rgb(64,0,0) rgb(72,0,0) rgb(80,0,0) rgb(88,0,0) rgb(96,0,0) rgb(104,0,0) rgb(112,0,0) rgb(120,0,0) rgb(128,0,0) rgb(136,0,0) rgb(144,0,0) rgb(152,0,0) rgb(160,0,0) rgb(168,0,0) rgb(176,0,0) rgb(184,0,0) rgb(192,0,0) rgb(200,0,0) rgb(208,0,0) rgb(216,0,0) rgb(224,0,0) rgb(232,0,0) rgb(240,0,0) rgb(248,0,0) rgb(255,0,0)
Shades of Gray
Gray colors are displayed using an equal amount of power to all of the light sources. To make it easier for you to select the right gray color we have compiled a table of gray shades for you: RGB(0,0,0) #000000
RGB(8,8,8) RGB(16,16,16) RGB(24,24,24) RGB(32,32,32) RGB(40,40,40) RGB(48,48,48) RGB(56,56,56) RGB(64,64,64) RGB(72,72,72) RGB(80,80,80) RGB(88,88,88) RGB(96,96,96) RGB(104,104,104) RGB(112,112,112) RGB(120,120,120) RGB(128,128,128) RGB(136,136,136) RGB(144,144,144) RGB(152,152,152) RGB(160,160,160) RGB(168,168,168) RGB(176,176,176) RGB(184,184,184) RGB(192,192,192) RGB(200,200,200) RGB(208,208,208) RGB(216,216,216) RGB(224,224,224) RGB(232,232,232) RGB(240,240,240) RGB(248,248,248) RGB(255,255,255)
#080808 #101010 #181818 #202020 #282828 #303030 #383838 #404040 #484848 #505050 #585858 #606060 #686868 #707070 #787878 #808080 #888888 #909090 #989898 #A0A0A0 #A8A8A8 #B0B0B0 #B8B8B8 #C0C0C0 #C8C8C8 #D0D0D0 #D8D8D8 #E0E0E0 #E8E8E8 #F0F0F0 #F8F8F8 #FFFFFF
HTML Colornames
DarkSlateBlue DarkSlateGray DarkSlateGrey DarkTurquoise DarkViolet DeepPink DeepSkyBlue DimGray DimGrey DodgerBlue FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold GoldenRod Gray Grey Green GreenYellow HoneyDew HotPink IndianRed Indigo Ivory Khaki Lavender LavenderBlush LawnGreen LemonChiffon LightBlue LightCoral LightCyan LightGoldenRodYellow LightGray LightGrey LightGreen LightPink LightSalmon LightSeaGreen
#483D8B #2F4F4F #2F4F4F #00CED1 #9400D3 #FF1493 #00BFFF #696969 #696969 #1E90FF #B22222 #FFFAF0 #228B22 #FF00FF #DCDCDC #F8F8FF #FFD700 #DAA520 #808080 #808080 #008000 #ADFF2F #F0FFF0 #FF69B4 #CD5C5C #4B0082 #FFFFF0 #F0E68C #E6E6FA #FFF0F5 #7CFC00 #FFFACD #ADD8E6 #F08080 #E0FFFF #FAFAD2 #D3D3D3 #D3D3D3 #90EE90 #FFB6C1 #FFA07A #20B2AA
LightSkyBlue LightSlateGray LightSlateGrey LightSteelBlue LightYellow Lime LimeGreen Linen Magenta Maroon MediumAquaMarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed MidnightBlue MintCream MistyRose Moccasin NavajoWhite Navy OldLace Olive OliveDrab Orange OrangeRed Orchid PaleGoldenRod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip PeachPuff Peru Pink Plum PowderBlue Purple
#87CEFA #778899 #778899 #B0C4DE #FFFFE0 #00FF00 #32CD32 #FAF0E6 #FF00FF #800000 #66CDAA #0000CD #BA55D3 #9370D8 #3CB371 #7B68EE #00FA9A #48D1CC #C71585 #191970 #F5FFFA #FFE4E1 #FFE4B5 #FFDEAD #000080 #FDF5E6 #808000 #6B8E23 #FFA500 #FF4500 #DA70D6 #EEE8AA #98FB98 #AFEEEE #D87093 #FFEFD5 #FFDAB9 #CD853F #FFC0CB #DDA0DD #B0E0E6 #800080
Red RosyBrown RoyalBlue SaddleBrown Salmon SandyBrown SeaGreen SeaShell Sienna Silver SkyBlue SlateBlue SlateGray SlateGrey Snow SpringGreen SteelBlue Tan Teal Thistle Tomato Turquoise Violet Wheat White WhiteSmoke Yellow YellowGreen
#FF0000 #BC8F8F #4169E1 #8B4513 #FA8072 #F4A460 #2E8B57 #FFF5EE #A0522D #C0C0C0 #87CEEB #6A5ACD #708090 #708090 #FFFAFA #00FF7F #4682B4 #D2B48C #008080 #D8BFD8 #FF6347 #40E0D0 #EE82EE #F5DEB3 #FFFFFF #F5F5F5 #FFFF00 #9ACD32
<html> <head> <title>Document name goes here</title> </head> <body> Visible text goes here </body> </html>
Heading Elements
<h1>Largest Heading</h1> <h2> . . . </h2> <h3> . . . </h3> <h4> . . . </h4> <h5> . . . </h5> <h6>Smallest Heading</h6>
Text Elements
<p>This is a paragraph</p> <br> (line break) <hr> (horizontal rule) <pre>This text is preformatted</pre>
Logical Styles
<em>This text is emphasized</em> <strong>This text is strong</strong> <code>This is some computer code</code>
Physical Styles
<b>This text is bold</b> <i>This text is italic</i>
A named anchor: <a name="tips">Useful Tips Section</a> <a href="#tips">Jump to the Useful Tips Section</a>
Unordered list
<ul> <li>First item</li> <li>Next item</li> </ul>
Ordered list
<ol> <li>First item</li> <li>Next item</li> </ol>
Definition list
<dl> <dt>First term</dt> <dd>Definition</dd> <dt>Next term</dt> <dd>Definition</dd> </dl>
Tables
<table border="1"> <tr> <th>someheader</th> <th>someheader</th> </tr> <tr> <td>sometext</td> <td>sometext</td> </tr> </table>
Frames
Forms
<form action="http://www.example.com/test.asp" method="post/get"> <input type="text" name="lastname" value="Nixon" size="30" maxlength="50"> <input type="password"> <input type="checkbox" checked="checked"> <input type="radio" checked="checked"> <input type="submit"> <input type="reset"> <input type="hidden"> <select> <option>Apples <option selected>Bananas <option>Cherries </select> <textarea name="Comment" rows="60" cols="20"></textarea> </form>
Entities
< is the same as < > is the same as > © is the same as
Other Elements
<!-- This is a comment --> <blockquote> Text quoted from some source. </blockquote>
HTML Layout
Everywhere on the Web you will find pages that are formatted like newspaper pages using HTML columns.
A part of this page is formatted with two columns, like a newspaper page. As you can see at this page, there is a left column and a right column.
This text is displayed in the right column. The trick is to use a table without borders, and maybe a little extra cell-padding. No matter how much text you add to this page, it will stay inside its column borders.
Examples
Dividing a part of an HTML page into table columns is very easy to do. To let you experiment with it, we have put together this simple example.
HTML Fonts
HTML Fonts
The <font> tag in HTML is deprecated. It is supposed to be removed in a future version of HTML. Even if a lot of people are using it, you should try to avoid it, and use styles instead.
</p>
Try it yourself
Font Attributes
Attribute size="number" size="+number" size="-number" face="face-name" color="color-value" color="color-name" Example size="2" size="+1" size="-1" face="Times" color="#eeff00" color="red" Purpose Defines the font size Increases the font size Decreases the font size Defines the font-name Defines the font color Defines the font color
First off: Finish the last chapters in our HTML tutorial !!! In the following chapters we will explain why some tags, like <font>, are to be removed from the HTML recommendations, and how to insert a style sheet in an HTML document. To learn more about style sheets: Study our CSS Tutorial.
Do not use deprecated tags. Visit our complete HTML 4.01 Reference to see which tags and attributes that are deprecated.
The HTML 4.01 Transitional DTD includes everything in the strict DTD plus deprecated elements and attributes:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
The HTML 4.01 Frameset DTD includes everything in the transitional DTD plus frames as well:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
HTML Styles
HTML Styles
With HTML 4.0 all formatting can be moved out of the HTML document and into a separate style sheet.
Examples
Styles in HTML This example demonstrates how to format an HTML document with style information added to the <head> section. Link that is not underlined This example demonstrates how to make a link that is not underlined, using a style attribute. Link to an external style sheet This example demonstrates how to use the <link> tag to link to an external style sheet.
Inline Styles
An inline style should be used when a unique style is to be applied to a single occurrence of an element. To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example shows how to change the color and the left margin of a paragraph:
<p style="color: red; margin-left: 20px"> This is a paragraph </p>
Style Tags
Tag <style> <link> <div> <span> <font> <basefont> <center> Description Defines a style definition Defines a resource reference Defines a section in a document Defines a section in a document Deprecated. Use styles instead Deprecated. Use styles instead Deprecated. Use styles instead
HTML Head
HTML Head
Examples
The title of a document The title information inside a head element is not displayed in the browser window. One target for all links This example demonstrates how to use the base tag to let all the links on a page open in a new window.
Display the text because it is inside a paragraph element Hide the text because it is inside a head element
If you put an HTML element like <h1> or <p> inside a head element like this, most browsers will display it, even if it is illegal. Should browsers forgive you for errors like this? We don't think so. Others do.
Head Tags
Tag <head> <title> <base> <link> <meta> Tag <!DOCTYPE> Description Defines information about the document Defines the document title Defines a base URL for all the links on a page Defines a resource reference Defines meta information Description Defines the document type. This tag goes before the <html> start tag.
HTML Meta
HTML Meta
Examples
Document description Information inside a meta element describes the document. Document keywords Information inside a meta element describes the document's keywords. Redirect a user This example demonstrates how to redirect a user if your site address has changed.
As we explained in the previous chapter, the head element contains general information (metainformation) about a document. HTML also includes a meta element that goes inside the head element. The purpose of the meta element is to provide meta-information about the document. Most often the meta element is used to provide information that is relevant to browsers or search engines like describing the content of your document. Note: W3C states that "Some user agents support the use of META to refresh the current page after
a specified number of seconds, with the option of replacing it by a different URI. Authors should not use this technique to forward users to different pages, as this makes the page inaccessible to some users. Instead, automatic page forwarding should be done using server-side redirects" at
http://www.w3.org/TR/html4/struct/global.html#adef-http-equiv.
You can see a complete list of the meta element attributes in our Complete HTML 4.01 Tag Reference.
HTML URLs
URL Schemes
Some examples of the most common schemes can be found below: Schemes file ftp http gopher news telnet WAIS Access a file on your local PC a file on an FTP server a file on a World Wide Web Server a file on a Gopher server a Usenet newsgroup a Telnet connection a file on a WAIS server
Accessing a Newsgroup
The following HTML code: <a href="news:alt.html">HTML Newsgroup</a> creates a link to a newsgroup like this HTML Newsgroup.
HTML Scripts
HTML Scripts
Add scripts to HTML pages to make them more dynamic and interactive.
Examples
Insert a script This example demonstrates how to insert a script into your HTML document. Work with browsers that do not support scripts This example demonstrates how to handle browsers that do not support scripting.
The script above will produce this output: Hello World! Note: To learn more about scripting in HTML, visit our JavaScript School.
A browser that does not recognize the <script> tag at all, will display the <script> tag's content as text on the page. To prevent the browser from doing this, you should hide the script in comment tags. An old browser (that does not recognize the <script> tag) will ignore the comment and it will not write the tag's content on the page, while a new browser will understand that the script should be executed, even if it is surrounded by comment tags.
Example
JavaScript: <script type="text/javascript"> <!-document.write("Hello World!") //--> </script> VBScript: <script type="text/vbscript"> <!-document.write("Hello World!") '--> </script>
Example
JavaScript: <script type="text/javascript"> <!-document.write("Hello World!") //--> </script>
<noscript>Your browser does not support JavaScript!</noscript> VBScript: <script type="text/vbscript"> <!-document.write("Hello World!") '--> </script> <noscript>Your browser does not support VBScript!</noscript>
Script Tags
Tag <script> <noscript> <object> <param> <applet> Description Defines a script Defines an alternate text if the script is not executed Defines an embedded object Defines run-time settings (parameters) for an object Deprecated. Use <object> instead
HTML Attributes
Core Attributes
Not valid in base, head, html, meta, param, script, style, and title elements. Attribute class id Value class_rule or style_rule id_name Description The class of the element A unique id for the element
style title
style_definition tooltip_text
Language Attributes
Not valid in base, br, frame, frameset, hr, iframe, param, and script elements. Attribute dir lang Value ltr | rtl language_code Description Sets the text direction Sets the language code
Keyboard Attributes
Attribute accesskey tabindex Value character number Description Sets a keyboard shortcut to access an element Sets the tab order of an element
HTML Events
Window Events
Only valid in body and frameset elements. Attribute onload Value script Description Script to be run when a document loads
onunload
script
Keyboard Events
Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements. Attribute onkeydown onkeypress onkeyup Value script script script Description What to do when key is pressed What to do when key is pressed and released What to do when key is released
Mouse Events
Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, title elements. Attribute onclick ondblclick onmousedown onmousemove onmouseout onmouseover onmouseup Value script script script script script script script Description What to do on a mouse click What to do on a mouse double-click What to do when mouse button is pressed What to do when mouse pointer moves What to do when mouse pointer moves out of an element What to do when mouse pointer moves over an element What to do when mouse button is released
HTML URL-encode
Try It
Type some text or an ASCII value in the input field below, and click on the "URL Encode" button to see the URL-encoding.
This is a text
URL Encode
c return
%0b %0c %0d %0e %0f %10 %11 %12 %13 %14 %15 %16 %17 %18 %19 %1a %1b %1c %1d %1e %1f %20 %21 %22 %23 %24 %25 %26 %27 %28 %29 %2a %2b %2c %2d %2e %2f
; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _
%3b %3c %3d %3e %3f %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %4a %4b %4c %4d %4e %4f %50 %51 %52 %53 %54 %55 %56 %57 %58 %59 %5a %5b %5c %5d %5e %5f
k l m n o p q r s t u v w x y z { | } ~
%6b %6c %6d %6e %6f %70 %71 %72 %73 %74 %75 %76 %77 %78 %79 %7a %7b %7c %7d %7e %7f %80 %81 %82 %83 %84 %85 %86 %87 %88 %89 %8a %8b %8c %8d %8e %8f
%91 %92 %93 %94 %95 %96 %97 %98 %99 %9a %9b %9c %9d %9e %9f %a0 %a1 %a2 %a3 %a4 %a5 %a6 %a7 %a8 %a9 %aa %ab %ac %ad %ae %af %b0 %b1 %b2 %b3 %b4 %b5 %b6 %b7 %b8 %b9 %ba
%c1 %c2 %c3 %c4 %c5 %c6 %c7 %c8 %c9 %ca %cb %cc %cd %ce %cf %d0 %d1 %d2 %d3 %d4 %d5 %d6 %d7 %d8 %d9 %da %db %dc %dd %de %df %e0 %e1 %e2 %e3 %e4 %e5 %e6 %e7 %e8 %e9 %ea
%f1 %f2 %f3 %f4 %f5 %f6 %f7 %f8 %f9 %fa %fb %fc %fd %fe %ff
HTML Webserver
If you want other people to view your pages, you must publish them. To publish your work, you have to copy your files to a web server. Your own PC can act as a web server if it is connected to a network. If you are running Windows 98, you can use the PWS (Personal Web Server). PWS is hiding in the PWS folder in your Windows CD.
Browse your Windows installation to see if you have installed PWS. If not, install PWS from the PWS directory on your Windows CD. Follow the instructions and get your Personal Web Server up and running.
Read more about Microsoft's Personal Web Server. Note: Microsoft Windows XP Home Edition does not come with the option to turn your computer into a PWS!
If you do not want to use PWS or IIS, you must upload your files to a public server. Most Internet Service Providers (ISP's) will offer to host your web pages. If your employer has an Internet Server, you can ask him to host your Web site. If you are really serious about this, you should install your own Internet Server.
Before you select an ISP, make sure you read W3Schools Web Hosting Tutorial !!
HTML Summary
The next step is to learn XHTML and CSS. XHTML XHTML is the "new" HTML. The latest HTML recommendation is HTML 4.01. This is the last and final HTML version. HTML will be replaced by XHTML, which is a stricter and cleaner version of HTML. If you want to learn more about XHTML, please visit our XHTML tutorial. CSS CSS is used to control the style and layout of multiple Web pages all at once. With CSS, all formatting can be removed from the HTML document and stored in a separate file. CSS gives you total control of the layout, without messing up the document content. To learn how to create style sheets, please visit our CSS tutorial.
HTML Examples
HTML Basic Tags Examples A very simple HTML document How text inside paragraphs is displayed More paragraphs The use of line breaks Poem problems (some problems with HTML formatting) Heading tags Center aligned heading Insert a horizontal rule Comments in the HTML source Add a background color Examples explained HTML Formatting Text Examples Text formatting Preformatted text (how to control line breaks and spaces)
Different computer-output tags Insert an address Abbreviations and acronyms Text direction Long and short quotations How to mark deleted and inserted text Examples explained HTML Link Examples How to create hyperlinks Set an image as a link Open a link in a new browser window Jump to another part of a document (on the same page) Break out of a frame How to link to a mail message (will only work if you have mail installed) A more complicated mailto link Examples explained HTML Frame Examples How to create a vertical frameset with 3 different documents How to create a horizontal frameset with 3 different documents How to use the <noframes> tag How to mix a frameset in rows and columns Frameset with noresize="noresize" How to create a navigation frame Inline frame (a frame inside an HTML page) Jump to a specified section within a frame Jump to a specified section with frame navigation Examples explained HTML Table Examples Simple tables Different table borders Table with no borders Headings in a table
Empty cells Table with a caption Table cells that span more than one row/column Tags inside a table Cell padding (control the white space between cell content and the borders Cell spacing (control the distance between cells) Add a background color or a background image to a table Add a background color or a background image to a table cell Align the content in a table cell The frame attribute The frame and border attributes Examples explained HTML List Examples An unordered list An ordered list Different types of ordered lists Different types of unordered Lists Nested list Nested list 2 Definition list Examples explained HTML Form and Input Examples How to create input fields Password fields Checkboxes Radiobuttons Simple drop-down box (a selectable list) Another drop-down box with a pre-selected value Textarea (a multi-line text input field) Create a button Draw a border with a caption around data Form with an input field and a submit button Form with checkboxes and a submit button
Form with radiobuttons and a submit button Send e-mail from a form Examples explained HTML Image Examples Insert images Insert images from another folder or another server Background image Align an image within a text Let the image float to the left/right of a paragraph Adjust images to different sizes Display an alternate text for an image (if the browser can't load images) Make a hyperlink of an image Create an image-map, with clickable regions Turn an image into an image map Examples explained HTML Background Examples Good background and text color Bad background and text color Good background image Good background image 2 Bad background image Examples explained HTML Style Examples Styles in the head section of an HTML document Link that is not underlined Link to an external style sheet Examples explained HTML <head> Examples Set a title of a document One target for all links on a page Examples explained
HTML <meta> Examples Document description Document keywords Redirect a user to another URL Examples explained HTML Script Examples Insert a script Handle browsers that do not support scripts Examples explained
HTML Quiz HTML Exam References HTML Tag List HTML and XHTML Full References HTML by Alphabet
NN: indicates the earliest version of Netscape that supports the tag IE: indicates the earliest version of Internet Explorer that supports the tag DTD: indicates in which XHTML 1.0 DTD the tag is allowed. S=Strict, T=Transitional, and F=Frameset Description Defines a comment Defines the document type Defines an anchor Defines an abbreviation Defines an acronym Defines an address element Deprecated. Defines an applet Defines an area inside an image map NN 3.0 3.0 6.2 6.2 4.0 2.0 3.0 IE DTD 3.0 STF STF 3.0 STF STF 4.0 STF 4.0 STF 3.0 TF 3.0 STF
<b> <base> <basefont> <bdo> <big> <blockquote> <body> <br> <button> <caption> <center> <cite> <code> <col> <colgroup> <dd> <del> <dir> <div> <dfn> <dl> <dt> <em> <fieldset> <font> <form> <frame> <frameset> <h1> to <h6> <head> <hr> <html> <i> <iframe> <img> <input> <ins> <isindex> <kbd> <label> <legend> <li>
Defines bold text Defines a base URL for all the links in a page Deprecated. Defines a base font Defines the direction of text display Defines big text Defines a long quotation Defines the body element Inserts a single line break Defines a push button Defines a table caption Deprecated. Defines centered text Defines a citation Defines computer code text Defines attributes for table columns Defines groups of table columns Defines a definition description Defines deleted text Deprecated. Defines a directory list Defines a section in a document Defines a definition term Defines a definition list Defines a definition term Defines emphasized text Defines a fieldset Deprecated. Defines text font, size, and color Defines a form Defines a sub window (a frame) Defines a set of frames Defines header 1 to header 6 Defines information about the document Defines a horizontal rule Defines an html document Defines italic text Defines an inline sub window (frame) Defines an image Defines an input field Defines inserted text Deprecated. Defines a single-line input field Defines keyboard text Defines a label for a form control Defines a title in a fieldset Defines a list item
3.0 3.0 3.0 6.2 3.0 3.0 3.0 3.0 6.2 3.0 3.0 3.0 3.0
3.0 6.2 3.0 3.0 3.0 3.0 3.0 6.2 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 6.0 3.0 3.0 6.2 3.0 3.0 6.2 6.2 3.0
3.0 3.0 3.0 5.0 3.0 3.0 3.0 3.0 4.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 4.0 3.0 3.0 3.0 3.0 3.0 3.0 4.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 4.0 3.0 3.0 4.0 3.0 3.0 4.0 4.0 3.0
STF STF TF STF STF STF STF STF STF STF TF STF STF STF STF STF STF TF STF STF STF STF STF STF TF STF F F STF STF STF STF STF TF STF STF STF TF STF STF STF STF
<link> <map> <menu> <meta> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <param> <pre> <q> <s> <samp> <script> <select> <small> <span> <strike> <strong> <style> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <title> <tr> <tt> <u> <ul> <var> <xmp>
Defines a resource reference Defines an image map Deprecated. Defines a menu list Defines meta information Defines a noframe section Defines a noscript section Defines an embedded object Defines an ordered list Defines an option group Defines an option in a drop-down list Defines a paragraph Defines a parameter for an object Defines preformatted text Defines a short quotation Deprecated. Defines strikethrough text Defines sample computer code Defines a script Defines a selectable list Defines small text Defines a section in a document Deprecated. Defines strikethrough text Defines strong text Defines a style definition Defines subscripted text Defines superscripted text Defines a table Defines a table body Defines a table cell Defines a text area Defines a table footer Defines a table header Defines a table header Defines the document title Defines a table row Defines teletype text Deprecated. Defines underlined text Defines an unordered list Defines a variable Deprecated. Defines preformatted text
4.0 3.0 3.0 3.0 3.0 3.0 3.0 6.0 3.0 3.0 3.0 3.0 6.2 3.0 3.0 3.0 3.0 3.0 4.0 3.0 3.0 4.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0
3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 6.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 4.0 3.0 3.0 4.0 3.0 4.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0
STF STF TF STF TF STF STF STF STF STF STF STF STF STF TF STF STF STF STF STF TF STF STF STF STF STF STF STF STF STF STF STF STF STF STF TF STF STF
HTML by Function
NN: indicates the earliest version of Netscape that supports the tag IE: indicates the earliest version of Internet Explorer that supports the tag DTD: indicates in which XHTML 1.0 DTD the tag is allowed. S=Strict, T=Transitional, and F=Frameset Purpose NN IE DTD
Start tag Basic Tags <!DOCTYPE> <html> <body> <h1> to <h6> <p> <br> <hr> <!--...--> Char Format <b> <font> <i> <em> <big> <strong> <small> <sup> <sub> <bdo> <u> Output <pre> <code> <tt> <kbd>
Defines the document type Defines an html document Defines the body element Defines header 1 to header 6 Defines a paragraph Inserts a single line break Defines a horizontal rule Defines a comment
Defines bold text Deprecated. Defines text font, size, and color Defines italic text Defines emphasized text Defines big text Defines strong text Defines small text Defines superscripted text Defines subscripted text Defines the direction of text display Deprecated. Defines underlined text
3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 6.2 3.0
3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 5.0 3.0
Defines preformatted text Defines computer code text Defines teletype text Defines keyboard text
<var> <dfn> <samp> <xmp> Blocks <acronym> <abbr> <address> <blockquote> <center> <q> <cite> <ins> <del> <s> <strike> Links <a> <link> Frames <frame> <frameset> <noframes> <iframe> Input <form> <input> <textarea> <button> <select> <optgroup> <option> <label> <fieldset> <legend> <isindex> Lists
Defines a variable Defines a definition term Defines sample computer code Deprecated. Defines preformatted text
Defines an acronym Defines an abbreviation Defines an address element Defines a long quotation Deprecated. Defines centered text Defines a short quotation Defines a citation Defines inserted text Defines deleted text Deprecated. Defines strikethrough text Deprecated. Defines strikethrough text
6.2 6.2 4.0 3.0 3.0 6.2 3.0 6.2 6.2 3.0 3.0
4.0 STF STF 4.0 STF 3.0 STF 3.0 TF 4.0 STF 3.0 STF 4.0 STF 4.0 STF 3.0 TF 3.0 TF
3.0 4.0
Defines a sub window (a frame) Defines a set of frames Defines a noframe section Defines an inline sub window (frame)
F F TF TF
Defines a form Defines an input field Defines a text area Defines a push button Defines a selectable list Defines an option group Defines an item in a list box Defines a label for a form control Defines a fieldset Defines a title in a fieldset Deprecated. Defines a single-line input field
3.0 3.0 3.0 6.2 3.0 6.0 3.0 6.2 6.2 6.2 3.0
3.0 3.0 3.0 4.0 3.0 6.0 3.0 4.0 4.0 4.0 3.0
STF STF STF STF STF STF STF STF STF STF TF
<ul> <ol> <li> <dir> <dl> <dt> <dd> <menu> Images <img> <map> <area> Tables <table> <caption> <th> <tr> <td> <thead> <tbody> <tfoot> <col> <colgroup> Styles <style> <div> <span> Meta Info <head> <title> <meta> <base> <basefont> Programming <script> <noscript> <applet>
Defines an unordered list Defines an ordered list Defines a list item Deprecated. Defines a directory list Defines a definition list Defines a definition term Defines a definition description Deprecated. Defines a menu list
Defines an image Defines an image map Defines an area inside an image map
Defines a table Defines a table caption Defines a table header Defines a table row Defines a table cell Defines a table header Defines a table body Defines a table footer Defines attributes for table columns Defines groups of table columns
3.0 3.0 3.0 3.0 3.0 4.0 4.0 4.0 3.0 3.0
STF STF STF STF STF STF STF STF STF STF
Defines information about the document Defines the document title Defines meta information Defines a base URL for all the links in a page Deprecated. Defines a base font
<object> <param>
3.0
HTML Attributes
Core Attributes
Not valid in base, head, html, meta, param, script, style, and title elements. Attribute class id style title Value class_rule or style_rule id_name style_definition tooltip_text Description The class of the element A unique id for the element An inline style definition A text to display in a tool tip
Language Attributes
Not valid in base, br, frame, frameset, hr, iframe, param, and script elements. Attribute dir lang Value ltr | rtl language_code Description Sets the text direction Sets the language code
Keyboard Attributes
Attribute accesskey tabindex Value character number Description Sets a keyboard shortcut to access an element Sets the tab order of an element
HTML Events
Window Events
Only valid in body and frameset elements Attribute onload onunload Value script script Description Script to be run when a document loads Script to be run when a document unloads
Keyboard Events
Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements. Attribute onkeydown onkeypress onkeyup Value script script script Description What to do when key is pressed What to do when key is pressed and released What to do when key is released
Mouse Events
Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements. Attribute onclick ondblclick onmousedown onmousemove onmouseover onmouseout onmouseup Value script script script script script script script Description What to do on a mouse click What to do on a mouse doubleclick What to do when mouse button is pressed What to do when mouse pointer moves What to do when mouse pointer moves over an element What to do when mouse pointer moves out of an element What to do when mouse button is released
HTML Colornames
Color Name AliceBlue AntiqueWhite Aqua Aquamarine Azure Beige Bisque Black BlanchedAlmond Blue BlueViolet Brown BurlyWood CadetBlue Chartreuse Chocolate Coral CornflowerBlue Cornsilk Crimson Cyan DarkBlue DarkCyan DarkGoldenRod DarkGray DarkGrey DarkGreen DarkKhaki DarkMagenta DarkOliveGreen Darkorange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkSlateGrey DarkTurquoise DarkViolet DeepPink
Color HEX #F0F8FF #FAEBD7 #00FFFF #7FFFD4 #F0FFFF #F5F5DC #FFE4C4 #000000 #FFEBCD #0000FF #8A2BE2 #A52A2A #DEB887 #5F9EA0 #7FFF00 #D2691E #FF7F50 #6495ED #FFF8DC #DC143C #00FFFF #00008B #008B8B #B8860B #A9A9A9 #A9A9A9 #006400 #BDB76B #8B008B #556B2F #FF8C00 #9932CC #8B0000 #E9967A #8FBC8F #483D8B #2F4F4F #2F4F4F #00CED1 #9400D3 #FF1493
Color
DeepSkyBlue DimGray DimGrey DodgerBlue FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold GoldenRod Gray Grey Green GreenYellow HoneyDew HotPink IndianRed Indigo Ivory Khaki Lavender LavenderBlush LawnGreen LemonChiffon LightBlue LightCoral LightCyan LightGoldenRodYellow LightGray LightGrey LightGreen LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSlateGrey LightSteelBlue LightYellow Lime
#00BFFF #696969 #696969 #1E90FF #B22222 #FFFAF0 #228B22 #FF00FF #DCDCDC #F8F8FF #FFD700 #DAA520 #808080 #808080 #008000 #ADFF2F #F0FFF0 #FF69B4 #CD5C5C #4B0082 #FFFFF0 #F0E68C #E6E6FA #FFF0F5 #7CFC00 #FFFACD #ADD8E6 #F08080 #E0FFFF #FAFAD2 #D3D3D3 #D3D3D3 #90EE90 #FFB6C1 #FFA07A #20B2AA #87CEFA #778899 #778899 #B0C4DE #FFFFE0 #00FF00
LimeGreen Linen Magenta Maroon MediumAquaMarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed MidnightBlue MintCream MistyRose Moccasin NavajoWhite Navy OldLace Olive OliveDrab Orange OrangeRed Orchid PaleGoldenRod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip PeachPuff Peru Pink Plum PowderBlue Purple Red RosyBrown RoyalBlue SaddleBrown Salmon SandyBrown
#32CD32 #FAF0E6 #FF00FF #800000 #66CDAA #0000CD #BA55D3 #9370D8 #3CB371 #7B68EE #00FA9A #48D1CC #C71585 #191970 #F5FFFA #FFE4E1 #FFE4B5 #FFDEAD #000080 #FDF5E6 #808000 #6B8E23 #FFA500 #FF4500 #DA70D6 #EEE8AA #98FB98 #AFEEEE #D87093 #FFEFD5 #FFDAB9 #CD853F #FFC0CB #DDA0DD #B0E0E6 #800080 #FF0000 #BC8F8F #4169E1 #8B4513 #FA8072 #F4A460
SeaGreen SeaShell Sienna Silver SkyBlue SlateBlue SlateGray SlateGrey Snow SpringGreen SteelBlue Tan Teal Thistle Tomato Turquoise Violet Wheat White WhiteSmoke Yellow YellowGreen
#2E8B57 #FFF5EE #A0522D #C0C0C0 #87CEEB #6A5ACD #708090 #708090 #FFFAFA #00FF7F #4682B4 #D2B48C #008080 #D8BFD8 #FF6347 #40E0D0 #EE82EE #F5DEB3 #FFFFFF #F5F5F5 #FFFF00 #9ACD32
HTML ASCII
dollar sign percent sign ampersand apostrophe left parenthesis right parenthesis asterisk plus sign comma hyphen period slash digit 0 digit 1 digit 2 digit 3 digit 4 digit 5 digit 6 digit 7 digit 8 digit 9 colon semicolon less-than equals-to greater-than question mark at sign uppercase A uppercase B uppercase C uppercase D uppercase E uppercase F uppercase G uppercase H uppercase I uppercase J uppercase K uppercase L uppercase M
$ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w
uppercase N uppercase O uppercase P uppercase Q uppercase R uppercase S uppercase T uppercase U uppercase V uppercase W uppercase X uppercase Y uppercase Z left square bracket backslash right square bracket caret underscore grave accent lowercase a lowercase b lowercase c lowercase d lowercase e lowercase f lowercase g lowercase h lowercase i lowercase j lowercase k lowercase l lowercase m lowercase n lowercase o lowercase p lowercase q lowercase r lowercase s lowercase t lowercase u lowercase v lowercase w
N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w
x y z { | } ~
lowercase x lowercase y lowercase z left curly brace vertical bar right curly brace tilde
FS GS RS US DEL
file separator group separator record separator unit separator delete (rubout)
HTML Entities
spacing diaeresis copyright feminine ordinal indicator angle quotation mark (left) negation soft hyphen registered trademark trademark spacing macron degree plus-or-minus superscript 2 superscript 3 spacing acute micro paragraph middle dot spacing cedilla superscript 1 masculine ordinal indicator angle quotation mark (right) fraction 1/4 fraction 1/2 fraction 3/4 inverted question mark multiplication division
¨ © ª « ¬ ­ ® ™ ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ × ÷
¨ © ª « ¬ ­ ® ™ ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ × ÷
capital e, circumflex accent capital e, umlaut mark capital i, grave accent capital i, acute accent capital i, circumflex accent capital i, umlaut mark capital eth, Icelandic capital n, tilde capital o, grave accent capital o, acute accent capital o, circumflex accent capital o, tilde capital o, umlaut mark capital o, slash capital u, grave accent capital u, acute accent capital u, circumflex accent capital u, umlaut mark capital y, acute accent capital THORN, Icelandic small sharp s, German small a, grave accent small a, acute accent small a, circumflex accent small a, tilde small a, umlaut mark small a, ring small ae small c, cedilla small e, grave accent small e, acute accent small e, circumflex accent small e, umlaut mark small i, grave accent small i, acute accent small i, circumflex accent small i, umlaut mark small eth, Icelandic small n, tilde small o, grave accent small o, acute accent small o, circumflex accent
Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô
Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô
small o, tilde small o, umlaut mark small o, slash small u, grave accent small u, acute accent small u, circumflex accent small u, umlaut mark small y, acute accent small thorn, Icelandic small y, umlaut mark
õ ö ø ù ú û ü ý þ ÿ
õ ö ø ù ú û ü ý þ ÿ
› €
› €
Try It
Type some text or an ASCII value in the input field below, and click on the "URL Encode" button to see the URL-encoding.
This is a text
URL Encode
c return
%08 %09 %0a %0b %0c %0d %0e %0f %10 %11 %12 %13 %14 %15 %16 %17 %18 %19 %1a %1b %1c %1d %1e %1f %20 %21 %22 %23 %24 %25 %26 %27 %28 %29 %2a %2b %2c %2d %2e %2f
8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _
%38 %39 %3a %3b %3c %3d %3e %3f %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %4a %4b %4c %4d %4e %4f %50 %51 %52 %53 %54 %55 %56 %57 %58 %59 %5a %5b %5c %5d %5e %5f
h i j k l m n o p q r s t u v w x y z { | } ~
%68 %69 %6a %6b %6c %6d %6e %6f %70 %71 %72 %73 %74 %75 %76 %77 %78 %79 %7a %7b %7c %7d %7e %7f %80 %81 %82 %83 %84 %85 %86 %87 %88 %89 %8a %8b %8c %8d %8e %8f
ASCII Value |
URL-encode %90 %91 %92 %93 %94 %95 %96 %97 %98 %99 %9a %9b %9c %9d %9e %9f %a0 %a1 %a2 %a3 %a4 %a5 %a6 %a7 %a8 %a9 %aa %ab %ac %ad %ae %af %b0 %b1 %b2 %b3 %b4 %b5 %b6 %b7 %b8
ASCII Value
URL-encode %c0 %c1 %c2 %c3 %c4 %c5 %c6 %c7 %c8 %c9 %ca %cb %cc %cd %ce %cf %d0 %d1 %d2 %d3 %d4 %d5 %d6 %d7 %d8 %d9 %da %db %dc %dd %de %df %e0 %e1 %e2 %e3 %e4 %e5 %e6 %e7 %e8
ASCII Value
URL-encode %f0 %f1 %f2 %f3 %f4 %f5 %f6 %f7 %f8 %f9 %fa %fb %fc %fd %fe %ff
HTTP Messages
101 Switching Protocols 2xx: Successful Message: 200 OK 201 Created 202 Accepted 203 Non-authoritative Information 204 No Content 205 Reset Content 206 Partial Content 3xx: Redirection Message: 300 Multiple Choices 301 Moved Permanently
Description: The request is OK The request is complete, and a new resource is created The request is accepted for processing, but the processing is not complete
Description: A link list. The user can select a link and go to that location. Maximum five addresses The requested page has moved to a new url
302 Found 303 See Other 304 Not Modified 305 Use Proxy 306 Unused 307 Temporary Redirect 4xx: Client Error Message: 400 Bad Request 401 Unauthorized 402 Payment Required 403 Forbidden 404 Not Found 405 Method Not Allowed 406 Not Acceptable 407 Proxy Authentication Required 408 Request Timeout 409 Conflict 410 Gone 411 Length Required 412 Precondition Failed 413 Request Entity Too Large 414 Request-url Too Long
The requested page has moved temporarily to a new url The requested page can be found under a different url
This code was used in a previous version. It is no longer used, but the code is reserved The requested page has moved temporarily to a new url
Description: The server did not understand the request The requested page needs a username and a password You can not use this code yet Access is forbidden to the requested page The server can not find the requested page The method specified in the request is not allowed The server can only generate a response that is not accepted by the client You must authenticate with a proxy server before this request can be served The request took longer than the server was prepared to wait The request could not be completed because of a conflict The requested page is no longer available The "Content-Length" is not defined. The server will not accept the request without it The precondition given in the request evaluated to false by the server The server will not accept the request, because the request entity is too large The server will not accept the request, because the url is too long. Occurs when you convert a "post" request to a "get" request with a long query information The server will not accept the request, because the media type is not supported
415 Unsupported Media Type 416 417 Expectation Failed 5xx: Server Error Message: 500 Internal Server Error
Description: The request was not completed. The server met an unexpected condition
501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout 505 HTTP Version Not Supported
The request was not completed. The server did not support the functionality required The request was not completed. The server received an invalid response from the upstream server The request was not completed. The server is temporarily overloading or down The gateway has timed out The server does not support the "http protocol" version
XHTML Tutorial
XHTML Tutorial
XHTML is a stricter and cleaner version of HTML. In this tutorial you will learn the difference between HTML and XHTML. We will also show you how this Web site was converted to XHTML. Start learning XHTML!
W3Schools' Online Certification Program is the perfect solution for busy professionals who need to balance work, family, and career building. The HTML Developer Certificate is for developers who want to document their knowledge of HTML 4.01, XHTML, and CSS. HTML Developer Certificate!
XHTML References
Our complete XHTML 1.0 reference is an alphabetical list of all XHTML tags with lots of examples and tips. XHTML 1.0 Reference
Table Of Contents
Introduction to XHTML This chapter gives a brief introduction to XHTML and explains what XHTML is. XHTML - Why? This chapter explains why we needed a new language like XHTML. Differences between XHTML and HTML This chapter explains the main differences in syntax between XHTML and HTML. XHTML Syntax This chapter explains the basic syntax of XHTML. XHTML DTD This chapter explains the three different XHTML Document Type Definitions. XHTML HowTo This chapter explains how this web site was converted from HTML to XHTML. XHTML Validation This chapter explains how to validate XHTML documents. XHTML Modules This chapter explains the modularization of XHTML. XHTML Summary This chapter contains a summary on what you have learned in this tutorial and a recommendation on what subject you should study next.
XHTML References
XHTML 1.0 Reference Our complete XHTML 1.0 reference is an alphabetical list of all XHTML tags with lots of examples and tips. XHTML 1.0 Standard Attributes All the tags have attributes. The attributes for each tag are listed in the examples in the "XHTML 1.0 Reference" page. The attributes listed here are the core and language attributes all the tags has as standard (with few exceptions). This reference describes the attributes, and shows possible values for each. XHTML 1.0 Event Attributes All the standard event attributes of the tags. This reference describes the attributes, and shows possible values for each.
XHTML Introduction
Introduction To XHTML
XHTML is a stricter and cleaner version of HTML.
If you want to study HTML first, please read our HTML tutorial.
What Is XHTML?
XHTML stands for EXtensible HyperText Markup Language XHTML is aimed to replace HTML XHTML is almost identical to HTML 4.01 XHTML is a stricter and cleaner version of HTML
Why you should use XHTML The syntax of XHTML How W3Schools was converted to XHTML XHTML validation XHTML modularization
XHTML Why
XHTML - Why?
XHTML is a combination of HTML and XML (EXtensible Markup Language). XHTML consists of all the elements in HTML 4.01 combined with the syntax of XML.
Why XHTML?
We have reached a point where many pages on the WWW contain "bad" HTML. The following HTML code will work fine if you view it in a browser, even if it does not follow the HTML rules:
<html> <head> <title>This is bad HTML</title> <body> <h1>Bad HTML </body>
XML is a markup language where everything has to be marked up correctly, which results in "wellformed" documents. XML was designed to describe data and HTML was designed to display data. Today's market consists of different browser technologies, some browsers run Internet on computers, and some browsers run Internet on mobile phones and hand helds. The last-mentioned do not have the resources or power to interpret a "bad" markup language. Therefore - by combining HTML and XML, and their strengths, we got a markup language that is useful now and in the future - XHTML. XHTML pages can be read by all XML enabled devices AND while waiting for the rest of the world to upgrade to XML supported browsers, XHTML gives you the opportunity to write "well-formed" documents now, that work in all browsers and that are backward browser compatible !!!
XHTML v HTML
You can prepare yourself for XHTML by starting to write strict HTML.
XHTML elements must be properly nested XHTML elements must always be closed XHTML elements must be in lowercase XHTML documents must have one root element
In XHTML, all elements must be properly nested within each other, like this:
<b><i>This text is bold and italic</i></b>
Note: A common mistake with nested lists, is to forget that the inside list must be within <li> and </li> tags. This is wrong:
<ul> <li>Coffee</li> <li>Tea <ul> <li>Black tea</li> <li>Green tea</li> </ul>
<li>Milk</li> </ul>
This is correct:
<ul> <li>Coffee</li> <li>Tea <ul> <li>Black tea</li> <li>Green tea</li> </ul> </li> <li>Milk</li> </ul>
Notice that we have inserted a </li> tag after the </ul> tag in the "correct" code example.
This is correct:
<p>This is a paragraph</p> <p>This is another paragraph</p>
This is correct:
A break: <br />
A horizontal rule: <hr /> An image: <img src="happy.gif" alt="Happy face" />
This is correct:
<body> <p>This is a paragraph</p> </body>
XHTML Syntax
XHTML Syntax
Writing XHTML demands a clean HTML syntax.
Attribute names must be in lower case Attribute values must be quoted Attribute minimization is forbidden The id attribute replaces the name attribute The XHTML DTD defines mandatory elements
This is correct:
<table width="100%">
This is correct:
<table width="100%">
This is correct:
<input checked="checked" /> <input readonly="readonly" />
Here is a list of the minimized attributes in HTML and how they should be written in XHTML: HTML compact checked declare readonly disabled selected defer ismap nohref noshade nowrap multiple noresize XHTML compact="compact" checked="checked" declare="declare" readonly="readonly" disabled="disabled" selected="selected" defer="defer" ismap="ismap" nohref="nohref" noshade="noshade" nowrap="nowrap" multiple="multiple" noresize="noresize"
This is correct:
<img src="picture.gif" id="picture1" />
Note: To interoperate with older browsers for a while, you should use both name and id, with identical attribute values, like this:
<img src="picture.gif" id="picture1" name="picture1" />
IMPORTANT Compatibility Note: To make your XHTML compatible with today's browsers, you should add an extra space before the "/" symbol.
The lang attribute applies to almost every XHTML element. It specifies the language of the content within an element. If you use the lang attribute in an element, you must add the xml:lang attribute, like this:
<div lang="no" xml:lang="no">Heia Norge!</div>
Note: The DOCTYPE declaration is not a part of the XHTML document itself. It is not an XHTML element, and it should not have a closing tag. Note: The xmlns attribute inside the <html> tag is required in XHTML. However, the validator on w3.org does not complain when this attribute is missing in an XHTML document. This is because "xmlns=http://www.w3.org/1999/xhtml" is a fixed value and will be added to the <html> tag even if you do not include it. You will learn more about the XHTML document type definition in the next chapter.
XHTML DTD
XHTML DTD
The XHTML standard defines three Document Type Definitions. The most common is the XHTML Transitional.
<!DOCTYPE> Is Mandatory
An XHTML document consists of three main parts:
The DOCTYPE declaration should always be the first line in an XHTML document.
An XHTML Example
This is a simple (minimal) XHTML document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>simple document</title> </head> <body> <p>a simple paragraph</p> </body> </html>
<head> <title>simple document</title> </head> <body> <p>a simple paragraph</p> </body> </html>
DTD specifies the syntax of a web page in SGML. DTD is used by SGML applications, such as HTML, to specify rules that apply to the markup of documents of a particular type, including a set of element and entity declarations. XHTML is specified in an SGML document type definition or 'DTD'. An XHTML DTD describes in precise, computer-readable language, the allowed syntax and grammar of XHTML markup.
XHTML 1.0 specifies three XML document types that correspond to three DTDs: Strict, Transitional, and Frameset.
Use this when you want really clean markup, free of presentational clutter. Use this together with Cascading Style Sheets.
Use this when you need to take advantage of HTML's presentational features and when you want to support browsers that don't understand Cascading Style Sheets.
Use this when you want to use HTML Frames to partition the browser window into two or more frames.
XHTML HowTo
XHTML HowTo
How W3Schools Was Converted To XHTML
W3Schools was converted from HTML to XHTML the weekend of 18. and 19. December 1999, by Hege Refsnes and Stle Refsnes. To convert a Web site from HTML to XHTML, you should be familiar with the XHTML syntax rules of the previous chapters. The following steps were executed (in the order listed below):
Note that we used the transitional DTD. We could have chosen the strict DTD, but found it a little too "strict", and a little too hard to conform to.
Your pages must have a DOCTYPE declaration if you want them to validate as correct XHTML. Be aware however, that newer browsers (like Internet Explorer 6) might treat your document differently depending on the <!DOCTYPE> declaration. If the browser reads a document with a DOCTYPE, it might treat the document as "correct". Malformed XHTML might fall over and display differently than without a DOCTYPE.
After that, all pages were validated against the official W3C DTD with this link: XHTML Validator. A few more errors were found and edited manually. The most common error was missing </li> tags in lists. Should we have used a converting tool? Well, we could have used TIDY. Dave Raggett's HTML TIDY is a free utility for cleaning up HTML code. It also works great on the hard-to-read markup generated by specialized HTML editors and conversion tools, and it can help you identify where you need to pay further attention on making your pages more accessible to people with disabilities. The reason why we didn't use Tidy? We knew about XHTML when we started writing this web site. We knew that we had to use lowercase tag names and that we had to quote our attributes. So when the time came (to do the conversion), we simply had to test our pages against the W3C XHTML validator and correct the few mistakes. AND - we have learned a lot about writing "tidy" HTML code.
XHTML Validation
XHTML Validation
An XHTML document is validated against a Document Type Definition.
The Transitional DTD includes everything in the strict DTD plus deprecated elements and attributes:
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
The Frameset DTD includes everything in the transitional DTD plus frames as well:
!DOCTYPE html PUBLIC
XHTML Modules
XHTML Modularization
The XHTML modularization model defines the modules of XHTML.
By splitting XHTML into modules, the W3C (World Wide web Consortium) has created small and welldefined sets of XHTML elements that can be used separately for simple devices as well as combined with other XML standards into larger and more complex applications. With modular XHTML, product and application designers can:
Choose the elements to be supported by a device using standard XHTML building blocks. Add extensions to XHTML, using XML, without breaking the XHTML standard. Simplify XHTML for devices like hand held computers, mobile phones, TV, and home appliances. Extend XHTML for complex applications by adding new XML functionality (like MathML, SVG, Voice and Multimedia). Define XHTML profiles like XHTML Basic (a subset of XHTML for mobile devices).
XHTML Modules
W3C has split the definition of XHTML into 28 modules: Module name Applet Module Base Module Basic Forms Module Basic Tables Module Bi-directional Text Module Client Image Map Module Edit Module Forms Module Frames Module Hypertext Module Iframe Module Image Module Intrinsic Events Module Legacy Module Link Module List Module Metainformation Module Name Identification Module Object Module Presentation Module Scripting Module Server Image Map Module Structure Module Style Attribute Module Description Defines the deprecated* applet element. Defines the base element. Defines the basic forms elements. Defines the basic table elements. Defines the bdo element. Defines browser side image map elements. Defines the editing elements del and ins. Defines all elements used in forms. Defines the frameset elements. Defines the a element. Defines the iframe element. Defines the img element. Defines event attributes like onblur and onchange. Defines deprecated* elements and attributes. Defines the link element. Defines the list elements ol, li, ul, dd, dt, and dl. Defines the meta element. Defines the deprecated* name attribute. Defines the object and param elements. Defines presentation elements like b and i. Defines the script and noscript elements. Defines server side image map elements. Defines the elements html, head, title and body. Defines the style attribute.
Defines the style element. Defines the elements used in tables. Defines the target attribute. Defines text container elements like p and h1.
XHTML Attributes
Core Attributes
Not valid in base, head, html, meta, param, script, style, and title elements. Attribute class id style title Value class_rule or style_rule id_name style_definition tooltip_text Description The class of the element A unique id for the element An inline style definition A text to display in a tool tip
Language Attributes
Not valid in base, br, frame, frameset, hr, iframe, param, and script elements. Attribute dir lang Value ltr | rtl language_code Description Sets the text direction Sets the language code
Keyboard Attributes
Description Sets a keyboard shortcut to access an element Sets the tab order of an element
XHTML Events
Window Events
Only valid in body and frameset elements Attribute onload onunload Value script script Description Script to be run when a document loads Script to be run when a document unloads
Keyboard Events
Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements. Attribute onkeydown onkeypress onkeyup Value script script script Description What to do when key is pressed What to do when key is pressed and released What to do when key is released
Mouse Events
Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements. Attribute onclick ondblclick onmousedown onmousemove onmouseover onmouseout onmouseup Value script script script script script script script Description What to do on a mouse click What to do on a mouse doubleclick What to do when mouse button is pressed What to do when mouse pointer moves What to do when mouse pointer moves over an element What to do when mouse pointer moves out of an element What to do when mouse button is released
XHTML Summary
You have also learned that all XHTML documents must have a DOCTYPE declaration, and that the html, head, title, and body elements must be present. For more information on XHTML, please look at our XHTML reference.
Quiz/Exam XHTML Quiz XHTML Exam References XHTML Tag List HTML and XHTML Full References HTML by Alphabet
NN: indicates the earliest version of Netscape that supports the tag IE: indicates the earliest version of Internet Explorer that supports the tag DTD: indicates in which XHTML 1.0 DTD the tag is allowed. S=Strict, T=Transitional, and F=Frameset Description Defines a comment Defines the document type Defines an anchor Defines an abbreviation Defines an acronym Defines an address element Deprecated. Defines an applet Defines an area inside an image map Defines bold text Defines a base URL for all the links in a page Deprecated. Defines a base font Defines the direction of text display Defines big text Defines a long quotation Defines the body element Inserts a single line break Defines a push button Defines a table caption Deprecated. Defines centered text Defines a citation Defines computer code text Defines attributes for table columns Defines groups of table columns Defines a definition description Defines deleted text Deprecated. Defines a directory list Defines a section in a document Defines a definition term Defines a definition list Defines a definition term Defines emphasized text Defines a fieldset Deprecated. Defines text font, size, and color Defines a form Defines a sub window (a frame) Defines a set of frames Defines header 1 to header 6 NN 3.0 3.0 6.2 6.2 4.0 2.0 3.0 3.0 3.0 3.0 6.2 3.0 3.0 3.0 3.0 6.2 3.0 3.0 3.0 3.0 IE DTD 3.0 STF STF 3.0 STF STF 4.0 STF 4.0 STF 3.0 TF 3.0 STF 3.0 STF 3.0 STF 3.0 TF 5.0 STF 3.0 STF 3.0 STF 3.0 STF 3.0 STF 4.0 STF 3.0 STF 3.0 TF 3.0 STF 3.0 STF 3.0 STF 3.0 STF 3.0 STF 4.0 STF 3.0 TF 3.0 STF 3.0 STF 3.0 STF 3.0 STF 3.0 STF 4.0 STF 3.0 TF 3.0 STF 3.0 F 3.0 F 3.0 STF
Tag <!--...--> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <b> <base> <basefont> <bdo> <big> <blockquote> <body> <br> <button> <caption> <center> <cite> <code> <col> <colgroup> <dd> <del> <dir> <div> <dfn> <dl> <dt> <em> <fieldset> <font> <form> <frame> <frameset> <h1> to <h6>
3.0 6.2 3.0 3.0 3.0 3.0 3.0 6.2 3.0 3.0 3.0 3.0 3.0
<head> <hr> <html> <i> <iframe> <img> <input> <ins> <isindex> <kbd> <label> <legend> <li> <link> <map> <menu> <meta> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <param> <pre> <q> <s> <samp> <script> <select> <small> <span> <strike> <strong> <style> <sub> <sup> <table> <tbody> <td> <textarea>
Defines information about the document Defines a horizontal rule Defines an html document Defines italic text Defines an inline sub window (frame) Defines an image Defines an input field Defines inserted text Deprecated. Defines a single-line input field Defines keyboard text Defines a label for a form control Defines a title in a fieldset Defines a list item Defines a resource reference Defines an image map Deprecated. Defines a menu list Defines meta information Defines a noframe section Defines a noscript section Defines an embedded object Defines an ordered list Defines an option group Defines an option in a drop-down list Defines a paragraph Defines a parameter for an object Defines preformatted text Defines a short quotation Deprecated. Defines strikethrough text Defines sample computer code Defines a script Defines a selectable list Defines small text Defines a section in a document Deprecated. Defines strikethrough text Defines strong text Defines a style definition Defines subscripted text Defines superscripted text Defines a table Defines a table body Defines a table cell Defines a text area
3.0 3.0 3.0 3.0 6.0 3.0 3.0 6.2 3.0 3.0 6.2 6.2 3.0 4.0 3.0 3.0 3.0 3.0 3.0 3.0 6.0 3.0 3.0 3.0 3.0 6.2 3.0 3.0 3.0 3.0 3.0 4.0 3.0 3.0 4.0 3.0 3.0 3.0 3.0 3.0
3.0 3.0 3.0 3.0 4.0 3.0 3.0 4.0 3.0 3.0 4.0 4.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 6.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 4.0 3.0 3.0
STF STF STF STF TF STF STF STF TF STF STF STF STF STF STF TF STF TF STF STF STF STF STF STF STF STF STF TF STF STF STF STF STF TF STF STF STF STF STF STF STF STF
<tfoot> <th> <thead> <title> <tr> <tt> <u> <ul> <var> <xmp>
Defines a table footer Defines a table header Defines a table header Defines the document title Defines a table row Defines teletype text Deprecated. Defines underlined text Defines an unordered list Defines a variable Deprecated. Defines preformatted text
4.0 3.0 4.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0
HTML by Function
NN: indicates the earliest version of Netscape that supports the tag IE: indicates the earliest version of Internet Explorer that supports the tag DTD: indicates in which XHTML 1.0 DTD the tag is allowed. S=Strict, T=Transitional, and F=Frameset Purpose NN IE DTD
Start tag Basic Tags <!DOCTYPE> <html> <body> <h1> to <h6> <p> <br> <hr> <!--...--> Char Format <b> <font> <i>
Defines the document type Defines an html document Defines the body element Defines header 1 to header 6 Defines a paragraph Inserts a single line break Defines a horizontal rule Defines a comment
Defines bold text Deprecated. Defines text font, size, and color Defines italic text
<em> <big> <strong> <small> <sup> <sub> <bdo> <u> Output <pre> <code> <tt> <kbd> <var> <dfn> <samp> <xmp> Blocks <acronym> <abbr> <address> <blockquote> <center> <q> <cite> <ins> <del> <s> <strike> Links <a> <link> Frames <frame> <frameset> <noframes> <iframe>
Defines emphasized text Defines big text Defines strong text Defines small text Defines superscripted text Defines subscripted text Defines the direction of text display Deprecated. Defines underlined text
Defines preformatted text Defines computer code text Defines teletype text Defines keyboard text Defines a variable Defines a definition term Defines sample computer code Deprecated. Defines preformatted text
Defines an acronym Defines an abbreviation Defines an address element Defines a long quotation Deprecated. Defines centered text Defines a short quotation Defines a citation Defines inserted text Defines deleted text Deprecated. Defines strikethrough text Deprecated. Defines strikethrough text
6.2 6.2 4.0 3.0 3.0 6.2 3.0 6.2 6.2 3.0 3.0
4.0 STF STF 4.0 STF 3.0 STF 3.0 TF 4.0 STF 3.0 STF 4.0 STF 4.0 STF 3.0 TF 3.0 TF
3.0 4.0
Defines a sub window (a frame) Defines a set of frames Defines a noframe section Defines an inline sub window (frame)
F F TF TF
Input <form> <input> <textarea> <button> <select> <optgroup> <option> <label> <fieldset> <legend> <isindex> Lists <ul> <ol> <li> <dir> <dl> <dt> <dd> <menu> Images <img> <map> <area> Tables <table> <caption> <th> <tr> <td> <thead> <tbody> <tfoot> <col> <colgroup> Styles <style>
Defines a form Defines an input field Defines a text area Defines a push button Defines a selectable list Defines an option group Defines an item in a list box Defines a label for a form control Defines a fieldset Defines a title in a fieldset Deprecated. Defines a single-line input field
3.0 3.0 3.0 6.2 3.0 6.0 3.0 6.2 6.2 6.2 3.0
3.0 3.0 3.0 4.0 3.0 6.0 3.0 4.0 4.0 4.0 3.0
STF STF STF STF STF STF STF STF STF STF TF
Defines an unordered list Defines an ordered list Defines a list item Deprecated. Defines a directory list Defines a definition list Defines a definition term Defines a definition description Deprecated. Defines a menu list
Defines an image Defines an image map Defines an area inside an image map
Defines a table Defines a table caption Defines a table header Defines a table row Defines a table cell Defines a table header Defines a table body Defines a table footer Defines attributes for table columns Defines groups of table columns
3.0 3.0 3.0 3.0 3.0 4.0 4.0 4.0 3.0 3.0
STF STF STF STF STF STF STF STF STF STF
4.0
3.0 STF
<div> <span> Meta Info <head> <title> <meta> <base> <basefont> Programming <script> <noscript> <applet> <object> <param>
3.0 4.0
Defines information about the document Defines the document title Defines meta information Defines a base URL for all the links in a page Deprecated. Defines a base font
Defines a script Defines a noscript section Deprecated. Defines an applet Defines an embedded object Defines a parameter for an object
XHTML Attributes
Core Attributes
Not valid in base, head, html, meta, param, script, style, and title elements. Attribute class id style title Value class_rule or style_rule id_name style_definition tooltip_text Description The class of the element A unique id for the element An inline style definition A text to display in a tool tip
Language Attributes
Not valid in base, br, frame, frameset, hr, iframe, param, and script elements. Attribute dir lang Value ltr | rtl language_code Description Sets the text direction Sets the language code
Keyboard Attributes
Attribute accesskey tabindex Value character number Description Sets a keyboard shortcut to access an element Sets the tab order of an element
XHTML Events
Window Events
Only valid in body and frameset elements Attribute onload onunload Value script script Description Script to be run when a document loads Script to be run when a document unloads
Only valid in form elements. Attribute onchange onsubmit onreset onselect onblur onfocus Value script script script script script script Description Script to be run when the element changes Script to be run when the form is submitted Script to be run when the form is reset Script to be run when the element is selected Script to be run when the element loses focus Script to be run when the element gets focus
Keyboard Events
Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements. Attribute onkeydown onkeypress onkeyup Value script script script Description What to do when key is pressed What to do when key is pressed and released What to do when key is released
Mouse Events
Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements. Attribute onclick ondblclick onmousedown onmousemove onmouseover onmouseout onmouseup Value script script script script script script script Description What to do on a mouse click What to do on a mouse doubleclick What to do when mouse button is pressed What to do when mouse pointer moves What to do when mouse pointer moves over an element What to do when mouse pointer moves out of an element What to do when mouse button is released
XHTML Colornames
HTML Colors
The table below provides a list of the color names that are supported by all major browsers. Note: If you want your pages to validate with an HTML or a CSS validator, W3C has listed 16 color names that you can use: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow. If you want to use other colors, you must specify their RGB or HEX value. Click on a color name (or a hex value) to view the color as the background-color along with different text colors: Color Name AliceBlue AntiqueWhite Aqua Aquamarine Azure Beige Bisque Black BlanchedAlmond Blue BlueViolet Brown BurlyWood CadetBlue Chartreuse Chocolate Coral CornflowerBlue Cornsilk Crimson Cyan DarkBlue DarkCyan DarkGoldenRod DarkGray DarkGrey DarkGreen DarkKhaki Color HEX #F0F8FF #FAEBD7 #00FFFF #7FFFD4 #F0FFFF #F5F5DC #FFE4C4 #000000 #FFEBCD #0000FF #8A2BE2 #A52A2A #DEB887 #5F9EA0 #7FFF00 #D2691E #FF7F50 #6495ED #FFF8DC #DC143C #00FFFF #00008B #008B8B #B8860B #A9A9A9 #A9A9A9 #006400 #BDB76B Color
DarkMagenta DarkOliveGreen Darkorange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkSlateGrey DarkTurquoise DarkViolet DeepPink DeepSkyBlue DimGray DimGrey DodgerBlue FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold GoldenRod Gray Grey Green GreenYellow HoneyDew HotPink IndianRed Indigo Ivory Khaki Lavender LavenderBlush LawnGreen LemonChiffon LightBlue LightCoral LightCyan
#8B008B #556B2F #FF8C00 #9932CC #8B0000 #E9967A #8FBC8F #483D8B #2F4F4F #2F4F4F #00CED1 #9400D3 #FF1493 #00BFFF #696969 #696969 #1E90FF #B22222 #FFFAF0 #228B22 #FF00FF #DCDCDC #F8F8FF #FFD700 #DAA520 #808080 #808080 #008000 #ADFF2F #F0FFF0 #FF69B4 #CD5C5C #4B0082 #FFFFF0 #F0E68C #E6E6FA #FFF0F5 #7CFC00 #FFFACD #ADD8E6 #F08080 #E0FFFF
LightGoldenRodYellow LightGray LightGrey LightGreen LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSlateGrey LightSteelBlue LightYellow Lime LimeGreen Linen Magenta Maroon MediumAquaMarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed MidnightBlue MintCream MistyRose Moccasin NavajoWhite Navy OldLace Olive OliveDrab Orange OrangeRed Orchid PaleGoldenRod PaleGreen PaleTurquoise PaleVioletRed
#FAFAD2 #D3D3D3 #D3D3D3 #90EE90 #FFB6C1 #FFA07A #20B2AA #87CEFA #778899 #778899 #B0C4DE #FFFFE0 #00FF00 #32CD32 #FAF0E6 #FF00FF #800000 #66CDAA #0000CD #BA55D3 #9370D8 #3CB371 #7B68EE #00FA9A #48D1CC #C71585 #191970 #F5FFFA #FFE4E1 #FFE4B5 #FFDEAD #000080 #FDF5E6 #808000 #6B8E23 #FFA500 #FF4500 #DA70D6 #EEE8AA #98FB98 #AFEEEE #D87093
PapayaWhip PeachPuff Peru Pink Plum PowderBlue Purple Red RosyBrown RoyalBlue SaddleBrown Salmon SandyBrown SeaGreen SeaShell Sienna Silver SkyBlue SlateBlue SlateGray SlateGrey Snow SpringGreen SteelBlue Tan Teal Thistle Tomato Turquoise Violet Wheat White WhiteSmoke Yellow YellowGreen
#FFEFD5 #FFDAB9 #CD853F #FFC0CB #DDA0DD #B0E0E6 #800080 #FF0000 #BC8F8F #4169E1 #8B4513 #FA8072 #F4A460 #2E8B57 #FFF5EE #A0522D #C0C0C0 #87CEEB #6A5ACD #708090 #708090 #FFFAFA #00FF7F #4682B4 #D2B48C #008080 #D8BFD8 #FF6347 #40E0D0 #EE82EE #F5DEB3 #FFFFFF #F5F5F5 #FFFF00 #9ACD32
XHTML ASCII
HTML and XHTML uses standard 7-BIT ASCII when transmitting data over the Web. 7-BIT ASCII represents 128 different character values (0-127).
B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k
uppercase B uppercase C uppercase D uppercase E uppercase F uppercase G uppercase H uppercase I uppercase J uppercase K uppercase L uppercase M uppercase N uppercase O uppercase P uppercase Q uppercase R uppercase S uppercase T uppercase U uppercase V uppercase W uppercase X uppercase Y uppercase Z left square bracket backslash right square bracket caret underscore grave accent lowercase a lowercase b lowercase c lowercase d lowercase e lowercase f lowercase g lowercase h lowercase i lowercase j lowercase k
B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k
l m n o p q r s t u v w x y z { | } ~
lowercase l lowercase m lowercase n lowercase o lowercase p lowercase q lowercase r lowercase s lowercase t lowercase u lowercase v lowercase w lowercase x lowercase y lowercase z left curly brace vertical bar right curly brace tilde
l m n o p q r s t u v w x y z { | } ~
DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US DEL
data link escape device control 1 device control 2 device control 3 device control 4 negative acknowledge synchronize end transmission block cancel end of medium substitute escape file separator group separator record separator unit separator delete (rubout)
                
XHTML Entities
Result
Description capital a, grave accent capital a, acute accent capital a, circumflex accent capital a, tilde capital a, umlaut mark capital a, ring capital ae capital c, cedilla capital e, grave accent capital e, acute accent capital e, circumflex accent capital e, umlaut mark capital i, grave accent capital i, acute accent capital i, circumflex accent capital i, umlaut mark capital eth, Icelandic capital n, tilde capital o, grave accent capital o, acute accent capital o, circumflex accent capital o, tilde capital o, umlaut mark capital o, slash capital u, grave accent capital u, acute accent capital u, circumflex accent capital u, umlaut mark capital y, acute accent capital THORN, Icelandic small sharp s, German small a, grave accent small a, acute accent small a, circumflex accent small a, tilde small a, umlaut mark small a, ring small ae small c, cedilla small e, grave accent small e, acute accent
Entity Name À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é
Entity Number À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é
small e, circumflex accent small e, umlaut mark small i, grave accent small i, acute accent small i, circumflex accent small i, umlaut mark small eth, Icelandic small n, tilde small o, grave accent small o, acute accent small o, circumflex accent small o, tilde small o, umlaut mark small o, slash small u, grave accent small u, acute accent small u, circumflex accent small u, umlaut mark small y, acute accent small thorn, Icelandic small y, umlaut mark
ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ
ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ
left single quotation mark right single quotation mark single low-9 quotation mark left double quotation mark right double quotation mark double low-9 quotation mark dagger double dagger horizontal ellipsis per mille single left-pointing angle quotation single right-pointing angle quotation euro
‘ ’ ‚ “ ” „ † ‡ … ‰ ‹ › €
‘ ’ ‚ “ ” „ † ‡ … ‰ ‹ › €
Try It
Type some text or an ASCII value in the input field below, and click on the "URL Encode" button to see the URL-encoding.
This is a text
URL Encode
c return
' ( ) * + , . /
W X Y Z [ \ ] ^ _
%ad %ae %af %b0 %b1 %b2 %b3 %b4 %b5 %b6 %b7 %b8 %b9 %ba %bb %bc %bd %be %bf
%dd %de %df %e0 %e1 %e2 %e3 %e4 %e5 %e6 %e7 %e8 %e9 %ea %eb %ec %ed %ee %ef
HTTP Messages
Description: The request is OK The request is complete, and a new resource is created
202 Accepted 203 Non-authoritative Information 204 No Content 205 Reset Content 206 Partial Content 3xx: Redirection Message: 300 Multiple Choices 301 Moved Permanently 302 Found 303 See Other 304 Not Modified 305 Use Proxy 306 Unused 307 Temporary Redirect 4xx: Client Error Message: 400 Bad Request 401 Unauthorized 402 Payment Required 403 Forbidden 404 Not Found 405 Method Not Allowed 406 Not Acceptable 407 Proxy Authentication Required 408 Request Timeout 409 Conflict 410 Gone 411 Length Required 412 Precondition Failed 413 Request Entity Too Large
The request is accepted for processing, but the processing is not complete
Description: A link list. The user can select a link and go to that location. Maximum five addresses The requested page has moved to a new url The requested page has moved temporarily to a new url The requested page can be found under a different url
This code was used in a previous version. It is no longer used, but the code is reserved The requested page has moved temporarily to a new url
Description: The server did not understand the request The requested page needs a username and a password You can not use this code yet Access is forbidden to the requested page The server can not find the requested page The method specified in the request is not allowed The server can only generate a response that is not accepted by the client You must authenticate with a proxy server before this request can be served The request took longer than the server was prepared to wait The request could not be completed because of a conflict The requested page is no longer available The "Content-Length" is not defined. The server will not accept the request without it The precondition given in the request evaluated to false by the server The server will not accept the request, because the request entity is
too large 414 Request-url Too Long The server will not accept the request, because the url is too long. Occurs when you convert a "post" request to a "get" request with a long query information The server will not accept the request, because the media type is not supported
415 Unsupported Media Type 416 417 Expectation Failed 5xx: Server Error Message: 500 Internal Server Error 501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout 505 HTTP Version Not Supported
Description: The request was not completed. The server met an unexpected condition The request was not completed. The server did not support the functionality required The request was not completed. The server received an invalid response from the upstream server The request was not completed. The server is temporarily overloading or down The gateway has timed out The server does not support the "http protocol" version
CSS Tutorial
CSS Tutorial
Save a lot of work with CSS! In our CSS tutorial you will learn how to use CSS to control the style and layout of
CSS Examples
Learn by 70 examples! With our editor, you can edit CSS, and click on a test button to view the result. Try-It-Yourself!
CSS Reference
At W3Schools you will find a complete CSS2 reference, listing properties, units of measurements, colors, and more. CSS2 Reference
CSS Introduction
Introduction to CSS
HTML / XHTML
If you want to study this subject first, find the tutorials on our Home page.
What is CSS?
CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles are normally stored in Style Sheets Styles were added to HTML 4.0 to solve a problem External Style Sheets can save you a lot of work External Style Sheets are stored in CSS files Multiple style definitions will cascade into one
CSS Demo
With CSS, your HTML documents can be displayed using different output styles: See how it works
Cascading Order
What style will be used when there is more than one style specified for an HTML element? Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority: 1. 2. 3. 4. Browser default External style sheet Internal style sheet (inside the <head> tag) Inline style (inside an HTML element)
So, an inline style (inside an HTML element) has the highest priority, which means that it will override a style declared inside the <head> tag, in an external style sheet, or in a browser (a default value).
CSS Syntax
CSS Syntax
Syntax
The CSS syntax is made up of three parts: a selector, a property and a value:
selector {property: value}
The selector is normally the HTML element/tag you wish to define, the property is the attribute you wish to change, and each property can take a value. The property and value are separated by a colon, and surrounded by curly braces:
body {color: black}
Note: If the value is multiple words, put quotes around the value:
p {font-family: "sans serif"}
Note: If you wish to specify more than one property, you must separate each property with a semicolon. The example below shows how to define a center aligned paragraph, with a red text color:
p {text-align:center;color:red}
To make the style definitions more readable, you can describe one property on each line, like this:
p { text-align: center; color: black; font-family: arial }
Grouping
You can group selectors. Separate each selector with a comma. In the example below we have grouped all the header elements. All header elements will be displayed in green text color:
h1,h2,h3,h4,h5,h6 { color: green }
Note: To apply more than one class per given element, the syntax is:
<p class="center bold"> This is a paragraph. </p>
The paragraph above will be styled by the class "center" AND the class "bold". You can also omit the tag name in the selector to define a style that will be used by all HTML elements that have a certain class. In the example below, all HTML elements with class="center" will be center-aligned:
.center {text-align: center}
In the code below both the h1 element and the p element have class="center". This means that both elements will follow the rules in the ".center" selector:
<h1 class="center"> This heading will be center-aligned </h1> <p class="center"> This paragraph will also be center-aligned. </p>
Do NOT start a class name with a number! It will not work in Mozilla/Firefox.
The id Selector
You can also define styles for HTML elements with the id selector. The id selector is defined as a #. The style rule below will match the element that has an id attribute with a value of "green":
#green {color: green}
The style rule below will match the p element that has an id with a value of "para1":
p#para1 { text-align: center; color: red }
CSS Comments
Comments are used to explain your code, and may help you when you edit the source code at a later date. A comment will be ignored by browsers. A CSS comment begins with "/*", and ends with "*/", like this:
/* This is a comment */ p { text-align: center; /* This is another comment */ color: black; font-family: arial }
CSS How To
The browser will read the style definitions from the file mystyle.css, and format the document according to it. An external style sheet can be written in any text editor. The file should not contain any html tags. Your style sheet should be saved with a .css extension. An example of a style sheet file is shown below:
hr {color: sienna} p {margin-left: 20px} body {background-image: url("images/back40.gif")}
Do NOT leave spaces between the property value and the units! If you use "margin-left: 20 px" instead of "margin-left: 20px" it will only work properly in IE6 but it will not work in Mozilla/Firefox or Netscape.
The browser will now read the style definitions, and format the document according to it. Note: A browser normally ignores unknown tags. This means that an old browser that does not support styles, will ignore the <style> tag, but the content of the <style> tag will be displayed on the page. It is possible to prevent an old browser from displaying the content by hiding it in the HTML comment element:
<head> <style type="text/css"> <!-hr {color: sienna} p {margin-left: 20px} body {background-image: url("images/back40.gif")} --> </style> </head>
Inline Styles
An inline style loses many of the advantages of style sheets by mixing content with presentation. Use this method sparingly, such as when a style is to be applied to a single occurrence of an element. To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example shows how to change the color and the left margin of a paragraph:
<p style="color: sienna; margin-left: 20px">
And an internal style sheet has these properties for the h3 selector:
h3 { text-align: right; font-size: 20pt }
If the page with the internal style sheet also links to the external style sheet the properties for h3 will be:
color: red; text-align: right; font-size: 20pt
The color is inherited from the external style sheet and the text-alignment and the font-size is replaced by the internal style sheet.
CSS Background
CSS Background
The CSS background properties define the background effects of an element.
Examples
Set the background color This example demonstrates how to set the background color for an element. Set an image as the background This example demonstrates how to set an image as the background. How to repeat a background image This example demonstrates how to repeat a background image. How to repeat a background image only vertically This example demonstrates how to repeat a background image only vertically. How to repeat a background image only horizontally This example demonstrates how to repeat a background image only horizontally. How to place the background image This example demonstrates how to place the image on the page. How to set a fixed background image This example demonstrates how to set a fixed background image. The image will not scroll with the rest of the page. All the background properties in one declaration This example demonstrates how to use the shorthand property for setting all of the background properties in one declaration.
background-attachment
scroll Sets whether a background image is fixed or scrolls with the fixed rest of the page Sets the background color of an color-rgb element color-hex color-name transparent Sets an image as the background url(URL) none Sets the starting position of a background image top left top center top right center left center center center right bottom left bottom center bottom right x% y% xpos ypos
background-color
background-image background-position
4 4
1 1
4 6
1 1
background-repeat
Sets if/how a background image repeat will be repeated repeat-x repeat-y no-repeat
CSS Text
CSS Text
The CSS text properties define the appearance of text.
Examples
Set the color of the text This example demonstrates how to set the color of the text. Set the background-color of the text This example demonstrates how to set the background-color of a part of the text.
Specify the space between characters This example demonstrates how to increase or decrease the space between characters. Specify the space between lines This example demonstrates how to specify the space between the lines in a paragraph. Align the text This example demonstrates how to align the text. Decorate the text This example demonstrates how to add decoration to text. Indent text This example demonstrates how to indent the first line of a paragraph. Control the letters in a text This example demonstrates how to control the letters in a text.
letter-spacing text-align
Increase or decrease the space between characters Aligns the text in an element
4 4
1 1
6 4
1 1
text-decoration
overline line-through blink text-indent text-shadow Indents the first line of text in an length element % none color length Controls the letters in an element none capitalize uppercase lowercase normal embed bidi-override Sets how white space inside an element is handled Increase or decrease the space between words normal pre nowrap normal length 4 1 4 1 4 1 4 1
text-transform
unicode-bidi
white-space
word-spacing
CSS Font
CSS Font
The CSS font properties define the font in text.
Examples
Set the font of a text This example demonstrates how to set a font of a text. Set the size of the font This example demonstrates how to set the size of a font. Set the style of the font This example demonstrates how to set the style of a font. Set the variant of the font This example demonstrates how to set the variant of a font.
Set the boldness of the font This example demonstrates how to set the boldness of a font. All the font properties in one declaration This example demonstrates how to use the shorthand property for setting all of the font properties in one declaration.
font-family
font-size
font-size-adjust
element that will preserve the x- number height of the first-choice font font-stretch Condenses or expands the current font-family normal wider narrower ultra-condensed extra-condensed condensed semi-condensed semi-expanded expanded extra-expanded ultra-expanded normal italic oblique normal small-caps normal bold bolder lighter 100 200 300 400 500 600 700 800 900 2
font-style
font-variant font-weight
Displays text in a small-caps font or a normal font Sets the weight of a font
4 4
1 1
6 4
1 1
CSS Border
CSS Border
The CSS border properties define the borders around an element.
Examples
Set the style of the four borders This example demonstrates how to set the style of the four borders. Set different borders on each side This example demonstrates how to set different borders on each side of the element. Set the color of the four borders This example demonstrates how to set the color of the four borders. It can have from one to four colors. Set the width of the bottom border This example demonstrates how to set the width of the bottom border. Set the width of the left border This example demonstrates how to set the width of the left border. Set the width of the right border This example demonstrates how to set the width of the right border. Set the width of the top border This example demonstrates how to set the width of the top border. All the bottom border properties in one declaration This example demonstrates a shorthand property for setting all of the properties for the bottom border in one declaration. All the left border properties in one declaration This example demonstrates a shorthand property for setting all of the properties for the left border in one declaration. All the right border properties in one declaration This example demonstrates a shorthand property for setting all of the properties for the right border in one declaration. All the top border properties in one declaration This example demonstrates a shorthand property for setting all of the properties for the top border in one declaration. All the width of the border properties in one declaration This example demonstrates a shorthand property for setting the width of the four borders in one declaration, can have from one to four values. All the border properties in one declaration This example demonstrates a shorthand property for setting all of the properties for the four borders in one declaration, can have from one to three values.
border-bottom
4 4 4
1 1 1
6 6 4
2 2 1
border-color
Sets the color of the four borders, can have from one to four colors
border-left
A shorthand property for setting border-left-width all of the properties for the left border-style border in one declaration border-color Sets the color of the left border Sets the style of the left border border-color border-style
4 4 4
1 1 1
6 6 4
2 2 1
Sets the width of the left border thin medium thick length A shorthand property for setting border-right-width all of the properties for the right border-style border in one declaration border-color Sets the color of the right border border-color Sets the style of the right border border-style Sets the width of the right thin
border-right
4 4 4
1 1 1
6 6 4
2 2 1
border
medium thick length none hidden dotted dashed solid double groove ridge inset outset 4 1 6 1
border-style
Sets the style of the four borders, can have from one to four styles
border-top
A shorthand property for setting border-top-width all of the properties for the top border-style border in one declaration border-color Sets the color of the top border Sets the style of the top border Sets the width of the top border border-color border-style thin medium thick length thin medium thick length
4 4 4
1 1 1
6 6 4
2 2 1
border-width
A shorthand property for setting the width of the four borders in one declaration, can have from one to four values
CSS Margin
CSS Margin
The CSS margin properties define the space around elements.
Examples
Set the left margin of a text This example demonstrates how to set the left margin of a text. Set the right margin of a text This example demonstrates how to set the right margin of a text.
Set the top margin of a text This example demonstrates how to set the top margin of a text. Set the bottom margin of a text This example demonstrates how to set the bottom margin of a text. All the margin properties in one declaration This example demonstrates how to set a shorthand property for setting all of the margin properties in one declaration.
margin-bottom
margin-left
margin-right
margin-top
CSS Padding
CSS Padding
The CSS padding properties define the space between the element border and the element content.
Examples
Set the left padding This example demonstrates how to set the left padding of a tablecell. Set the right padding This example demonstrates how to set the right padding of a tablecell. Set the top padding This example demonstrates how to set the top padding of a tablecell. Set the bottom padding This example demonstrates how to set the bottom padding of a tablecell. All the padding properties in one declaration This example demonstrates a shorthand property for setting all of the padding properties in one declaration, can have from one to four values.
one declaration padding-bottom padding-left padding-right padding-top Sets the bottom padding of an element Sets the left padding of an element Sets the right padding of an element Sets the top padding of an element
CSS List
CSS List
The CSS list properties allow you to place the list-item marker, change between different list-item markers, or set an image as the list-item marker.
Examples
The different list-item markers in unordered lists This example demonstrates the different list-item markers in CSS. The different list-item markers in ordered lists This example demonstrates the different list-item markers in CSS. Set an image as the list-item marker This example demonstrates how to set an image as the list-item marker. Place the list-item marker This example demonstrates where to place the list-item marker. All list properties in one declaration This example demonstrates a shorthand property for setting all of the properties for a list in one declaration.
The CSS list properties allow you to place the list-item marker, change between different list-item markers, or set an image as the list-item marker. Browser support: IE: Internet Explorer, F: Firefox, N: Netscape. W3C: The number in the "W3C" column indicates in which CSS recommendation the property is defined (CSS1 or CSS2). Property list-style Description Values IE 4 F 1 N 6 W3C 1 A shorthand property for setting list-style-type all of the properties for a list in list-style-position one declaration list-style-image Sets an image as the list-item marker Sets where the list-item marker is placed in the list Sets the type of the list-item marker none url inside outside none disc circle square decimal decimal-leading-zero lower-roman upper-roman lower-alpha upper-alpha lower-greek lower-latin upper-latin hebrew armenian georgian cjk-ideographic hiragana katakana hiragana-iroha katakana-iroha auto length
4 4 4
1 1 1
6 6 4
1 1 1
marker-offset
CSS Dimension
The CSS dimension properties allow you to control the height and width of an element. It also allows you to increase the space between two lines.
Examples
Specify the space between lines This example demonstrates how to specify the space between the lines in a paragraph.
line-height
max-height
Sets the maximum height of an element Sets the maximum width of an element Sets the minimum height of an element Sets the minimum width of an element Sets the width of an element
max-width
1 1 1
6 6 4
2 2 1
CSS Classification
CSS Classification
The CSS classification properties allow you to specify how and where to display an element.
Examples
How to display an element This example demonstrates how to display an element. A simple use of the float property Let an image float to the right in a paragraph. An image with border and margins that floats to the right in a paragraph Let an image float to the right in a paragraph. Add border and margins to the image. An image with a caption that floats to the right Let an image with a caption float to the right. Let the first letter of a paragraph float to the left Let the first letter of a paragraph float to the left and style the letter. Creating a horizontal menu Use float with a list of hyperlinks to create a horizontal menu. Creating a homepage without tables Use float to create a homepage with a header, footer, left content and main content. Position:relative This example demonstrates how to position an element relative to its normal position. Position:absolute This example demonstrates how to position an element using an absolute value. How to make an element invisible This example demonstrates how to make an element invisible. Do you want the element to show or not? Change the cursor This example demonstrates how to change the cursor.
cursor
display
table-cell table-caption float Sets where an image or a text will appear in another element Places an element in a static, relative, absolute or fixed position Sets if an element should be visible or invisible left right none static relative absolute fixed visible hidden collapse 4 1 4 1
position
visibility
CSS Positioning
CSS Positioning
The CSS positioning properties allows you to position an element.
Examples
Position:relative This example demonstrates how to position an element relative to its normal position. Position:absolute This example demonstrates how to position an element using an absolute value. Set the shape of an element This example demonstrates how to set the shape of an element. The element is clipped into this shape, and displayed. Overflow This example demonstrates how to set the overflow property to specify what should happen when an element's content is too big to fit in a specified area. Vertical align an image This example demonstrates how to vertical align an image in a text. Z-index Z-index can be used to place an element "behind" another element.
Z-index The elements in the example above have now changed their Z-index.
clip
left
Sets how far the left edge of an auto element is to the right/left of the % left edge of the parent element length Sets what happens if the content visible of an element overflow its area hidden scroll auto Places an element in a static, relative, absolute or fixed position static relative absolute fixed
overflow
position
right
Sets how far the right edge of an auto element is to the left/right of the % right edge of the parent element length Sets how far the top edge of an element is above/below the top edge of the parent element auto % length
top
vertical-align
Sets the vertical alignment of an baseline element sub super top text-top
middle bottom text-bottom length % z-index Sets the stack order of an element auto number 4 1 6 2
CSS Pseudo-class
CSS Pseudo-classes
CSS pseudo-classes are used to add special effects to some selectors.
Examples
Hyperlink This example demonstrates how to add different colors to a hyperlink in a document. Hyperlink 2 This example demonstrates how to add other styles to hyperlinks. :first-child (does not work in IE) This example demonstrates the use of the :first-child pseudo-class. :lang (does not work in IE) This example demonstrates the use of the :lang pseudo-class.
Syntax
The syntax of pseudo-classes:
selector:pseudo-class {property: value}
Anchor Pseudo-classes
A link that is active, visited, unvisited, or when you mouse over a link can all be displayed in different ways in a CSS-supporting browser:
a:link {color: #FF0000} /* unvisited link */ a:visited {color: #00FF00} /* visited link */ a:hover {color: #FF00FF} /* mouse over link */ a:active {color: #0000FF} /* selected link */
Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!! Note: a:active MUST come after a:hover in the CSS definition in order to be effective!! Note: Pseudo-class names are not case-sensitive.
If the link in the example above has been visited, it will be displayed in red.
This selector will match the first paragraph inside the div in the following HTML:
<div> <p> First paragraph in div. This paragraph will be indented. </p>
<p> Second paragraph in div. This paragraph will not be indented. </p> </div>
In this example, the selector matches any em element that is the first child of a p element, and sets the font-weight to bold for the first em inside a p element:
p:first-child em { font-weight:bold }
For example, the em in the HTML below is the first child of the paragraph:
<p>I am a <em>strong</em> man.</p>
In this example, the selector matches any a element that is the first child of any element, and sets the text-decoration to none:
a:first-child { text-decoration:none }
For example, the first a in the HTML below is the first child of the paragraph and will not be underlined. But the second a in the paragraph is not the first child of the paragraph and will be underlined:
<p> Visit <a href="http://www.w3schools.com">W3Schools</a> and learn CSS! Visit <a href="http://www.w3schools.com">W3Schools</a> and learn HTML!
</p>
Pseudo-classes
Browser support: IE: Internet Explorer, F: Firefox, N: Netscape. W3C: The number in the "W3C" column indicates in which CSS recommendation the property is defined (CSS1 or CSS2). Pseudo-class :active :focus :hover :link :visited :first-child Purpose Adds special style to an activated element Adds special style to an element when you mouse over it Adds special style to an unvisited link Adds special style to a visited link Adds special style to an element that is the first child of IE 4 4 3 3 F 1 1 1 1 1 N 8 7 4 4 7 W3C 1 2 1 1 1 2
some other element :lang Allows the author to specify a language to use in a specified element 1 8 2
CSS Pseudo-element
CSS Pseudo-elements
CSS pseudo-elements are used to add special effects to some selectors.
Examples
Make the first letter special This example demonstrates how to add a special effect to the first letter of a text. Make the first line special This example demonstrates how to add a special effect to the first line of a text.
Syntax
The syntax of pseudo-elements:
selector:pseudo-element {property: value}
SOME TEXT THAT ENDS up on two or more lines In the example above the browser displays the first line formatted according to the "first-line" pseudo element. Where the browser breaks the line depends on the size of the browser window. Note: The "first-line" pseudo-element can only be used with block-level elements. Note: The following properties apply to the "first-line" pseudo-element:
font properties color properties background properties word-spacing letter-spacing text-decoration vertical-align text-transform line-height clear
The output could be something like this: ___ | he first | words of an article. Note: The "first-letter" pseudo-element can only be used with block-level elements. Note: The following properties apply to the "first-letter" pseudo- element:
font properties color properties background properties margin properties padding properties border properties text-decoration
The example above will make the first letter of all paragraphs with class="article" red.
Multiple Pseudo-elements
Several pseudo-elements can be combined:
p {font-size: 12pt} p:first-letter {color: #FF0000; font-size: 200%} p:first-line {color: #0000FF} <p>The first words of an article</p>
The output could be something like this: ___ | he first | words of an article. In the example above the first letter of the paragraph will be red with a font size of 24pt. The rest of the first line would be blue while the rest of the paragraph would be the default color.
content: url(beep.wav) }
Pseudo-elements
Browser support: IE: Internet Explorer, F: Firefox, N: Netscape. W3C: The number in the "W3C" column indicates in which CSS recommendation the property is defined (CSS1 or CSS2). Pseudo-element :first-letter :first-line :before :after Purpose Adds special style to the first letter of a text Adds special style to the first line of a text Inserts some content before an element Inserts some content after an element IE 5 5 F 1 1 N 8 8 W3C 1 1 2 2
1.5 8 1.5 8
Media Types
Some CSS properties are only designed for a certain media. For example the "voice-family" property is designed for aural user agents. Some other properties can be used for different media types. For example, the "font-size" property can be used for both screen and print media, but perhaps with different values. A document usually needs a larger font-size on a screen than on paper, and sansserif fonts are easier to read on the screen, while serif fonts are easier to read on paper.
See it yourself ! If you are using Mozilla/Firefox or IE 5+ and print this page, you will see that the paragraph under "Media Types" will be displayed in another font, and have a smaller font size than the rest of the text.
CSS Summary
You have also learned how to position an element, control the visibility and size of an element, set the shape of an element, place an element behind another, and to add special effects to some selectors, like links. For more information on CSS, please take a look at our CSS examples and our CSS reference.
CSS Examples
Background Set the background color Set an image as the background How to repeat a background image How to repeat a background image only vertically How to repeat a background image only horizontally How to place the background image
A fixed background image (this image will not scroll with the rest of the page) All the background properties in one declaration Text Set the color of the text Specify the space between characters Align the text Decorate the text Indent text Control the letters in a text Font Set the font of a text Set the size of the font Set the style of the font Set the variant of the font Set the boldness of the font All the font properties in one declaration Border Set the style of the four borders Set different borders on each side Set the color of the four borders Set the width of the bottom border Set the width of the left border Set the width of the right border Set the width of the top border All the bottom border properties in one declaration All the left border properties in one declaration All the right border properties in one declaration All the top border properties in one declaration All the width of the border properties in one declaration All the border properties in one declaration Margin Set the left margin of a text Set the right margin of a text Set the top margin of a text
Set the bottom margin of a text All the margin properties in one declaration Padding Set the left padding of a tablecell Set the right padding of a tablecell Set the top padding of a tablecell Set the bottom padding of a tablecell All the padding properties in one declaration List The different list-item markers in unordered lists The different list-item markers in ordered lists Set an image as the list-item marker Place the list-item marker All list properties in one declaration Dimension Increase the space between lines Classification How to display an element? A simple use of the float property An image with border and margins that floats to the right in a paragraph An image with a caption that floats to the right Let the first letter of a paragraph float to the left Creating a horizontal menu Position an element relative to its normal position Position an element with an absolute value How to make an element invisible Change the cursor Positioning Position an element relative to its normal position Position an element with an absolute value Set the shape of an element What should happen when an element's content is too big to fit in a specified area Vertical alignment of an image
Place an element "behind" another element Place an element "behind" another element 2 Pseudo-classes Add different colors to a hyperlink Add other styles to hyperlinks The use of the :first-child pseudo-class The use of the :lang pseudo-class Pseudo-elements Make the first letter special in a text Make the first line special in a text
CSS2 Reference
The links in the "Property" column point to more useful information about the specific property.
Browser support: IE: Internet Explorer, F: Firefox, N: Netscape. W3C: The number in the "W3C" column indicates in which CSS recommendation the property is defined (CSS1 or CSS2).
Background
On-line examples Property background Description Values IE 4 F 1 N 6 W3C 1 A shorthand property for setting background-color all background properties in one background-image declaration background-repeat background-attachment background-position
background-attachment
scroll Sets whether a background image is fixed or scrolls with the fixed rest of the page Sets the background color of an color-rgb element color-hex color-name transparent Sets an image as the background url(URL) none Sets the starting position of a background image top left top center top right center left center center center right bottom left bottom center bottom right x% y% xpos ypos
background-color
background-image background-position
4 4
1 1
4 6
1 1
background-repeat
Sets if/how a background image repeat will be repeated repeat-x repeat-y no-repeat
Border
On-line examples Property border Description Values IE 4 F 1 N 4 W3C 1 A shorthand property for setting border-width all of the properties for the four border-style borders in one declaration border-color A shorthand property for setting border-bottom-width all of the properties for the border-style bottom border in one declaration border-color Sets the color of the bottom border Sets the style of the bottom border Sets the width of the bottom border border-color border-style thin medium thick length color
border-bottom
4 4 4
1 1 1
6 6 4
2 2 1
border-color
borders, can have from one to four colors border-left A shorthand property for setting border-left-width all of the properties for the left border-style border in one declaration border-color Sets the color of the left border Sets the style of the left border border-color border-style 4 1 6 1
4 4 4
1 1 1
6 6 4
2 2 1
Sets the width of the left border thin medium thick length A shorthand property for setting border-right-width all of the properties for the right border-style border in one declaration border-color Sets the color of the right border border-color Sets the style of the right border border-style Sets the width of the right border thin medium thick length none hidden dotted dashed solid double groove ridge inset outset
border-right
4 4 4
1 1 1
6 6 4
2 2 1
border-style
Sets the style of the four borders, can have from one to four styles
border-top
A shorthand property for setting border-top-width all of the properties for the top border-style border in one declaration border-color Sets the color of the top border Sets the style of the top border Sets the width of the top border border-color border-style thin medium thick length thin medium thick length
4 4 4
1 1 1
6 6 4
2 2 1
border-width
A shorthand property for setting the width of the four borders in one declaration, can have from one to four values
Classification
On-line examples Property clear Description Sets the sides of an element where other floating elements are not allowed Specifies the type of cursor to be displayed Values left right both none url auto crosshair default pointer move e-resize ne-resize nw-resize n-resize se-resize sw-resize s-resize w-resize text wait help none inline block list-item run-in compact marker table inline-table table-row-group table-header-group table-footer-group table-row table-column-group table-column table-cell table-caption left right none static relative IE 4 F 1 N 4 W3C 1
cursor
display
float
Sets where an image or a text will appear in another element Places an element in a static, relative, absolute or fixed
position
Dimension
On-line examples Property height Description Sets the height of an element Values auto length % normal number length % none length % none length % length % length % auto % length IE 4 F 1 N 6 W3C 1
line-height
max-height
Sets the maximum height of an element Sets the maximum width of an element Sets the minimum height of an element Sets the minimum width of an element Sets the width of an element
max-width
1 1 1
6 6 4
2 2 1
Font
On-line examples Property font Description Values IE 4 F 1 N 4 W3C 1 A shorthand property for setting font-style all of the properties for a font in font-variant one declaration font-weight font-size/line-height font-family caption icon menu
message-box small-caption status-bar font-family A prioritized list of font family names and/or generic family names for an element Sets the size of a font family-name generic-family xx-small x-small small medium large x-large xx-large smaller larger length % 3 1 4 1
font-size
font-size-adjust
Specifies an aspect value for an none element that will preserve the x- number height of the first-choice font Condenses or expands the current font-family normal wider narrower ultra-condensed extra-condensed condensed semi-condensed semi-expanded expanded extra-expanded ultra-expanded normal italic oblique normal small-caps normal bold bolder lighter 100 200 300 400 500 600 700 800
font-stretch
font-style
font-variant font-weight
Displays text in a small-caps font or a normal font Sets the weight of a font
4 4
1 1
6 4
1 1
900
Generated Content
Property content Description Values IE F 1 N 6 W3C 2 Generates content in a string document. Used with the :before url and :after pseudo-elements counter(name) counter(name, list-styletype) counters(name, string) counters(name, string, liststyle-type) attr(X) open-quote close-quote no-open-quote no-close-quote Sets how much the counter increments on each occurrence of a selector Sets the value the counter is set to on each occurrence of a selector none identifier number none identifier number 1 6
counter-increment
counter-reset
quotes
4 4 4
1 1 1
6 6 4
1 1 1
decimal-leading-zero lower-roman upper-roman lower-alpha upper-alpha lower-greek lower-latin upper-latin hebrew armenian georgian cjk-ideographic hiragana katakana hiragana-iroha katakana-iroha marker-offset auto length 1 7 2
Margin
On-line examples Property margin Description Values IE 4 F 1 N 4 W3C 1 A shorthand property for setting margin-top the margin properties in one margin-right declaration margin-bottom margin-left Sets the bottom margin of an element Sets the left margin of an element Sets the right margin of an element Sets the top margin of an element auto length % auto length % auto length % auto length %
margin-bottom
margin-left
margin-right
margin-top
Outlines
Property outline Description Values IE F N W3C 2 A shorthand property for setting outline-color 1.5 -
all the outline properties in one declaration outline-color outline-style Sets the color of the outline around an element Sets the style of the outline around an element
outline-style outline-width color invert none dotted dashed solid double groove ridge inset outset thin medium thick length 1.5 1.5 2 2
outline-width
1.5 -
Padding
On-line examples Property padding Description Values IE 4 F 1 N 4 W3C 1 A shorthand property for setting padding-top all of the padding properties in padding-right one declaration padding-bottom padding-left Sets the bottom padding of an element Sets the left padding of an element Sets the right padding of an element Sets the top padding of an element length % length % length % length %
4 4 4 4
1 1 1 1
4 4 4 4
1 1 1 1
Positioning
On-line examples Property bottom Description Values IE 5 F 1 N 6 W3C 2 Sets how far the bottom edge of auto an element is above/below the % bottom edge of the parent length element
clip
Sets the shape of an element. The element is clipped into this shape, and displayed
shape auto
left
Sets how far the left edge of an auto element is to the right/left of the % left edge of the parent element length Sets what happens if the content visible of an element overflow its area hidden scroll auto Places an element in a static, relative, absolute or fixed position static relative absolute fixed
overflow
position
right
Sets how far the right edge of an auto element is to the left/right of the % right edge of the parent element length Sets how far the top edge of an element is above/below the top edge of the parent element auto % length
top
vertical-align
Sets the vertical alignment of an baseline element sub super top text-top middle bottom text-bottom length % Sets the stack order of an element auto number
z-index
Table
Property border-collapse border-spacing Description Values IE 5 F 1 1 N 7 6 W3C 2 2 Sets the border model of a table collapse separate Sets the distance between the borders of adjacent cells (only for the "separated borders" model) Sets the position of the caption according to the table length length
caption-side
right empty-cells Sets whether cells with no visible content should have borders or not (only for the "separated borders" model) Sets the algorithm used to lay out the table show hide 1 6 2
table-layout
auto fixed
Text
On-line examples Property color direction line-height Description Sets the color of a text Sets the text direction Sets the distance between lines Values color ltr rtl normal number length % normal length left right center justify none underline overline line-through blink IE 3 6 4 F 1 1 1 N 4 6 4 W3C 1 2 1
letter-spacing text-align
Increase or decrease the space between characters Aligns the text in an element
4 4
1 1
6 4
1 1
text-decoration
text-indent text-shadow
Indents the first line of text in an length element % none color length Controls the letters in an element none capitalize uppercase lowercase normal embed bidi-override Sets how white space inside an normal
text-transform
unicode-bidi
white-space
Pseudo-classes
On-line examples Pseudo-class :active :focus :hover :link :visited :first-child :lang Purpose Adds special style to an activated element Adds special style to an element when you mouse over it Adds special style to an unvisited link Adds special style to a visited link Adds special style to an element that is the first child of some other element Allows the author to specify a language to use in a specified element IE 4 4 3 3 F 1 1 1 1 1 1 N 8 7 4 4 7 8 W3C 1 2 1 1 1 2 2
Pseudo-elements
On-line examples Pseudo-element :first-letter :first-line :before :after Purpose Adds special style to the first letter of a text Adds special style to the first line of a text Inserts some content before an element Inserts some content after an element IE 5 5 F 1 1 N 8 8 W3C 1 1 2 2
1.5 8 1.5 8
CSS2 Print
Printing HTML documents has always been problematic. In CSS2 the print properties are added to make it easier to print from the Web. The links in the "Property" column point to more useful information about the specific property. W3C: The number in the "W3C" column indicates in which CSS recommendation the property is defined (CSS1 or CSS2). Property orphans marks Description Sets the minimum number of lines for a paragraph that must be left at the bottom of a page Sets what sort of marks should be rendered outside the page box Sets a page type to use when displaying an element Sets the page-breaking behavior after an element Values number none crop cross auto identifier auto always avoid left right auto always avoid left right auto avoid auto portrait landscape number 2 2 2 W3C 2
page page-break-after
page-break-before
page-break-inside size
Sets the page-breaking behavior inside an element Sets the orientation and size of a page
widows
Sets the minimum number of lines for a paragraph that must be left at the top of a page
CSS2 Aural
Aural style sheets use a combination of speech synthesis and sound effects to make the user listen to information, instead of reading information. Aural presentation can be used:
by blind people to help users learning to read to help users who have reading problems for home entertainment in the car by print-impaired communities
The aural presentation converts the document to plain text and feed this to a screen reader (a program that reads all the characters on the screen). An example of an Aural style sheet:
h1, h2, h3, h4 { voice-family: male; richness: 80; cue-before: url("beep.au") }
The example above will make the speech synthesizer play a sound, then speak the headers in a very rich male voice.
cue
A shorthand property for setting cue-before the cue-before and cue-after cue-after properties in one declaration Specifies a sound to be played after speaking an element's content to delimit it from other Specifies a sound to be played before speaking an element's content to delimit it from other Sets where the sound/voices should come from (vertically) none url none url angle below level above higher lower
cue-after
cue-before
elevation
pause
A shorthand property for setting pause-before the pause-before and pause-after pause-after properties in one declaration Specifies a pause after speaking time an element's content % Specifies a pause before speaking an element's content Specifies the speaking voice time % frequency x-low low medium high x-high number
2 2 2
pitch-range
Specifies the variation in the speaking voice. (Monotone voice or animated voice?) Specifies a sound to be played while speaking an element's content
play-during
richness
Specifies the richness in the speaking voice. (Rich voice or thin voice?) Specifies whether content will render aurally Specifies how to handle table headers. Should the headers be spoken before every cell, or only before a cell with a
speak
speak-header
different header than the previous cell speak-numeral speak-punctuation speech-rate Specifies how to speak numbers digits continuous Specifies how to speak punctuation characters Specifies the speed of the speaking none code number x-slow slow medium fast x-fast faster slower number 2 2 2
stress voice-family
2 2
A prioritized list of voice family specific-voice names that contain specific generic-voice voices Specifies the volume of the speaking number % silent x-soft soft medium loud x-loud
volume
CSS Units
CSS Units
Measurements
Unit % in cm mm Description percentage inch centimeter millimeter
em
1em is equal to the current font size. 2em means 2 times the size of the current font. E.g., if an element is displayed with a font of 12 pt, then '2em' is 24 pt. The 'em' is a very useful unit in CSS, since it can adapt automatically to the font that the reader uses one ex is the x-height of a font (x-height is usually about half the font-size) point (1 pt is the same as 1/72 inch) pica (1 pc is the same as 12 points) pixels (a dot on the computer screen)
ex pt pc px
Colors
Unit color_name rgb(x,x,x) rgb(x%, x%, x%) #rrggbb Description A color name (e.g. red) An RGB value (e.g. rgb(255,0,0)) An RGB percentage value (e.g. rgb(100%,0%,0%)) A HEX number (e.g. #ff0000)
CSS Colors
CSS Colors
Colors are displayed combining RED, GREEN, and BLUE light sources.
Color Values
CSS colors are defined using a hexadecimal notation for the combination of Red, Green, and Blue color values (RGB). The lowest value that can be given to one light source is 0 (hex #00). The highest value is 255 (hex #FF). This table shows the result of combining Red, Green, and Blue light sources:. Color Color HEX #000000 #FF0000 #00FF00 #0000FF #FFFF00 Color RGB rgb(0,0,0) rgb(255,0,0) rgb(0,255,0) rgb(0,0,255) rgb(255,255,0)
Color Names
A collection of 147 color names are supported by popular browsers. View the 147 color names
663300 666600 669900 66CC00 66FF00 990000 993300 996600 999900 99CC00 99FF00 CC0000 CC3300 CC6600 CC9900 CCCC00 CCFF00 FF0000 FF3300 FF6600 FF9900 FFCC00 FFFF00
663333 666633 669933 66CC33 66FF33 990033 993333 996633 999933 99CC33 99FF33 CC0033 CC3333 CC6633 CC9933 CCCC33 CCFF33 FF0033 FF3333 FF6633 FF9933 FFCC33 FFFF33
663366 666666 669966 66CC66 66FF66 990066 993366 996666 999966 99CC66 99FF66 CC0066 CC3366 CC6666 CC9966 CCCC66 CCFF66 FF0066 FF3366 FF6666 FF9966 FFCC66 FFFF66
663399 666699 669999 66CC99 66FF99 990099 993399 996699 999999 99CC99 99FF99 CC0099 CC3399 CC6699 CC9999 CCCC99 CCFF99 FF0099 FF3399 FF6699 FF9999 FFCC99 FFFF99
6633CC 6666CC 6699CC 66CCCC 66FFCC 9900CC 9933CC 9966CC 9999CC 99CCCC 99FFCC CC00CC CC33CC CC66CC CC99CC CCCCCC CCFFCC FF00CC FF33CC FF66CC FF99CC FFCCCC FFFFCC
6633FF 6666FF 6699FF 66CCFF 66FFFF 9900FF 9933FF 9966FF 9999FF 99CCFF 99FFFF CC00FF CC33FF CC66FF CC99FF CCCCFF CCFFFF FF00FF FF33FF FF66FF FF99FF FFCCFF FFFFFF
CSS Colorvalues
Color Values
CSS colors are defined using a hexadecimal notation for the combination of Red, Green, and Blue color values (RGB). The lowest value that can be given to one light source is 0 (hex #00). The highest value is 255 (hex #FF).
#FF0000
rgb(255,0,0)
Shades of Gray
Gray colors are displayed using an equal amount of power to all of the light sources. To make it easier for you to select the right gray color we have compiled a table of gray shades for you: RGB(0,0,0) RGB(8,8,8) RGB(16,16,16) RGB(24,24,24) RGB(32,32,32) RGB(40,40,40) RGB(48,48,48) RGB(56,56,56) RGB(64,64,64) RGB(72,72,72) RGB(80,80,80) RGB(88,88,88) RGB(96,96,96) RGB(104,104,104) RGB(112,112,112) RGB(120,120,120) RGB(128,128,128) RGB(136,136,136) RGB(144,144,144) RGB(152,152,152) RGB(160,160,160) RGB(168,168,168) RGB(176,176,176) RGB(184,184,184) RGB(192,192,192) RGB(200,200,200) RGB(208,208,208) RGB(216,216,216) RGB(224,224,224) RGB(232,232,232) RGB(240,240,240) RGB(248,248,248) RGB(255,255,255) #000000 #080808 #101010 #181818 #202020 #282828 #303030 #383838 #404040 #484848 #505050 #585858 #606060 #686868 #707070 #787878 #808080 #888888 #909090 #989898 #A0A0A0 #A8A8A8 #B0B0B0 #B8B8B8 #C0C0C0 #C8C8C8 #D0D0D0 #D8D8D8 #E0E0E0 #E8E8E8 #F0F0F0 #F8F8F8 #FFFFFF
CSS Colornames
DarkKhaki DarkMagenta DarkOliveGreen Darkorange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkSlateGrey DarkTurquoise DarkViolet DeepPink DeepSkyBlue DimGray DimGrey DodgerBlue FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold GoldenRod Gray Grey Green GreenYellow HoneyDew HotPink IndianRed Indigo Ivory Khaki Lavender LavenderBlush LawnGreen LemonChiffon LightBlue LightCoral
#BDB76B #8B008B #556B2F #FF8C00 #9932CC #8B0000 #E9967A #8FBC8F #483D8B #2F4F4F #2F4F4F #00CED1 #9400D3 #FF1493 #00BFFF #696969 #696969 #1E90FF #B22222 #FFFAF0 #228B22 #FF00FF #DCDCDC #F8F8FF #FFD700 #DAA520 #808080 #808080 #008000 #ADFF2F #F0FFF0 #FF69B4 #CD5C5C #4B0082 #FFFFF0 #F0E68C #E6E6FA #FFF0F5 #7CFC00 #FFFACD #ADD8E6 #F08080
LightCyan LightGoldenRodYellow LightGray LightGrey LightGreen LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSlateGrey LightSteelBlue LightYellow Lime LimeGreen Linen Magenta Maroon MediumAquaMarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed MidnightBlue MintCream MistyRose Moccasin NavajoWhite Navy OldLace Olive OliveDrab Orange OrangeRed Orchid PaleGoldenRod PaleGreen PaleTurquoise
#E0FFFF #FAFAD2 #D3D3D3 #D3D3D3 #90EE90 #FFB6C1 #FFA07A #20B2AA #87CEFA #778899 #778899 #B0C4DE #FFFFE0 #00FF00 #32CD32 #FAF0E6 #FF00FF #800000 #66CDAA #0000CD #BA55D3 #9370D8 #3CB371 #7B68EE #00FA9A #48D1CC #C71585 #191970 #F5FFFA #FFE4E1 #FFE4B5 #FFDEAD #000080 #FDF5E6 #808000 #6B8E23 #FFA500 #FF4500 #DA70D6 #EEE8AA #98FB98 #AFEEEE
PaleVioletRed PapayaWhip PeachPuff Peru Pink Plum PowderBlue Purple Red RosyBrown RoyalBlue SaddleBrown Salmon SandyBrown SeaGreen SeaShell Sienna Silver SkyBlue SlateBlue SlateGray SlateGrey Snow SpringGreen SteelBlue Tan Teal Thistle Tomato Turquoise Violet Wheat White WhiteSmoke Yellow YellowGreen
#D87093 #FFEFD5 #FFDAB9 #CD853F #FFC0CB #DDA0DD #B0E0E6 #800080 #FF0000 #BC8F8F #4169E1 #8B4513 #FA8072 #F4A460 #2E8B57 #FFF5EE #A0522D #C0C0C0 #87CEEB #6A5ACD #708090 #708090 #FFFAFA #00FF7F #4682B4 #D2B48C #008080 #D8BFD8 #FF6347 #40E0D0 #EE82EE #F5DEB3 #FFFFFF #F5F5F5 #FFFF00 #9ACD32
TCP/IP Tutorial
TCP/IP Tutorial
TCP/IP is the communication protocol for the Internet. In this tutorial you will learn what TCP/IP is, and how it works.
Your Internet address "201.130.166.179" is a part of the standard TCP/IP protocol. (And so is your domain name "www.someonesplace.com")
TCP/IP Intro
Introduction to TCP/IP
TCP/IP is the communication protocol for the Internet.
What is TCP/IP?
TCP/IP is the communication protocol for communication between computers connected to the Internet. TCP/IP stands for Transmission Control Protocol / Internet Protocol. The standard defines how electronic devices (like computers) should be connected to the Internet, and how data should be transmitted between them.
Inside TCP/IP
Hiding inside the TCP/IP standard there are a number of protocols for handling data communication:
TCP (Transmission Control Protocol) communication between applications UDP (User Datagram Protocol) simple communication between applications IP (Internet Protocol) communication between computers ICMP (Internet Control Message Protocol) for errors and statistics DHCP (Dynamic Host Configuration Protocol) for dynamic addressing
You will learn more about these standards later in this tutorial.
IP is Connection-Less
IP is for communication between computers. IP is a "connection-less" communication protocol. It does not occupy the communication line between two communicating computers. This way IP reduces the need for network lines. Each line can be used for communication between many different computers at the same time. With IP, messages (or other data) are broken up into small independent "packets" and sent between computers via the Internet. IP is responsible for "routing" each packet to its destination.
IP Routers
When an IP packet is sent from a computer, it arrives at an IP router. The IP router is responsible for "routing" the packet to its destination, directly or via another router. The path the packet will follow might be different from other packets of the same communication. The router is responsible for the right addressing depending on traffic volume, errors in the network, or other parameters.
Connection-Less Analogy
Communicating via IP is like sending a long letter as a large number of small postcards, each finding its own (often different) way to the receiver.
TCP/IP
TCP/IP is TCP and IP working together. TCP takes care of the communication between your application software (i.e. your browser) and your network software. IP takes care of the communication with other computers. TCP is responsible for breaking data down into IP packets before they are sent, and for assembling the packets when they arrive. IP is responsible for sending the packets to the receiver.
TCP/IP Addressing
TCP/IP Addressing
TCP/IP uses 32 bits, or 4 numbers between 0 and 255 to address a computer.
IP Addresses
Each computer must have an IP address before it can connect to the Internet. Each IP packet must have an address before it can be sent to another computer. This is an IP address: 192.68.20.50. This might be the same IP address: www.w3schools.com You will learn more about IP addresses and IP names in the next chapter of this tutorial.
32 Bits = 4 Bytes
TCP/IP uses 32 bits addressing. One computer byte is 8 bits. So TCP/IP uses 4 computer bytes. A computer byte can contain 256 different values: 00000000, 00000001, 00000010, 00000011, 00000100, 00000101, 00000110, 00000111, 00001000 .......and all the way up to 11111111. Now you know why a TCP/IP address is 4 numbers between 0 and 255
Domain Names
12 digit numbers are hard to remember. Using a name is easier. Names used for TCP/IP addresses are called domain names. w3schools.com is a domain name. When you address a web site like http://www.w3schools.com, the name is translated to a number by a DNS process (Domain Name Server). All over the world, a large number of DNS servers are connected to the Internet. DNS servers are responsible for translating domain names into TCP/IP addresses and update each other with new domain names. When a new domain name is registered together with a TCP/IP address, DNS servers all over the world are updated with this information.
TCP/IP Protocols
TCP/IP Protocols
TCP/IP is a large collection of different communication protocols.
A Family of Protocols
TCP/IP is a large collection of different communication protocols based upon the two original protocols TCP and IP.
IP - Internet Protocol
IP takes care of the communication with other computers. IP is responsible for the sending and receiving data packets over the Internet.
LDAP is used for collecting information about users and e-mail addresses from the internet.
TCP/IP Email
TCP/IP Email
Email is one of the most important uses of TCP/IP.
You Don't
When you write an email, you don't use TCP/IP. When you write an email, you use an email program like Lotus Notes, Microsoft Outlook or Netscape Communicator.
It sends your emails using SMTP It can download your emails from an email server using POP It can connect to an email server using IMAP
The main difference between the IMAP protocol and the POP protocol is that the IMAP protocol will not automatically download all your emails each time your email program connects to your email server. The IMAP protocol allows you to see through your email messages at the email server before you download them. With IMAP you can choose to download your messages or just delete them. This way IMAP is perfect if you need to connect to your email server from different locations, but only want to download your messages when you are back in your office.
Selected Reading Web Statistics Web Glossary Web Hosting Web Quality W3Schools Forum Helping W3Schools W3Schools provides material for training only. We do not warrant the correctness of its contents. 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-2007 by Refsnes Data. All Rights Reserved.