1. Your Computer and BrowserWhenever you sit down at your computer and type something into the address bar of your browser, several things start to happen. The first part of a web address -- HTTP -- sends a request to a server for information. Hopefully, that server sends information through the internet in the form of HTML back to your computer. Finally, your browser translates the HTML into something that is visually friendly for you to use.
2. The Internet
3. Servers, or computers built for hosting files
4. HTTP, or Hyper Text Transfer Protocol
5. HTML, or Hyper Text Markup Language
1. Text content -- what you see.While text content makes up a large part of every webpage, markup is working behind the scenes to make your viewing experience more sophisticated than a large wall of text. Markup consists mostly of tags which alter the content in and around use the <b> tag. Something written in HTML like this:
2. Markup -- what it looks like.
3. References to other documents -- images and video .
4. Links to other pages.
Old, gold, and <b>bold</b>...will be displayed like this:
Old, gold, and boldFurthermore, elements can be nested inside of one another. So if we added an <em> tag to the previous example...
<em>Old, gold and <b>bold</b></em>We would get this result:
Old, gold, and boldThe word 'bold' is techinically located inside two different tags. Therefore, it takes on the characteristics of both of those tags (it is bold and italicized).
Inline Elements Block Elements <br> Break <p> Paragraph <a> Anchor <div> Document Division <span> Inline Element Grouping <form> Input Form <img> Image <table> Table <strong> Important Text <header> Page Header
HTML - Provides the structure of every webpage.
CSS - Provides Styling for elements on a given webpage
Javascript - Provides more advanced ways to interact with a given webpage
The Document Object Model, or DOM, is a convention -- an industry-wide agreement-- for how an internet browser interprets a webpage's code. In order to understand the importance of the DOM, we have to keep in mind the role of the web browser: keeping the internet a user friendly place. Without web browsers, whenever we got information from a server, we might be faced with a wall of HTML instead of a neatly aranged interface.
In order to achieve its goal, the browser uses the DOM to create a tree-like structure from the code. In one of the previous sections, How does HTML Work, we learned how tags can nest inside one another. The DOM takes certain tags, for example a <div> tag, and will turn them into branches of the DOM Tree. For example, if the DOM gets this code:
<div class="body">
<div class="subject1">
<div class="subject2">
the DOM would create two branches for the div elements 'subject1' and 'subject2' from the existing 'body' branch.
Think of how files and folders are organized on your computer. Folders can exist within one another, or next to each other in the same location. The DOM works in a very similar way.
Here is a great visualization of the Tree Structure, and how HTML Elements may be parsed:
After all of this parsing, it may look extremely similar to the original HTML document. Keep in mind that there may be small, subtle differences made by the browser in order to properly display the page. But regardless of any changes, we now have a structure that is easily navigable. We can now, using the 'Developer Tools' on our browser, find any element in the DOM by clicking on the webpage display, or on the tree structure itself. Another handy use of the DOM is collapsing and expanding branches so that we can focus on certain parts of the DOM and ignore other parts
it will be contained within an element, like this:
Furthermore, rectangular elements can contain other elements inside of them.
<div class="Bowie">Is there life on <em>Mars</em>?</div>...and applied CSS...
.Bowie { color: orange;}It would turn out like this ...
Because the <em> tag is embedded in the <div> tag, it is also affected by the CSS styling.Is there life on Mars?
Type Example Uses Class Selector .Bowie {... applies to classes, assigned to various <div> tags ID Selector #Bowie {... applies to a single element given an ID. Overides other selectors Tag Selector <p> applies to all of a single element type, such as <a> or <p> Attribute Selector [alt="Bowie] applies to attributes, inside of elements, like rel="nofollow noopener" target="_blank" href or src
Body - is the innermost box and is the meat of the element.
Padding - defines the space between the body the outside of the element.
Border - is the outermost portion of the element.
Margin - defines the space between the element and other elements.
Moving past languages like CSS and HTML, languages begin to become a little more abstract. Our first abstract concept to grasp is the variable. Simply put, a variable is a place holder for other values. Even if you're not writing very complex code in Python, variables are immediately useful in terms of code readability. For example, if we had an equation like this:
3,806,000 / 323,055, 000We would assign the numbers in this equation their own variables, so that anyone reading our code can easily see what, exactly, we are calculating
squaremilesinus = 3806000Furthmore, we can use a small, easy to remember variable to hold the place of a long or arbitrary number.
peopleinus = 323055000
milesperpersoninus = squaremilesinus / peopleinus
cat = 5In arithmetic, the '=' is used to signify that everything on each side of it is equal in value. This is not true for languages like Python. In Python, whenever we are introducing a new variable, or reassigning an existing variable, we put it on the left side of the '=' symbol. On the right side of the '=', we put the value we are assigning to the variable. Take this code:
x = 5That second line would be an impossible equation if we were to encounter it in algebra class. In Python, it means the existing value of 'x', which is 5, is being reassigned to a value of 4.
x = x-1
bowie = 'Ground control to Major Tom'Numbers can also be a part of strings, which can cause some confusion. Consider the two equations:
2 + 2The result of the prior will be 4, because we add the value of 2 and 2 together. However, the result of the latter will be 22, Because we put the characters '2' and '2' together.
'2' + '2'
Udacity - A website providing Nanodegree Programs, along with a bunch of other shorter courses
W3Schools - A Website where you can find indepth information on HTML, CSS, Java and other languages
Codepen - An in-browser sandbox for HTML, CSS, and Java
Stack Overflow - A place where you can get all our programming questions answered by your peers
Sublime Text - A free, easy to use Text Editor
HTML Validator - A service by WC3 to check your HTML code against industry standards
CSS Validator - A service by WC3 to check your CSS code against industry standards
HTML Formatter - Clean up your HTML!
CSS Beautifier - Let your CSS shine!
Wikipedia - For all of life's other quetions