Basic HTML | Working with links Flashcards
What does the target attribute do in anchor elements?
It tells the browser where to open the URL for the anchor element.
This is crucial for user navigation on websites.
What is the default value of the target attribute?
_self
This opens the link in the current browsing context.
What does the target value _blank do?
Opens the link in a new browsing context.
Typically opens in a new tab, but can also open in a new window depending on user browser settings.
What is the function of the target value _parent?
Opens the link in the parent of the current context.
For instance, it opens in the main tab/window if used within an iframe.
What does the target value _top do?
Opens the link in the top-most browsing context.
This means it opens in the full browser tab/window, regardless of nested frames.
What is the fifth target value mentioned, and what is its purpose?
_unfencedTop
It is used for the experimental FencedFrame API and may not be relevant for general use yet.
Why is selecting the right target value important when creating a website?
It controls where users end up after clicking a link.
This can significantly affect user experience and navigation flow.
What is a path in the context of file systems?
A path is a string that specifies the location of a file or directory in a file system.
What are the two types of paths discussed?
Absolute paths and relative paths.
What is an absolute path?
A complete link to a resource, starting from the root directory and including every directory, filename, and extension.
What does an absolute path include when linking to a resource on the web?
The protocol (http, https, file) and the domain name.
Provide an example of an absolute path.
https://design-style-guide.freecodecamp.org/img/fcc_secondary_small.svg
What is the root directory?
The top-level directory or folder in a hierarchy.
How is an absolute path structured for a local file?
It includes the full path from the root directory to the filename.
What is a relative path?
A path that specifies the location of a file relative to the directory of the current file.
What does a relative path not include?
The protocol or the domain name.
Provide an example of a relative path.
about.html
When should you use absolute paths?
When linking to a resource hosted on an external website or when the link needs to work consistently regardless of document location.
When should you use relative paths?
When linking to resources within the same website or when you want cleaner code.
True or False: Relative paths are preferable during local testing.
True
Fill in the blank: An absolute path includes the _______.
[root directory, all directories, filename, and extension]
What is the benefit of using relative paths during development?
They keep the code cleaner and easier to maintain.
What are file paths?
Special types of links that indicate the location of files and directories
What is the first key syntax for file paths?
The slash, which can be a backslash () or forward slash (/)