HTML Flashcards
What does the basic html structure for a website look like?
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
Doctype > defines what kind of file it is
The whole website needs to be embraced by the <html> opening and closing tab </html>
Then we need a head <head></head> and a body <body></body>
The title within the head-section defines how the tab will be named in the browser.
What is the difference between a tag and an element?
Tag is eg. h1
Element is <h1> lorem ipsum </h1>
How have the tags for bold and italic changed within the semantic html?
Bold was previously <b> and is now <strong>
Italic was previously <i> and is now <em> for emphasis</em></i></strong></b>
How do I create an ordered or unordered list in html?
Ordered list
<ol>
<li> lorem ipsum </li>
</ol>
Unordered list
<ul>
<li> lorem ipsum </li>
</ul>
What is meant by the term self-closing tag? Name a few examples.
Self-closing tag means that the tag stands on is own and doesn t need another tag that closes its functionality. Exmaples are <br></br> (line break), <hr> (horizontal line> but also <img></img>
What is meant by ‘attribute’ in html?
Attributes specify the tag they are applied to more. E.g. the tag <img></img> should have the attribute src=”…” alt=”xxx” height=”xx” width=”xx” to make sure the image is displayed properly.
What is the most breaking thing about html?
It is able to link to other files with the <a> tag.
<a> Name of the tag or image or headline etc. </a></a>
Why is there an index.html page on each website?
The index page is basically the home page that is loaded by servers when the url does not specify any other page to be loaded first.
What is meant by the term absolute file path and relative file path in html?
With relative file paths, the files you intend to reference are located in the same folder of your website folder structure. On the other hand, with absolute file paths, you refer to external resources located elsewhere on the web
Name the most important input fields you know by heart and their most important value for a standard form in HTML.
Forms should be started with the <form> </form> element
<input></input> enables text, name specifies the class
<input></input> checks if it s a valid email format and ensures it s typed in
<input></input> masks characters while entering them and ensures the password is longer than 5 characters.
<input></input> opens a date picker to select a date
<input></input> enables a radio button, if only one should be selected bind them in the same class (name)
<input></input> enables a checkbox
<input></input> creates a button to submit the entries with the value variable as the name
<input></input> creates a button to reset the whole form with the value variable as the name
Example:
<form>
First name: <input></input> <br></br>
Last name: <input></input> <br></br>
Email: <input></input> <br></br>
Password: <input></input> <br></br>
Birthday: <input></input> <br></br>
Gender: <br></br>
<input></input> Female
<input></input> Male
<input></input> Other <br></br>
Favorite fruits: <br></br>
<input></input> Mango
<input></input> Banana
<input></input> Apple <br></br>
Diet: <br></br>
<select>
<option>Normal</option><br></br>
<option>Vegetarian</option>
<option>Vegan</option>
<option>Other</option>
</select><br></br>
<input></input>
<input></input>
</form>
With what tag would you add a dropdown to a html form?
With the element <select> </select>
in which I name options like
<option>X1</option>
<option>X1</option>
I can specifiy the Dropdown via a name, e.g. With the element <select> </select>
What happens if you click the submit button when the form is coded like this
<form>
First name: <input></input>
</form>
The GET method will be applied, that means all specified parameters will be added to the URL to send the information to the server (also passwords).
It will be added with a ? at the end and each additional parameter will be added through a &
That is why it is so important to define the ‘name’ and the ‘value’ of each added tag to specifiy the parameter and the value the user has provided.
How can you comment within a html code?
<!-- This is a comment -->
As this is tidious to type each time the editors have most of the time shortcut.
in Sublime it’s ‘ctrl’ + Slash
When would you use the tags div and span? How are they differentiated?
The elements <div> </div> and span <span></span> can be used to cluster content to which the same styling e.g. css should apply. Basically the divide the code into sections.
<div> is used for whole blocks, whereas <span> is used for single lines.
</span></div>
What does the term backwards competability mean?
Older versions are not obsolute and can be still used when a newer/ later version of a new language, program etc. are released.