Coursera课程笔记:HTML, CSS, and Javascript for Web Developers

目录

  • Week 1: Introduction to HTML5
    • 1、Welcome to HTML, CSS, and Javascript for Web Developers!
    • 2、Development Environment Setup
      • Github and Browser Sync
      • Resources for Asking Questions
    • 3、HTML Basic
      • Lecture 1: What is HTML?
      • Lecture 2: Relevant History of HTML
      • Lecture 3: Anatomy of an HTML Tag
      • Lecture 4: Basic HTML Document Structure
      • Lecture 5: HTML Content Models
    • 4、Essential HTML5 tags
      • Lecture 6: Heading Elements (and some new HTML5 semantic comments)
      • Lecture 7: Lists
      • Lecture 8: HTML Character Entity References
      • Lecture 9: Creating Links
      • Lecture 10: Displaying Images
  • Week 2: Introduction to CSS3
    • 1、Cascading Style Sheets Basics
      • Lecture 11: Power of CSS
      • Lecture 12: Anatomy of a CSS Rule
      • Lecture 13: Element, Class, and ID Selectors
      • Lecture 14: Combining Selectors
      • Lecture 15: Pseudo-Class Selectors
    • 2、CSS Rules Conflict Resolution and Text Styling
      • Lecture 16: Style Placement
      • Lecture 17: Conflict Resolution
      • Lecture 18: Styling Text
    • 3、The Box Model and Layout
      • Lecture 19: The Box Model
      • Lecture 20: The background Property
      • Lecture 21: Positioning Elements by Floating
      • Lecture 22: Relative and Absolute Element Positioning
    • 4、Introduction to Responsive Design
      • Lecture 23: Media Queries
      • Lecture 24: Responsive Design
    • 5、Introduction to Twitter Bootstrap
      • Lecture 25: Introduction to Twitter Bootstrap
      • Lecture 26: The Bootstrap Grid System
  • Week 3: Coding the Static Restaurant Site
    • 1、Visit with the client & Setup Overview
      • Lecture 27: Visit with the Client
      • Lecture 28: Design Overview
      • Lecture 29: Some Ground Rules and Overview of Setup
    • 2、Coding the Navigation Bar of the Site
      • Lecture 30: Coding Basics of Navbar Header
      • Lecture 31: Coding Button for Future Collapsible Menu
      • Lecture 32: Coding Nav Menu Buttons
      • Lecture 33: Fixing Navbar Layout, Text, and Dropdown Menus
    • 3、Coding the Homepage and the Footer
      • Lecture 34: Coding the Jumbotron
      • Lecture 35: Coding Navigation Tiles
      • Lecture 36: Coding the Footer
    • 4、Coding the Restaurant Menu Pages
      • Lecture 37: Coding the Menu Categories
      • Lecture 38: Coding the Single Menu Category Page
      • Lecture 39: Testing the Mobile Version on a Real Phone
  • Week 4: Introduction to JavaScript
    • 1、JavaScript Basics
      • Lecture 40: Adjusting Development Environment for JavaScript Development
      • Lecture 41: Defining Variables, Function, and Scope
    • 2、JavaScript Types and Common Language Constructs
      • Lecture 42: JavaScript Types
      • Lecture 43: Common Language Constructs
      • Lecture 44: Handling Default Values
    • 3、Objects and Functions in JavaScript
      • Lecture 45: Creating Objects Using 'new Object()' Syntax
      • Lecture 46: Functions Explained
      • Lecture 47: Passing Variables by Value vs. by Reference
      • Lecture 48: Function Constructors, prototype, and the 'this' Keyword
      • Lecture 49: Object Literals and the 'this' Keyword
    • 4、Arrays, Closures, and Namespaces
      • Lecture 50: Arrays
      • Lecture 51: Closures
      • Lecture 52, Part 1: Fake Namespaces
      • Lecture 52, Part 2: Immediately Invoked Function Expressions (IIFEs)
  • Week 5: Using Javascript to Build Web Applications
    • 1、Document Object Model Manipulation
      • Lecture 53: DOM Manipulation
      • Lecture 54: Handling Events
      • Lecture 55: The 'event' Argument
    • 2、Introduction to Ajax
      • Lesson 56: HTTP Basics
      • Lesson 57, Part 1: Ajax Basics
      • Lesson 57, Part 2: Ajax Basics
      • Lesson 57, Part 3: Ajax Basics
      • Lecture 58: Processing JSON
    • 3、Using Ajax to Connect Restaurant Site with Real Data
      • Lecture 59: Fixing Mobile Nav Menu Automatic Collapse
      • Lecture 60: Dynamically Loading Home View Content
      • Lecture 61, Part 1: Dynamically Loading Menu Categories View
      • Lecture 61, Part 2: Dynamically Loading Menu Categories View
      • Lecture 62: Dynamically Loading Single Category View
      • Lecture 63: Changing 'active' Button Style Through Javascript

