- Introduction
- HTML Document
- Basic Structure
- Comments
- Elements
- Document Structure Elements
- Metadata Elements
- Sections and Layout Elements
- Headings
- Text Content Elements
- Inline Text Semantic Elements
- Media Elements
- Form Elements
- Table Elements
- Interactive Elements
- Scripting / Template Elements
- Edit Elements
- Semantic, Void and Nested Elements
- Block-level and Inline Elements
- Semantic vs. Non-Semantic Elements
- Attributes
- Favicon
- Colors
- File Paths
- URL (Uniform Resource Locator)
- Responsive Web Design
URL (Uniform Resource Locator)
Learn what a URL is, its components, and how it locates resources on the internet.
HTML Uniform Resource Locators (URLs) specify the location of a web resource, such as a web page, image, or file.
URLs consist of several parts as follows:
- Scheme/Protocol: The scheme or protocol indicates the type of internet service.
The most common scheme is http:// for Hypertext Transfer Protocol, used for regular web pages, while https:// is used for secure connections.
-
Prefix: Specifies a prefix in the domain name (for example, www).
-
Domain/Host: The domain or host identifies the Internet domain name.
For example, example.com.
- Port: The port number is optional and specifies a specific network port on the server where the resource resides.
If no port is specified, the default port for the chosen protocol is used (e.g., port 80 for HTTP and port 443 for HTTPS).
- Path: The path indicates the specific location or file on the server that you want to access.
It represents the directory structure on the server's file system.
For example, in the URL "https://www.example.com/path/to/about.html", "/path/to/about.html" is the path.
- Query Parameters: Query parameters are used to pass additional information to the server. They are appended to the URL after a question mark "?" and separated by ampersands "&". Each parameter consists of a key-value pair.
For example, in the URL "https://www.example.com/search?query=about&page=1", the query parameters are "query=about" and "page=1".
- Fragment Identifier: The fragment identifier (or anchor) refers to a specific section or location within a webpage.
It is indicated by a hash symbol "#" followed by an identifier.
For example, in the URL "https://www.example.com/page#section1", "#section1" is the fragment identifier.
Here's an example of a complete URL:
https://www.shop.com/products/footwear?category=sneaker&color=white#footwearsection
In the above example, "https://" is the protocol, "www" is the prefix, "shop.com" is the domain name, "/products/footwear" is the path, and "category=sneaker&color=white" is the query parameter and "footwearsection" is the fragment identifier.