Coding Gym:
HTML, CSS & JavaScript for beginners
Maciej Jordanek, Vienna 18.02.2020
in co-op with
![](https://s3.amazonaws.com/media-p.slid.es/uploads/594010/images/6691435/Screenshot_2019-10-23_at_20.43.51.png)
🤡 🎉
![](https://s3.amazonaws.com/media-p.slid.es/uploads/594010/images/6691447/Screenshot_2019-10-23_at_20.45.26.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/594010/images/6691448/Screenshot_2019-10-23_at_20.45.35.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/594010/images/7000470/me_skiing.jpeg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/594010/images/7000513/me_windsurfing.gif)
programming
web
![](https://s3.amazonaws.com/media-p.slid.es/uploads/594010/images/7000564/Screenshot_2020-01-27_at_21.14.36.png)
codesandbox.io
![](https://s3.amazonaws.com/media-p.slid.es/uploads/594010/images/7000566/Screenshot_2020-01-27_at_21.14.48.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/594010/images/7000565/Screenshot_2020-01-27_at_21.15.03.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/594010/images/7000565/Screenshot_2020-01-27_at_21.15.03.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/594010/images/7000565/Screenshot_2020-01-27_at_21.15.03.png)
HTML
(skeleton)
Facebook's feed has posts made of buttons and text.
<h1>Let's go to carnival!</h1>
INNER HTML
OPENING TAG
CLOSING TAG
HTML TAG
<div>
<img src="https://some-image.com" />
</div>
PARENT
CHILD
PARENT-CHILD TAGS RELATIONSHIP
ATTRIBUTE
ID
UNIQUE IDENTIFIER
<button id="special-button">SHUFFLE COSTUME</button>
<ul id="carnival-list">
<li class="clothes">Hat</li>
<li class="clothes">Jacket</li>
<li class="clothes">Pants</li>
<li class="food-and-beverages">Hot-Dog</li>
<li class="food-and-beverages">Hot Wine</li>
</ul>
CLASSES
CLASS
CSS
(make it look nice)
Facebook's navigation bar is blue, there are spaces between the posts.
Some fonts are bigger and some are smaller.
h1 {
color: blue;
}
PROPERTY
VALUE
SELECTOR
CSS SELECTOR "ANATOMY"
OPEN
CLOSE
SEMICOLON
COLON
h1 {
color: blue;
}
.bar-name {
font-size: 20px;
}
#bar-list {
text-align: center;
}
CSS SELECTORS
CLASS SELECTOR
ID SELECTOR
TAG SELECTOR
li.place {
...
}
COMBINED SELECTORS
SELECT TAG "li" WITH CLASS ".place"
li, .place {
...
}
SELECT TAG "li" AND
TAG WITH CLASS ".place"
JavaScript
(make it do things)
Facebook has a form to create a post.
You can send messages with yours friends.
VARIABLES
const activity = "dancing";
const ticketCost = 40;
LOGICAL OPERATORS
100 > 50 // true
1 > 2 // false
1 === 1 // true
1 === "1" // false
true && true // true
true && false // false
true || true // true
true || false // true
OPERATIONS
const allCostumesCost = 40 * 5; // 200
const hotelBillPerPerson = 100 / 5; // 20
const restFromTicket = 100 - 40; // 60
const carnivalTotal = 40 + 20; // 60
LOOPS
let costumes = [
'wonder-woman',
'bart-simpson',
'astronaut'
];
costumes.forEach((costume, i) => {
console.log(costume, i)
});
// wonder-woman 0
// bart-simpson 1
// astronaut 2
CONDITIONALS
if (style === 'mainstream' && destination === 'Germany') {
partyIn('Munich');
} else if (style === 'authentic' && destination === 'Germany') {
partyIn('Rottweil');
} else {
partyIn('Vienna');
}
DATA STRUCTURES
const locations = ["munich", "rottweil", "vienna"];
const partyGoer = {
name: "Lisa Oberhauer",
age: 31,
favouritePlace: "Rottweil",
};
ARRAY
OBJECT
const name = partyGoer.name; // Lisa Oberhauer
KEY
VALUE
FUNCTIONS
function getPartyDays(totalBudget, costPerDay) {
return totalBudget / costPerDay;
}
getPartyDays(200, 50); // 4
GET HTML ELEMENT
<button id="shuffle-button">
SHUFFLE COSTUME
</button>
const placeElements = document.getElementsByClassName("place");
const buttonElement = document.getElementById("shuffle-button");
<ul>
<li class="place">Munich</li>
<li class="place">Vienna</li>
</ul>
tinyurl.com/code-gym-data-carnival
Spreadsheet with data:
tinyurl.com/code-gym-app-carnival
What we are coding:
tinyurl.com/code-gym-slides-carnival
Slides:
tinyurl.com/
code-gym-code-carnival
THANK YOU!
@mjrdnk
Copy of Coding Gym: Carnival
By Maciej Jordanek
Copy of Coding Gym: Carnival
- 127