课程地址: https://www.coursera.org/learn/html-css-javascript-for-web-developers
w3schools: https://www.w3schools.com/html/

Week 1: Introduction to HTML5

1、Welcome to HTML, CSS, and Javascript for Web Developers!

推荐的书:Soft Skills: A Developer’s Life Manual by John Sonmez
 
The following is a link to a GitHub.com repository we are using for this course:

https://github.com/jhu-ep-coursera/fullstack-course4

It contains:

  1. Source code for ALL examples used in this course
  2. Lecture Slide PDFs
  3. Starter code for end of module assignments.

2、Development Environment Setup

Github and Browser Sync

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第1张图片

其中,Browser Sync用途:在本地编辑代码然后保存后,可以即时显示在浏览器中
安装方法:
要先安装Node.js,然后打开命令行或者Node.js command prompt:

// 配置国内的npm源:
npm config set registry https://registry.npm.taobao.org 
// 配置后可通过下面方式来验证是否成功 
npm config get registry 
// 安装
npm install -g browser-sync
// 验证是否安装成功
browser-sync --version

使用:在对应的文件夹中输入命令(在命令行)

browser-sync start --server --directory --files "*" 

Resources for Asking Questions

  1. stackoverflow.com
  2. https://jsfiddle.net/ : 在网页中输入代码,复制链接,重新打开后仍然可见
  3. codepen.io : 功能比第二个网站更强大

3、HTML Basic

Lecture 1: What is HTML?

summary:
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第2张图片

Lecture 2: Relevant History of HTML

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第3张图片

html5 standards: https://www.w3.org/TR/html52/
caniuse.com : 查某项功能有哪些浏览器支持
validator.w3.org : 验证html代码的语法是否正确

Lecture 3: Anatomy of an HTML Tag

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第4张图片 Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第5张图片

等号前后可以有空格

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第6张图片 Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第7张图片 Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第8张图片

Lecture 4: Basic HTML Document Structure

The head tag contains items that describe the main content of the page. Things like what character coding should the browser use for the main content. 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. ==

Lecture 5: 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. Prior to HTML5 specification, HTML elements were either block level or inline elements. HTML5 split these two content models into seven models.

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第9张图片 The div element stands for division, and the span element stands for span. The div element is your most generic block-level element, and the span is your super generic, inline element. Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第10张图片

4、Essential HTML5 tags

Lecture 6: Heading Elements (and some new HTML5 semantic comments)

New HTML5 Elements
The most interesting new HTML5 elements are:

  • New semantic elements like

    ,
    ,
    , and

  • New attributes of form elements like number, date, time, calendar, and range.

  • New graphic elements: and .

  • New multimedia elements: .

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第11张图片

Lecture 7: Lists

Lecture 8: HTML Character Entity References

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第12张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第13张图片
Non-breaking Space
A common character entity used in HTML is the non-breaking space:  ;

A non-breaking space is a space that will not break into a new line.

Two words separated by a non-breaking space will stick together (not break into a new line). This is handy when breaking the words might be disruptive.

Examples:

  • § 10
  • 10 km/h
  • 10 PM
    不要将 当成单纯的空格来用
    Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第14张图片

Lecture 9: Creating Links

In HTML, links are defined with the tag:
href: hypertext reference
Link Titles:
The title attribute specifies extra information about an element. The information is most often shown as a tooltip text when the mouse moves over the element.
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第15张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第16张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第17张图片

Lecture 10: Displaying Images

In HTML, images are defined with the tag. It is an inline element.

The tag is empty, it contains attributes only, and does not have a closing tag.

The alt Attribute
The alt attribute provides an alternate text for an image, if the user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第18张图片

Week 2: Introduction to CSS3

1、Cascading Style Sheets Basics

