Preparing html Flashcards
What must you start your webpage with?
A declaration
e.g. <!DOCTYPE html>
How do you create html structure and content?
To create HTML structure and content, we must add opening and closing <html> tags after declaring <!DOCTYPE html>
What element contains the metadata for a web page?
And should its location be?
<head> </head>
Above the <body> tag.
Metadata is information about the page that isn’t displayed directly on the web page.
How would you name your browser’s tab?
A browser’s tab displays the title specified in the <title> tag. The <title> tag is always inside of the <head>.</title></title>
What element is used to add links to a webpage?
And what is the required attribute?
You can add links to a web page by adding an anchor element <a>.
The required attribute is href=” “
e.g.
<a>This Is A Link To Wikipedia</a></a>
What does the ‘target’ attribute specify?
The target attribute specifies how a link should open.
How do you make a link open a new window?
For a link to open in a new window, the target attribute requires a value of _blank.
The target attribute can be added directly to the opening tag of the anchor element, just like the href attribute.
e.g. target=”_blank”
What is the difference between a relative path and an absolute path?
A relative path is a filename that shows the path to a local file. e.g. ./index.html
Absolute path (a full URL, like https://www.codecademy.com/learn/learn-html which is stored in a different folder.
The ./ in ./index.html tells the browser to look for the file in the current folder.
How would you make an image a link?
You would wrap the element with an anchor element like so e.g.
<a> <img></img> </a>
How would you link a target to the same page?
In order to link to a target on the same page, we must give the target an id attribute and a unique value.
e.g.
<p>This is the top of the page!</p>
<h1>This is the bottom! </h1>
The target link is a string containing the # character and the target element’s id.
e.g.
<ol>
<li><a>Top</a></li>
<li><a>Bottom</a></li>
</ol>
What is used to make reading code easier?
White space and indentation.
two spaces before a line e.g.
<body>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
</body>
How do you add comments to your code?
And why are they helpful?
Comments begin with <!-- and end with -->
Any characters in between will be ignored by your browser.
So you and others can come back and review at a later date.
They allow you to experiment with new code, without having to delete old code.