===== HTML (HyperText Markup Language) =====
==== XML, a structured data description language ====
XML (eXtensible Markup Language) is a universal data description language readable by both humans and machines, used for structured data storage and transfer.
Example:
The structures ''mail'', ''from'', ''to'', etc., are called **tags** or **elements**.
Tags can have **attributes** (e.g. the identifier of the mail).
HTML documents, which describe the content of web pages, are also written in XML, using standardized elements with specific meanings to format or structure content.
==== Development Environment ====
For practicing HTML, we will use [[https://code.visualstudio.com/|Visual Studio Code]] (VSCode), the open-source code editor developed by Microsoft.
After VSCode is started, **Live Server** extension should be installed. To do this, click on the following icon, in the left sidebar:
{{:tanszek:oktatas:techcomm:pasted:20240923-091837.png}}
Then search **Live Server**, and click the "Install" button on the following result:
{{:tanszek:oktatas:techcomm:pasted:20240923-092114.png}}
If the extension installed successfully, you can see the following button in the bottom right corner of VSCode:
{{:tanszek:oktatas:techcomm:pasted:20240923-092231.png}}
To initialize a new project, create a new folder with File Explorer, then open this folder in VSCode (File > Open folder...).
Then, create a new file called **index.html**.
Copy the code from the next section, then save your HTML file (Ctrl+S).
Now, push the "Go Live" button, and open http://localhost:5500/ on your browser (it may be automatically opened by Live Server extension). If you change the code of the HTML file, the content will also be updated in the browser.
==== Basic Structure of an HTML Document ====
An HTML document mainly consists of three main parts: '''', ''
Page Title
Heading 1
This is a paragraph.
This is also a paragraph.
The '''' tag is used to declare the document type and version of HTML being used. It ensures that the web browser renders the page correctly by telling it what type of HTML (e.g., HTML5) the document is written in. More information is [[https://www.w3schools.com/tags/tag_doctype.asp|available here]].
The ''html'' tag encapsulates the whole content, it is the root of the HTML document.
The ''head'' section contains metadata about the page, such as the title between ''
University of Miskolc is a higher education institution in Miskolc.
The institution operates as a true university, with wide-ranging programs across eight faculties...
It can be used to make our code more transparent and understandable for developers.
==== Headings and Paragraphs ====
Headings are defined using the '''' element.
This is a paragraph. This is a paragraph. This is also a paragraph. This is a paragraph. This is a paragraph.
==== Text Formatting and Structuring ====
Elements like ''Heading Level 1
Heading Level 2
Heading Level 3
Heading Level 4
'', ''
This is a small text.
This is a second line
with a line break.
Subscript and superscript: Pi = I2R
This is a bold text.
1st paragraph
2nd paragraph
3rd paragraph
''
Internal page link
External website link
Email link
Phone number link
==== Images ====
Images are inserted using the '''' element, with the ''src'' attribute specifying the path to the image and the ''alt'' attribute providing an explanatory text.
In this example, ''src'' contains an **absolute URL**, the image will be downloaded from the server behind the www.uni-miskolc.hu domain.
In addition to this, we can define **relative URL**s to our HTML file. For example, if we have a folder ''imgs'' next to our HTML document, and a file called ''main_building.png'' in this folder, we can refer to it as:
Try downloading an image from the internet, and using a relative URL in your HTML document!
==== Ordered and Unordered Lists ====
For ordered lists, you can use the ''
The final result of the sports day:
- Computer Scientists
- Mechanical Engineers
- Chemical Engineers
We should buy today:
- apples
- milk
- bread
==== Tables ====
To create tables, use the following elements:
* '''': table header * '' | '': table data cell
''colspan'' is an **attribute**, and is used here to merge 2 table cells in the row. Attributes are used often to define certain properties of HTML elements (e.g. styling, alternative text, etc.).
==== Exercise ====
Create an introduction page on your favorite topic (music, film, product, etc.) using headings, paragraphs, images, links, tables, and lists.
Feel free to use online resources (e.g. [[https://www.w3schools.com/html/|W3Schools HTML tutorial]]) as help.
|
---|