0
0
HTMLmarkup~20 mins

Absolute vs relative URLs in HTML - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
URL Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Absolute URLs
Which of the following is an example of an absolute URL?
Aimages/photo.jpg
B/images/photo.jpg
C../images/photo.jpg
Dhttps://example.com/images/photo.jpg
Attempts:
2 left
💡 Hint
Absolute URLs include the full path starting with the protocol (like https://).
📝 Syntax
intermediate
1:30remaining
Correct Relative URL Usage
Given the current page URL is https://example.com/blog/post1.html, which relative URL correctly links to https://example.com/images/logo.png?
A../../images/logo.png
B../images/logo.png
C/images/logo.png
Dimages/logo.png
Attempts:
2 left
💡 Hint
Relative URLs starting with a slash / start from the root of the website.
rendering
advanced
2:00remaining
Rendering Result of Relative URL
If the current page is https://example.com/products/item.html and the HTML contains <img src="../images/pic.png" alt="Pic">, what is the full URL the browser will request?
Ahttps://example.com/images/pic.png
Bhttps://example.com/products/images/pic.png
Chttps://example.com/products/../images/pic.png
Dhttps://example.com/pic.png
Attempts:
2 left
💡 Hint
The .. means go up one folder from the current page location.
selector
advanced
2:00remaining
CSS URL Selector Behavior
In CSS, if the stylesheet is located at https://example.com/css/style.css and contains background-image: url('../img/bg.png');, which full URL will the browser load?
Ahttps://example.com/img/bg.png
Bhttps://example.com/css/img/bg.png
Chttps://example.com/css/../img/bg.png
Dhttps://example.com/bg.png
Attempts:
2 left
💡 Hint
Relative URLs in CSS are relative to the CSS file location, not the HTML page.
accessibility
expert
2:30remaining
Accessibility Impact of URL Choices
Which statement best explains how using relative URLs can affect accessibility and user experience?
AUsing relative URLs disables keyboard navigation on the page.
BRelative URLs can break links if the page is moved, causing screen readers to fail loading resources.
CAbsolute URLs prevent any accessibility issues because they never break.
DRelative URLs always improve accessibility by reducing page load times.
Attempts:
2 left
💡 Hint
Think about what happens if a page is moved or copied to a different folder.