4 Links Flashcards
Create a link to an external website
<a href=”http://www.imdb.com”>IMDB</a>
What happens with this code?
<a href=”www.imdb.com”>IMDB</a>
Goes to the relative location, looks for www.imdb.com within the same folder as your html file is.
have to use http:// before the website so it knows to look on the web.
What does URL stand for
Uniform Resource Locator.
Difference between absolute URL and relative URL
Absolute starts with the domain name for that site.
Relative don’t need to specify domain name.
Create a relative link to another page of your website
<a href=”index.html”>Home</a>
What does href stand for
Hypertext reference
Reference a file in the same folder
<a href=”reviews.html”> Reviews </a>
Reference a file in a child or grandchild folder
(1 folder forward)
<a href=”music/listings.html”> Listings </a>
Reference a file in a parent or grandparent folder
(2 folders back)
<a href=”../../index.html”> Home </a>
What happens if you reference a folder without referencing a file?
It looks for index.html
If not there it shows the folders contents
What happens when you reference forward slash (/) ?
Usually returns the homepage of entire site (index.html or shows folder contents if not there)
It will show the hard drive if just opened the HTML file from file explorer
Will show the directory of file that started the live server if started from live server
Likely website homepage if opened on a website.
Create an email address link
mailto:emailaddress within the href attribute
<a href=”mailto:jon@example.org”>Email Jon</a>
Difference between attribute, attribute name and value?
href=”website”
href is attribute name
website is value
whole thing is attribute
Open up a link in a new window
target=”_blank” attribute
link to another part of a page
create an id with the id attribute (within any element tag)
id=”prologue”
then link to it with an href attribute in an anchor tag and a number sign within the value
href=”#prologue”