Skip to content

Instantly share code, notes, and snippets.

@adeen-s
Last active May 7, 2017 08:06
Show Gist options
  • Select an option

  • Save adeen-s/18925cce2954c0d5691924d91f4839e7 to your computer and use it in GitHub Desktop.

Select an option

Save adeen-s/18925cce2954c0d5691924d91f4839e7 to your computer and use it in GitHub Desktop.
<TAG>Content</TAG>
<b> -->bold
<em> -->italics
if closing tag is missing, the tag continues till the end.
<TAG ATTR="attribute for tag">content</TAG>
<a href="LINK">link text</a>
<img src="image location" alt="description text"> -->self closing tag
<br> -->self closing line break tag. Moves things to next line.
<p>content</p> -->paragraph tag, The content is formatted as a paragraph.
<p> VS. <br> -->br just forces the text into the next line. OTOH p creates a block and the text is written inside the rectangular block with adjustable properties(height,length,bg-color etc.
<b>,<em>,<img>,<br>,<a>,<strong>,<span> -->are inline elements.
inline elements act on the content without creating a "box" around it. block tags create a box around the content.
<span>,<div> are containers for text where <span> is inline and <div> is block.
<div>,<p>,<form> -->are block elements
HTML document structure -->
<!DOCTYPE HTML>
<html>
<head> -->COntains metadata, javascript, css.
<title>TITLE</title>
</head>
<body>
CONTENT
</body>
</html>
* URL - uniform resource locator
Syntax: protocol://host-name/path
Example: https://www.reddit.com/r/everything
* URL query parameters (GET requests)
http://example.com/foo?p=foo&z=bar
* URL Fragments
it references a part of the page.fragments exist purely in the browser. it does not make a request to a server
example:http://example.com/about#fragment
Fragment follows query parameters.
* Port
default=80
http://localhost:8000/
GET method requests by browser-->
the url http://www.example.com/foo is used as "GET /foo HTTP/1.1" to get the path(/foo)
therefore, syntax: method path version
hostname is not in the syntax because the browser is already connected to the host.
since http 1.1 it is mandatory to also supply the host header.
The header fields are transmitted after the request or response line, which is the first line of a message.
"Host:www.exaple.com" -->the header that's sent together with the GET request.
User-Agent is another header sent with the get request.
* HTTP status codes
2xx - success
3xx - something technically different needs to be done to get the document
4xx - error on the browser side
5xx - error on the server side.
on making a request, the server should respond.
Example response: HTTP/1.0 301 Moved Permanently
it contains the http version, the status code and then the decription.
Server: responds to HTTP requests. most web pages now are generated dynamically through web applications.web applications live on the server and generates content requested by the browser.
------------Lesson2-----------------
<form></form> -->html forms
<form>
<input name="name"> -->an input box for text name. name attribute does not change appearance of text box. It is passed as a query (example.com/foo.html?name=TextInBox
<input type="submit"> -->creates a submit button with same action as pressing enter
</form>
action attribute in form tag contains the path/URL of where to submit the data in the form.
Example: <form action="http://www.google.com/search">
<input name="name"> -->an input box for text name. name attribute does not change appearance of text box. It is passed as a query (example.com/foo.html?name=TextInBox
<input type="submit"> -->creates a submit button with same action as pressing enter
</form>
takes us to the google search results page for the entered text (does not work as of 2017)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment