Menu

  •    
  • Home
  • Digital Accessibility
  • Web Accessibility Testing
    • Testing Principles
    • Automated Testing
  • Accessible Learning Materials
  • Development Principles
  • Inclusion in the learning process
  • HTML
    • HTML Syntax
    • Text Tags
  • CSS
    • CSS Syntax
    • Text Formatting CSS
  • PHP
    • PHP Syntax
    • PHP Functions

Contacts

  • t.todorov@ts.uni-vt.bg
  • 5003 Veliko Tarnovo, Bulgaria, Teodosii Turnovski St. #2

HTML Syntax

Basic rules of HTML syntax

An HTML element is any structural area of ​​a web page. Items are tagged. The syntax of an HTML element is:

<tagname>element content</tagname>

This shows that each element consists of an opening tag, a content tag, and a closing tag. There are also elements that have no content - they are empty elements and there is no closing tag for them.

Examples:
<h1>Web design with HTML</h1>
<p>HTML is a basic markup language.<br>HTML5 is the latest version of the language.</p>
Empty elements can be marked with a trailing slash, for example <br/>, but this is not required in HTML5, only recommended. Attributes can also be added to tags - they are additions describing properties of elements. Attributes can have values ​​that specify more variants of the markup. Attributes and values ​​are written only in the opening tag of an element.

The attribute syntax is: name=“value”

Example:
<img src=“image1.jpg” alt=”book cover”>
For a given tag, some attributes are required and others are optional. An attribute value can be enclosed in quotes or apostrophes, but this is only required if the value contains a space. HTML5 syntax allows for lowercase and uppercase letters for tags and attributes. It is recommended to use lowercase letters. It is also recommended that the value of an attribute be enclosed in quotes. This element is nested and is entirely part of the content of another element. HTML5 syntax requires nesting order to be respected and the last open element to be closed first.

<!DOCTYPE html> <html> <body> <h1>New products</h1> <p>Our <b>latest</b> products are ... </p> </body> </html>