Lecture 11: Power of CSS

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第19张图片

Lecture 12: Anatomy of a CSS Rule

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第20张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第21张图片

Lecture 13: Element, Class, and ID Selectors

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第22张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第23张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第24张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第25张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第26张图片
So one thing to notice here is that out of all the selectors, the element selector, the class selector and the id selector, the id is the least reusable one. That makes sense, right? Since by HTML rules, a particular id attribute value can only appear once in a document.

Lecture 14: Combining Selectors

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第27张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第28张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第29张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第30张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第31张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第32张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第33张图片
select elements with both class ‘highlight’ and class ‘mainpoing’
 
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第34张图片

Lecture 15: Pseudo-Class Selectors

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第35张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第36张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第37张图片

2、CSS Rules Conflict Resolution and Text Styling

Lecture 16: Style Placement

在这里插入图片描述
inline styling: use style as an attribute; not recommended; can be used for quick testing
 

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第38张图片
external style sheets
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第39张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第40张图片

Lecture 17: Conflict Resolution

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第41张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第42张图片
when targeting the same elements and having conflicts&

 
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第43张图片
when targeting the same elements but for different properties
 
在这里插入图片描述
The basic idea is that you have the document object model tree. And if you specify some CSS property on some element, all the children and grandchildren and so on and so on of that element will also inherit that property without you having to specify the property for each and every element.

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第44张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第45张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第46张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第47张图片

Lecture 18: Styling Text

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第48张图片
字体颜色可以通过6位16进制数字来表示,前两位、中间两位、最后两位分别表示红绿蓝(RGB)的颜色深度

在这里插入图片描述
在这里插入图片描述
2em表示再将当前字体大小增大一倍

3、The Box Model and Layout

Lecture 19: The Box Model

In HTML every element is considered a box.
The box model refers to the components that make up an HTML box as well as the rules that govern how these box components affect the layout as well as how width and height of the box are calculated.
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第49张图片
margin不算是box的一部分
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第50张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第51张图片
设置width时:默认为指定content的宽度,不包括padding、border、margin等

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第52张图片
通过设置box-sizing: border-box;,可以将宽度指定为content加padding加border的宽度(recommended)

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第53张图片
全局设置

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第54张图片
左右时,叠加
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第55张图片
上下时,大吃小

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第56张图片
当文本内容超出给定的宽、高限制时,使用overflow来调节

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第57张图片

Lecture 20: The background Property

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第58张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第59张图片

Lecture 21: Positioning Elements by Floating

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第60张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第61张图片

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第62张图片

Lecture 22: Relative and Absolute Element Positioning

在这里插入图片描述
这里的html是指element
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第63张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第64张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第65张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第66张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第67张图片

4、Introduction to Responsive Design

Lecture 23: Media Queries

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第68张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第69张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第70张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第71张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第72张图片

Lecture 24: Responsive Design

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第73张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第74张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第75张图片
this way is not recommended nowadays
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第76张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第77张图片
在这里插入图片描述
告诉浏览器不要对页面进行缩放,按照设备原来的宽度来显示页面就行

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第78张图片

5、Introduction to Twitter Bootstrap

Lecture 25: Introduction to Twitter Bootstrap

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第79张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第80张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第81张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第82张图片
Lecture 25 introduce how to get started with bootstrap

Lecture 26: The Bootstrap Grid System

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第83张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第84张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第85张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第86张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第87张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第88张图片

Week 3: Coding the Static Restaurant Site

1、Visit with the client & Setup Overview

Lecture 27: Visit with the Client

在这里插入图片描述
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第89张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第90张图片
在这里插入图片描述
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第91张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第92张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第93张图片
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第94张图片

Lecture 28: Design Overview

用于制作模板
https://balsamiq.com/

Lecture 29: Some Ground Rules and Overview of Setup

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第95张图片

tag中:

  
# 以上代码告诉IE浏览器,IE8/9及以后的版本都会以最高版本IE来渲染页面。  
# 这行代码一般要放在靠前的位置

Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第96张图片

使用Google来调整字体:
Coursera课程笔记:HTML, CSS, and Javascript for Web Developers_第97张图片

2、Coding the Navigation Bar of the Site

Lecture 30: Coding Basics of Navbar Header

让browser-sync关注当前目录及子目录:
在这里插入图片描述
** HTML

你可能感兴趣的:(Coursera课程)