HTML Input Attributes

The value Attribute The value attribute specifies the initial value for an input field: Example <form action=””> First name:<br> <input type=”text” name=”firstname” value=”John”> </form> Try it Yourself » The readonly Attribute The readonly attribute specifies that the input field is read only (cannot be changed): Example <form action=””> First name:<br> <input type=”text” name=”firstname” value=”John” readonly> </form> Try it Yourself » The disabled Attribute The disabled attribute specifies that the input […]

HTML Images

Images can improve the design and the appearance of a web page. HTML Images Syntax In HTML, images are defined with the <img> tag. The <img> tag is empty, it contains attributes only, and does not have a closing tag. The src attribute specifies the URL (web address) of the image: <img src=”url“> The alt Attribute The alt attribute provides an alternate text for an […]

HTML Lists

HTML List Example An Unordered List: Item Item Item Item An Ordered List: First item Second item Third item Fourth item Try it Yourself » Unordered HTML List An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. The list items will be marked with bullets (small black circles) by default: Example <ul> […]

HTML Block and Inline Elements

Every HTML element has a default display value depending on what type of element it is. The default display value for most elements is block or inline. Block-level Elements A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as […]

HTML The class Attribute

Using The class Attribute The class attribute specifies one or more class names for an HTML element. The class name can be used by CSS and JavaScript to perform certain tasks for elements with the specified class name. In CSS, to select elements with a specific class, write a period (.) character, followed by the name of […]

HTML The id Attribute

Using The id Attribute The id attribute specifies a unique id for an HTML element (the value must be unique within the HTML document). The id value can be used by CSS and JavaScript to perform certain tasks for a unique element with the specified id value. In CSS, to select an element with a specific id, […]

HTML Iframes

An iframe is used to display a web page within a web page. Iframe Syntax An HTML iframe is defined with the <iframe> tag: <iframe src=”URL“></iframe> The src attribute specifies the URL (web address) of the inline frame page. Iframe – Explaination Use the height and width attributes to specify the size of the iframe. The attribute values are specified in pixels by default, […]

HTML JavaScript

JavaScript makes HTML pages more dynamic and interactive. Example My First JavaScript Click me to display Date and Time Try it Yourself » The HTML <script> Tag The <script> tag is used to define a client-side script (JavaScript). The <script> element either contains scripting statements, or it points to an external script file through the src attribute. Common uses for JavaScript […]

HTML File Paths

Path Description <img src=”picture.jpg”> picture.jpg is located in the same folder as the current page <img src=”images/picture.jpg”> picture.jpg is located in the images folder in the current folder <img src=”/images/picture.jpg”> picture.jpg is located in the images folder at the root of the current web <img src=”../picture.jpg”> picture.jpg is located in the folder one level up […]

HTML Head

The HTML <head> Element The <head> element is a container for metadata (data about data) and is placed between the <html> tag and the <body> tag. HTML metadata is data about the HTML document. Metadata is not displayed. Metadata typically define the document title, character set, styles, links, scripts, and other meta information. The following tags describe metadata: <title>, <style>, <meta>, <link>, <script>, and <base>. The HTML […]

HTML Layouts

HTML Layout Elements Websites often display content in multiple columns (like a magazine or newspaper). HTML5 offers new semantic elements that define the different parts of a web page: <header> – Defines a header for a document or a section <nav> – Defines a container for navigation links <section> – Defines a section in a […]

HTML Computer Code Elements

Computer Code <code> x = 5;<br> y = 6;<br> z = x + y; </code> Try it Yourself » HTML <kbd> For Keyboard Input The HTML <kbd> element represents user input, like keyboard input or voice commands. Text surrounded by <kbd> tags is typically displayed in the browser’s default monospace font: Example <p>Save the document by pressing <kbd>Ctrl + S</kbd></p> […]

HTML Entities

Reserved characters in HTML must be replaced with character entities. Characters that are not present on your keyboard can also be replaced by entities. HTML Entities Some characters are reserved in HTML. If you use the less than (<) or greater than (>) signs in your text, the browser might mix them with tags. Character […]

HTML Symbols

HTML Symbol Entities HTML entities were described in the previous chapter. Many mathematical, technical, and currency symbols, are not present on a normal keyboard. To add such symbols to an HTML page, you can use an HTML entity name. If no entity name exists, you can use an entity number, a decimal, or hexadecimal reference. […]

HTML Encoding (Character Sets)

To display an HTML page correctly, a web browser must know which character set (character encoding) to use. What is Character Encoding? ASCII was the first character encoding standard (also called character set). ASCII defined 128 different alphanumeric characters that could be used on the internet: numbers (0-9), English letters (A-Z), and some special characters like ! […]

HTML Uniform Resource Locators

A URL is another word for a web address. A URL can be composed of words (w3schools.com), or an Internet Protocol (IP) address (192.68.20.50). Most people enter the name when surfing, because names are easier to remember than numbers. URL – Uniform Resource Locator Web browsers request pages from web servers by using a URL. […]

HTML and XHTML

XHTML is HTML written as XML. What Is XHTML? XHTML stands for EXtensible HyperText Markup Language XHTML is almost identical to HTML XHTML is stricter than HTML XHTML is HTML defined as an XML application XHTML is supported by all major browsers Why XHTML? Many pages on the internet contain “bad” HTML. This HTML code works fine in […]

HTML Links

Links are found in nearly all web pages. Links allow users to click their way from page to page. HTML Links – Hyperlinks HTML links are hyperlinks. You can click on a link and jump to another document. When you move the mouse over a link, the mouse arrow will turn into a little hand. […]

HTML Styles – CSS

Styling HTML with CSS CSS stands for Cascading Style Sheets. CSS describes how HTML elements are to be displayed on screen, paper, or in other media. CSS saves a lot of work. It can control the layout of multiple web pages all at once. CSS can be added to HTML elements in 3 ways: Inline – by using the style attribute in […]

HTML Colors

HTML colors are specified using predefined color names, or RGB, HEX, HSL, RGBA, HSLA values. Color Names In HTML, a color can be specified by using a color name: Try it Yourself » Background Color You can set the background color for HTML elements: Example <h1 style=”background-color:DodgerBlue;”>Hello World</h1> <p style=”background-color:Tomato;”>Lorem ipsum…</p> Try it Yourself » Text Color […]