HTML/SASS Flashcards
Document Object Model
Tree-likes structure of HTML Web Page
Ex: Root is < html > having two children < head > and and < body > so on
HTML Tag
Pair of open/end
Ex: < html > < / html>
HTML Attribute
Addition about some structure or info of HTML Tag
Ex: < html lang = “en” > < div class = “general” >
< head > and < body >
< head > contains infomation for web browser
Ex: having < title > and < script > < href > tags
contains what to show to user
Basic HTML structure
< !DOCTYPE html > < html > < head > < title > Hello! < / title > < / head > < body > < h1 > Hello World < / h1 > < p > Nice to meet you < / p > < / body > < / html >
HTML Lists
< ul > or < ol > < li > 1st < / li > < li > 2nd < / li > < li > 3rd < / li > < / ul > or < / ol >
HTML Images
< / img src=”Link of images” alt=”Alternate text if cannot display the image properly” >
HTML Link
< a href = “Destination Web (Absolute URL or relative URL) > Text to display (Ex: “Click Here”) < / a >
HTML Table
< table >
< thead > Name for each columns / feature of table < tr > < th > Ocean Name < / th > < th > Average Depth < / th > < th > Maximum Depth < / th > < / tr > < / thead > < tbody > < tr > Each tr occupy one columns in table < td > Pacific Ocean < / td > < td > 4,654m < / td > < td > 8,567m < / td > < / tr > < tr > < td > Alantic Ocean < / td > < td > 2,424m < / td > Each td is a data cell < td > 6,224m < / td > < / tr > < / tbody > < / table >
HTML Form
HTML < form > contains some < input > for user to interact
Attributes for < input >:
- type = “” : represent the way user input data input that input tag. Some examples: “text” for text, “password” for text but hidden, multiple “radio” < input > tag for multiple choice
- placeholder = “initial text show in text box input”
- name = “ref name” : An attribute saves a unique name for that input tags later serves as an reference names for Web Application to be able to pick and handle information from that input tags.
- value = “value” : the result of user input that Web App receive, using in tags that not text (radio)
- list = “list name” : new HTML5 feature able to scroll for a list, shrink down into correct option when types in
Web App use “name” to get input tags, and take value from “value” attribute
< form >
< div >
< input name=”username” type=”text” placeholder=”Your Name” >
< input name=”password” type=”password” placeholder=”Password” >
< / div >
< div >
Favorite Colors ? Four input tags same name attribute serve as one input in Web apps
< input name=”color” type=”radio” value=”red” >
< input name=”color” type=”radio” value=”green” >
< input name=”color” type=”radio” value=”yellow” >
< input name=”color” type=”radio” value=”blue” >
< / div >
< div >
< input name=”country” list=”countries” placeholder=”Country” >
< datalist id=”countries” >
< option value=”Murica” >
< option value=”French Fries” >
…
< / div >
< / form >
HTML Link
Link tag use for link this HTML file with other files by some relationship specified by “rel” attribute:
Ex: < link rel=”stylesheet” href=”styles.css” >
The HTML file is linking to styles.css file (href for the targeted file for linking to) with a relationship of a stylesheet meaning the file that linked will specify the style for this HTML.
External CSS
styles.css: h1 { color: blue; text-align: center; } index.html: < !DOCTYPE html > < html > < head > < title > Hello! < / title > < link rel="stylesheet" href="styles.css" > < / head > < body > < h1 > Hello World < / h1 > < h1 > This is TITLES < / h1 > < p > Nice to meet you < / p > < / body > < / html >
Internal CSS
< !DOCTYPE html > < html > < head > < title > Hello! < / title > < style > h1 { color: blue; text-align: center; } div { background-color: green; width: 400px; height: 100px; < / style > < / head > < body > < div > < h1 > Hello World < / h1 > < h1 > This is TITLES < / h1 > < p > Nice to meet you < / p > < / div > < / body > < / html >
CSS Padding Margin
Padding adjusts how far the tag’s children element from its border (space out distance inside)
Margin adjusts how far the tag border from its parent or its siblings element (space out distance outside)
CSS Table Example
table { border: 1px solid black; border-collapse: collapse; td, th { border: 1px solid black; padding: 5px; }