-
What is HTML
-
Hyper Text Markup Language. Hypertext is text which contains links to other texts. One document points to another document which points to a bunch of other documents... Markup means to mark something up, to annotate. It's really all about content, and you want to annotate the content to tell the browser what this content is. Language basically implies that it has its own syntax meaning there's a right and a wrong way to code it.
-
-
HTML Tags
-
Basic HTML Document Structure
- W3C web validator
<!doctype html>-
All it does is tell the browser that it should get ready to render HTML. This declaration is really largely historical. When HTML standards were first becoming popular, the web was full of pages that were not compliant with the standards. To help browsers render those pages correctly, browsers used the doctype declaration to distinguish between noncompliant and compliant pages. Noncompliant pages were rendered in what's called the quirks mode, and the compliant pages were rendered in what's called the standards mode. Now, that's all historical. But what you need to know today is that if you leave off the HTML page declaration, that will signal to the browser that it should treat your pages as one not following HTML standard.
-
<html>tag<head>tag-
It can contain authors description of the page, page title, and whatever other external resources are needed to render the page properly, among other things. The point is it contains some metadata about the main content.
-
<body>tag- "Renders or interprets the HTML code sequentially from top to bottom"
-
HTML Content Models
-
The term content model refers to the full behavior the browser applies to the elements belonging to that content model, and to the nesting rules of those elements. In other words, which elements are allowed to be nested inside which other elements. All elements fall into basically two categories under the traditional content model structure: block level elements or inline elements. Block level elements render to begin on the new line by default. So what that means is every time you specify a block-level element in HTML, the browser will automatically place that element on a new line in the flow of the document. Block-level elements are allowed to contain inline or other block-level elements within them. This is in contrast to inline elements, which render on the same line by default. Which means if you put a bunch of inline elements next to each other, they will all be going on the same line, as if there is no new line character present. Inline elements also have a restriction that they can only contain other inline elements.
<div>tag-
The div element stands for division. It is the most generic block-level element.
-
<span>tag-
The span element stands for span. It is the most generic inline element.
-
- Demo
-
Even though span is an inline element, since DIV 2 requires that it be on its own line. It pushes the next inline element to its own line as well. And this is exactly what happens with DIV 3.
-
The new line characters that follow the div tags make absolutely no difference to the HTML page and how it renders.
-
-
-
Heading Elements
<h1>,<h2>,<h3>,<h4>,<h5>,<h6>- More tags
<article>: doc<section><aside><footer>
-
Lists
- Unordered List
<ul> - Ordered List
<ol> - List Item
<li>
- Unordered List
-
HTML Character Entity References
- An HTML entity is a piece of text ("string") that begins with an ampersand (&) and ends with a semicolon (;)
- Escape
< == <,> == >,& == &
- A list of Character Entity
-
Creating Links
<a>hrefattribute: hypertext reference- Internal Link
- External Link
- Anchor Link
-
Displaying Images
-
<img>: inline element -
widthandheightattribute -
altattribute -
Demo: How to use Developer Tools
-
What is CSS
- Cascading Style Sheet
-
CSS basics
- Selector
- Declaration
- Property
- Value
-
Element, Class, and ID selector
- Element Selector
- Class Selector
- ID Selector
*(universal) selector- Group Selectors
-
Combining selector
- Element with class selector
p.className(every<p>with class nameclassName) - Child Selector
article > p(every<p>directly inside<article>) - Descendant Selector
article p(every<p>inside<article>)
- Element with class selector
-
Pseudo-class selector
selector:pseudo-class {}visitedhovernth_child
-
Style Placement
- On element
- On
<style> - On
cssfile (In real-life prefer this)
-
Conflict Resolution
-
The Box Model
-
Position elements (floating)
floattakes element out or the regular document flow- Margin at the top of the box (no cumulative margin now)
- Why clear both?
-
Element positioning
- Static Positioning: normal document flow
- default for tags except
<html>
- default for tags except
- Relative Positioning: element is positioned relative to its position in normal document flow
- not taken out of the normal document flow
top,right,bottom,left<html>has relative
- Absolute Positioning
- element is taken out from the normal document flow
- "All offsets (top, bottom, left, right) are relative to the position of the nearest ancestor which has positioning set on it, other than static."
- What happens if
floatis combined with relative/absolute?
- Static Positioning: normal document flow
-
Media Query and Responsive Design
-
"Media queries allow you to group styles together and target them to devices based on some criteria."
-
General Syntax
@media (media-feature) {/* styles inside */} -
Media features
min-width: 768pxmax-width: 768pxprint
-
Logical Operator
and:(min-width: 768px) and (max-width: 991px)(query devices within a range),(or):(max-width: 767px) , (min-width: 992px)(query devices at least 992px or at most 767px)
-
Not to overlap boundary: otherwise, all the styles will be applied
-
Responsive Design
-
-
More to Explore
- Styling Text
- Styling Background
- Element Positioning:
fixedandsticky - Bootstrap
-
What is JavaScript
-
Where to put the script
<script>- Differences between href and src
-
Define variables, Functions, and Scope
varfunction- Scope
- Global: variables/functions defined here are available everywhere
- Function: only available within this function
- Lexical Scope vs. Dynamic Scope (JS uses Lexical Scope)
- Scope Chain
- Execution Contexts: JavaScript Execution Context – How JS Works Behind the Scenes
- Differences between
varandlet- Read the previous link about execution context first
- Difference between var and let in JavaScript
- let
-
Types
-
Objects
- Basics
- Constructor
- Prototype
this
-
Array, Closure, and Namespaces
- Array
- Closures
- IIFE
- Summary
- HTML = "skeleton"; CSS = "skin"; JS = interaction
- A brief overview of web dev (three stages)
- Backend render the page (PHP...)
- Frontend requests backend API and renders the page at the frontend (react, Vue, angular... + some backend services)
- Frontend requests + some server-side rendering (next.js...)
This week's material is from HTML, CSS, and JavaScript for Web Developers. It contains only a small portion of the content discussed in the course. If you are interested in front-end development, you can take the entire course for free at Coursera.









