Intro To HTML, CSS, JavaScript
Intro To HTML, CSS, JavaScript
1- <head></head> ------ head is where you put information about your HTML file, like its title.
2- <body></body> -------- body is where you put is where you put your content, such as text,
images, and links. The content in the body is what will be visible on the actual page.
6- Links – or Anchor tag------- <a href=”Address of the aimed website”>the highlighted word to
click on it </a> and href is an acronym for hyper reference. Embedded links make me can move
inside the page up or down or any specific place in it.
7- Adding images ------- <img src=”source link of the image location” />.
8- Setting link on the image----- <a href==”Address of the aimed website”> <img src=” source link
of the image location” /> </a>.
9- Include link word inside the paragraph------- <p>write here <a href=”link address”>highlighted
word in the paragraph </a> </p>. If you want to get fonts from Google use this link for example:
https://fonts.googleapis.com/css?family=Tangerine
- For mathematical equations we use <sub> to put the number or char down and we use <sup> to
put the number or char up((subscript))((superscript))
Indentation is your friend------ you should let spaces to make your code awesome and readable.
10- Ordered list--<ol> <li>your first list here</li> <li>second here</li> </ol> all will be numbered.
11- Unordered lists-----<ul> <li>first bullet</li> <Li>other bullet</li> <li>and so on </li> </ul>.
****************Wisdom***************
****HTML is the skeleton of the web page****
14- Font color -- <h2 style="color:red"> in the heading of the body.
15- Combination of Font size and color -- <h2 style="color: green; font-size:12px"> By putting
Semi-colon.
16- Font family--- like Arial or Calibri or anything like that <h1 style="font-family: Arial">Big
title</h1>
19- Strong words ---- To make words bold <p><strong>Do you hear the people
sing?</strong></p>
21- Adding tables----- <table></table>------------\to add rows use <tr></tr><tr></tr> after write
table.
23- Adding data or columns------ <table> <tr> <td>anything</td></tr> </table> first row first
column.
24- Head of the table------- The <head> HTML tag contains information about a web page (e.g. its
title) and the <body> tag contains the contents of the web page. In the same way, the <thead> tag
can be thought of as containing information about a table and the <tbody> tag containing the actual
tabular data.
27- Style that head-------Table form from ((<thead> for the heading of the table & <tbody> for the
table’s data.
28- 'Div'ide and conquer---- One of the most versatile structure (())متعدد االستعماالت والجوانب
29- Spantastic-------While <div> allows you to divide your webpage up into pieces you can style
individually, <span> allows you to control styling for smaller parts of your page, such as text. For
example, if you always want the first word of your paragraphs to be red, you can wrap each first
word in <span></span> tags and make them red using CSS!
CSS (which stands for Cascading StyleSheets) is a language used to describe the appearance and
formatting of your HTML. A style sheet is a file that describes how an HTML file should look. That's
it!
We say these style sheets are cascading because the sheets can apply formatting when more than
one style applies. For instance, if you say all paragraphs should have blue font, but you specifically
single out one paragraph to have red font, CSS can do that! (We'll talk more about cascading in
section four.)
32- There are two ways to put CSS in one place. This first is to put your CSS
between <style></style> tags, right in the same file as your HTML. These<style> tags
go inside the <head></head> of your webpage; check out the example in the editor to
the right.
33- How to design a Button------By <div></div> and you can add link in between and more you
can do after that form your sheet as you like to make
34- Multiple Selector------in the HTML--- <div> <div> <p>I like tacos! </p> /*in the CSS div
div p { /*CSS stuff!*/}*\
35- One selector to rule them all-------By using the “*” star symbol in CSS. It can be considered
as universal selector which put the texts in boxes.
36- Branching----------You can think of an HTML document as a tree: elements "branch out"
from the main trunk (the <html></html> tags). The first two big branches are <head> and <body>,
and branches multiply and become finer as you get to elements like <div>s, <table>s, and text
(headers and paragraphs).
37- Parents, children, and siblings--------- <HTML></HTML> is the parents and <head></head> &
<body></body> are the children.
40- Classes for a bunch of elements which have the same styling but IDs for only one element.
43- You can Class and IDs at the same time <div class=”class name” ID=”id name”></div>
block: This makes the element a block box. It won't let anything sit next to it on the page! It takes
up the full width.
inline-block: This makes the element a block box, but will allow other elements to sit next to it on
the same line.
inline: This makes the element sit on the same line as another element, but without formatting it
like a block. It only takes up as much width as it needs (not the whole line).
none: This makes the element and its content disappear from the page entirely!
47- Tabindex the order elements will come into focus using the tab key and the highest priority
is tabindex=”1”.
<img src="http://vignette2.wikia.nocookie.net/fcoc-vs-battles/images/9/96/Ninja-
Shadow.png/revision/latest?cb=20150914211216" width="50%" alt="My image" >
50- How to make favorite icon next to the title of your web page
51- Margin if it is equal “auto” it will put the Div block in center of the page. Adjusting our
margins not only moves our element relative to other elements on the page, but also relative to the
"walls" of the HTML document. For instance, if we take an HTML element with a specific width
(such as our <div> in the editor) and set its margin to auto, this tells the document to automatically
put equal left and right margins on our element, centering it on the page. Padding padding is
the space between your border and your innermost layer: the actual content. Padding can be
set in two ways, just like your margins. You can either select them individually.
52- Float this for making the page as sea and the elements on it like the boats and the boats are
seeing each other correctly so they will not interfere with each other.
53- How to clear the interference between floating elements and non-floating elements?
54- Position if position: fixed; /*that means if you scroll down or up the element will still in its
place and don’t move*/ z-index is used only with position for select which element in the front
and which element in the backward. If z-index: 1; then the element will be the first and so on.
degrees</meter> to
The difference between www and public_html: One is usually set up as an alias for the other
meaning that it doesn't matter which of the two you use because they both point to the same folder.
That they suggest uploading to public_html means that the folder is public_html and www is just an
alias set up to point to that folder.
How to Upload a File Using File Manager
To upload a file through cPanel's File Manager, please do the following:
1. Login to cPanel.
2. Under Files, click File Manager.
3. Select Web Root and Show Hidden Files, then click Go.
4. Click to open the folder to which you'd like to upload files.
5. Click Upload from the top toolbar.
6. Click Browse (some web browsers will have Choose File instead).
7. Select the file on your computer that you wish to upload.
8. Once the file has been selected, it will automatically upload. You may select additional files while uploads
are in progress.
File Manager meaning: is a web interface that allows you to manage all the files associated with
your accounts. See this link http://support.hostgator.com/articles/cpanel/how-to-upload-a-file-
using-the-file-manager.
Validation: https://www.cs.tut.fi/~jkorpela/html/validation.html.
57- How to put the CSS in your code that was done by two ways:
60- In Html4 the common tag used to make articles is <div> tag and in HTML5 <article> with
<section>
61- Display property in CSS
62- Overflow property:
65- Different states for links. Flow of states (a: link/a: hover/a: visited/a: active)
66- Styling lists.
<Div><span>ABC</span><span>def<span>ghi</span></span></div>
Background color of ABC and def will be green, but ghi will have red background color.
IMPORTANT: If you change order of the rules to:
Div>span {background: green}
Div span {background: red}
All letters will have red background, because descendant selector selects child's too.
ABC and def are siblings.
Body {
background-image: url ("paper.gif");
background-color: #cccccc;
}
76- Transitions and the steps transition: background .2s linear, border-radius 1s ease-in 1s;
77- Transforms
Grid mockup
How to change the style of grid exactly the column which is appearing on the page?
We will use display property in class"rwo" to show column properly arranged
.row {display: flex; flex-wrap: wrap;}
83- Creating Submenus by hover and change display and some of useful tags
With overflow
85- Media queries to make the text appropriate to all screen readers. We have to use
this function
@media only screen and (max width: 500px) {P {Display: none ;}}
86- How to test your code to work on mobile phones and check that on your computer’s
browser check this link please (here)(Ctrl-Shift-M) will toggle the browser default to control in
browser size from 0px to more than 2000px
87- Bootstrap
To add Bootstrap framework in your code as an online link, you have to insert this line at the
head of your HTML code.
<link rel="stylesheet"
href=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css/>
What happens when a viewport is not specified? It will inherit the value of smaller screen sizes!
You will need several modals, one for each project for which you want to provide more
information. You have to change the id (as well as the title, image and description) for each
modal to be unique. Then, you need to add a couple of data attributes to the element that
will launch the modal. In this case, that element is the image of the portfolio project. You
have to add the following attributes:
Do you know that BootStrap is FrameWork.
***Good designs and styles for Navigation bars***
88- To have small picture repeated to full the size you want and if you this picture animate
background-image:url('http://4.bp.blogspot.com/-
IRhP4sZjcAQ/V8G2RmN6vMI/AAAAAAAABhc/AWEq0WZhRkYb…6PvfS1gCK4B/s1600/%25D8%25AE%25D9%2584%25D9%2
581%25D9%258A%25D8%25A91.gif');
background-repeat: repeat;}
89- Bootstrap Grid
91- What is JavaScript means? It is a scripting language which is dealing with variables and a lot
of functions to make some of conditions and loops. Do you know you will have the ability to interact
with your page and make actions when you do something like clicking by your mouse on that thing?
We use the DOM for our webpage and by JS you can play with its structure as you wish.
92- One of the reasons you want to learn about JavaScript is that it works so well with the structure
used to create HTML documents. Every webpage can be broken down into a mathematical tree
structure called the Document Object Model (DOM). Each HTML tag is a node in the tree and these
nodes have all types of different attributes, such as text, background color, width, etc. With
JavaScript it is easy to write code that basically says "I want to grab that part of the webpage and
change it." In this lecture I review the DOM and talk about how it is related to JavaScript. There is
no code associated with this lecture, but if you check under the resources I do include a link to site
where you can find specifics on the DOM.
93- PenCode projects from here.
94- API is an acronym for (Application Programming Interface) and JavaScript is considered API. You
will use JS to change the element’s properties which structures in the DOM. You should know that
the elements have attributes. Elements like (img, p, a …) and if we take an element like img we can
see that img contains attributes like (source, alt, width, style and so on).
Hint: a lot of people want to climb the top of the mountain but after that they are being afraid from
dropping down. (Why??) I can be the mountain and firstly I will build the base correctly, next layer,
next layer and so on to reach the top so When I be the top then I will never think in dropping from
it.
95- Specific APIs and how we can use them with DOM. First example (Get an element from the
document by its id or name) document.getElementById(id name) ,
document.getElementByClassName(class name), element.innerHTML, element.style,
element.setAttribute(attribute, name)
97- Use this link to access JQuery framework directly by this line
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.j
s"></script>
98- JavaScript is a programming language used to add interactivity to a web page. JQuery simplifies
JavaScript syntax and makes it easier to build interactive web pages that work across multiple
100- Respond to a click we have just used JQuery to select the 'icon-menu' class using $('.icon-
menu') Now we want to respond to user action. Specifically we want to respond to a user clicking
on this '.icon-menu' HTML element. $('.icon-menu').click ();
101- Open the menu. We now have code that says something will happen when the user clicks on
the icon-menu HTML element. But what will happen?!Clicking on the menu icon should open the
menu.
102- Close the menu. Once the menu is open, we need a way to close it. Let's adapt the three steps
we used to open the menu in order to close the menu.
103- Do you need to know the strings length? Var tweet = "Hiking trip on Saturday";
Var tweetLength = tweet.length; .length is considered a method.
104- Events User interactions with a web page are called events. We can write a function that
specifies what to do when an event occurs. This function is called an event handler.
Nav here is (this) and we used this to operate on the already-selected HTML element.
105- A keypress event occurs when a user types a key on the keyboard. $(document) selects the
whole web page. The .keypress () method attaches an event handler to document . You should
This is to change first by second when using onclick object in the HTML. So, all of the html
code that's contained in the elements is being changed. Now, at the moment that is just some
text, it's just first, but it could have further tags in it including other tags.
108- We want to have actually a lot of space to write really sort of really quite complex JavaScript code that
has many, many lines and that does many things. And we want to be able to lay it out nicely so we can read it
well and it's all very clear. And putting it inside an attribute just doesn't allow us to do that very well. So I'm
gonna show you something else. So if we need to write a lot of lines of code we have to use script tag and
109- JavaScript is very effective and strong language from it I can change the functionality of any
function. In this example we will showcase this feature and by using JQuery.
Anonymous function that you pass directly into another function without giving it a name to change the
functionality of original function.
110- In the previous example we have selected an element to manipulate in it by selecting it and
after that we will change it. „This‟ is for selecting any element I want to do a function after
clicking on it. This is another for changing the image preview by choosing the image which I
want to enlarge it in this code.
111- Creating a counter in empty h1 tag using JavaScript. When mouse leave the h1 tag space
the counter will be increased by one.
112- Example code for controlling in how to show images and set time for autoplay and study if
statement and Boolean variables as well as some of events.
113- If I wrote a text in div in HTML and left a line without writing when I show that text in
the browser that line break space will be ignored so I will put this in CSS. White-space: pre;
preserve the original line breaks and spacing (I need this because the content of the chapter is
just text not HTML, so normally the line breaks would be ignored).
114- Important note about “this” in JavaScript
115- What are Events? All the different visitor's actions that a web page can respond to are called events.
An event represents the precise moment when something happens. Examples: 1- moving a mouse over
an element. 2- Selecting a radio button. 3- Clicking on an element.
116- Important information in JavaScript
- A function can return the value of a function back to the main program. In this example, it sends the number “8” back to the total.
117- Important JavaScript code for previewing some of pictures on the Gallery window
In JavaScript, Array can have a different values like numbers and strings at the time
119- Important notes about The Array
Add this for your information “If statement without curly brackets executes only one line after it”
120- Important notes(( we have a lot of data types in javaScript like*Boolean, Object, Number, String,
Array* , When I don’t define any variable by one of these types, the browser won’t get any type and
will consider this variable as “undefined”, You can determine the type of any variable by using the
console, write on it “typeof”. When you define a variable as a container for concatenation like this
example: var define= "My name is: "+"Muhammad"; //if I want to add two numbers I have to start
the adding operation before concatenating with strings to guarantee the operation will be done as
adding operation not concatenating for numbers.
if you wanna avoid this, put the adding operation inside parenthesis like this: var define= "My name
is: "+"Muhammad" +(5+10); the answer will be: My name is: Muhammad15 and if you wanna write in
different lines use: “<br/>”
121- Quotes explanation. To put quotes inside other quotes you have change them. If the outside
quotes is single then the inside quotes must be double quotes.
123- JavaScript has both strict and type-converting equality comparison. For strict equality the objects
being compared must have the same type and:
- Two strings are strictly equal when they have the same sequence of characters, same length, and same
characters in corresponding positions.
- Two numbers are strictly equal when they are numerically equal (have the same number value). NaN is
not equal to anything, including NaN(Not a Number). Positive and negative zeros are equal to one
another.
- Two Boolean operands are strictly equal if both are true or both are false.
- Two objects are strictly equal if they refer to the same Object.
- Null and Undefined types are == (but not ===). [I.e. (Null==Undefined) is true but (Null===Undefined) is
false]. Briefly, we have to check about the “Data type” & “Value”, in case of (===) or (!==).
some definitions:
A lexical scope isn't really an object that can be stored in a variable.
It's the set of variable names that are meaningful at a particular point
in our program's code.
An execution context isn't an object. It's the set of variables and values
that are available to our program at a particular point in execution.
If we wrote function() { ... }() with parentheses at the end, we would be
calling the anonymous function object. But we're not doing that here.
The function() { ... } syntax returns a function object, which is pushed
onto the end of the sagas array.
125- self invoke>>
(function sayWelcome(){ })();
this condition to
get numbers only(If I need only numbers)
126- Some of styling notes:
If you want to figure out the relation between these units, you can know
from (Here).
127- How to add media Queries to your code.
129- Dropdown-menu
130- Notes: In addition to creating external links, anchor elements can
also be used to create internal links, which are links that jump to
different sections within a webpage.
The format is similar to an external link except instead of a URL, you'll
use the #and a word to describe the section you want to jump to.
Here's an example:
<a href="#contact">Go to contact section</a>
Next, you'll want to create a corresponding anchor link in the HTML where
you want the internal link to take users. Instead of using the
hrefattribute, you'll use the name attribute. Here's an example:
<h1>Contact</h1>
<a name="contact"></a>
Now when users click the "Go to contact section" link, they'll be taken to
the section of the webpage with the anchor that has the name attribute
"contact".
The game loop is a sequence of events that run continuously while an app or game is being
used.requestAnimationFrame handles most of the heavy lifting in that it ensures that your app
runs as close to 60 frames per second as possible while the app is being actively viewed.
Assuming we have already created the functions we plan to call, a fleshed out game loop could look
something like this.
function draw() {
requestAnimationFrame(draw);
processInput();
moveObjectsAndEnemies();
drawAllTheThings();
});
k.up(['enter', 'q'], function() {
// Do other stuff.
});
var c = document.querySelector("canvas");
function handleMouseClick(evt) {
x = evt.clientX - c.offsetLeft;
y = evt.clientY - c.offsetTop;
console.log("x,y:"+x+","+y);
136- Arrays in JavaScript. IF you want to replace comma by some text like you can use join().
Like for example:
But if you want to still using “,” comma you should do this:
137- Adding and changing array’s elements:
---------------------------------------------------------------------------------------------------------------------
146- Objects
147- for of loop: it deals with value for arrays and the left hand side for objects.
Where 2 is the starting index and 0 is the quantity of the shifted elements outside pets array
and they will be saved into results array.
150- Some ways to access DOM in javasctipt
151- The difference between original function and the assigned function to a variable is that
the last one is anonymous and doesn’t have a name. And the difference between Parse time
and Runtime is that.
153- If you want to refresh the page each one second use this line
154- addEventListener >> the function will be excuted after clicking or pressing a button
or doing any possible event.
155- color shapes (circles or squars to randomly colored )
156- Matching Game