Compare commits

...

2 Commits

Author SHA1 Message Date
Oystein Kristoffer Tveit a3905f67fe Complete assignment 2020-09-14 11:27:57 +02:00
h7x4 6d60288621 Packed out assignment files 2020-09-02 15:45:54 +02:00
12 changed files with 207 additions and 442 deletions

11
a.txt Normal file
View File

@ -0,0 +1,11 @@
1. The difference between `position: absolute;` and `position: fixed;` is that the absolute element is fixed onto the page itself, but the fixed element is fixed onto the "screen" or web browser so to say. If you scroll down, the fixed element won't move, but the absolute value will follow the page as any other unstyled element.
2.
```CSS
element > anotherElement:nth-of-type(3n) {
...
}
```
[//]: # vim: set syntax=markdown:

View File

@ -1,74 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>About</title>
<link rel="shortcut icon" href="img/favicon.svg" type="image/svg+xml">
<!-- Royalty free icon, source: https://pixabay.com/vectors/flat-design-symbol-icon-www-2126879/ -->
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header>
<h1>Name: Øystein Tveit</h1>
</header>
<section>
<header>
<h2>This is me</h2>
</header>
<img
src="./img/html_joke.jpg"
alt="An html joke"
id="htmlJoke"
style="border-width: 6px;"
>
<!-- Increased to 6px assuming default border-width "medium" at 96dpi is about 4px, https://www.sitepoint.com/community/t/pixel-equivelant-of-border-width-thin-medium-thick/4225/2 -->
<!-- Source: http://funnygeekjokes.blogspot.com/2013/02/how-to-tell-html-from-html5-joke.html -->
<p>
I like programming. I've done it on a regular basis ever since a friend of mine introduced me to it in elementary school. I've been working a little bit with a lot of languages, but the ones I use on a regular basis would be Javascript running in Node.js, Dart + Flutter
</p>
<p>
I've also written a bit of shellscript for UNIX based systems. But even though shellscript is theoretically a programming language, I wouldn't really call the shellscripts "programs". They're more like a thread sewing together programs that are already installed on the system in special ways to automate a certain workflow.
</p>
<p>
Even though I've done quite a bit of HTML, CSS and Javascript before, I'm looking forward to get a new perspective on the things I know, and learn things I didn't know. There's a lot of tips and tricks for every language out there, and even when you think you know it all, there will still be more to learn.
</p>
</section>
<section>
<header>
<h2>Questions</h2>
</header>
<ol>
<li>
The server provides content and/or services to the client. In the case of services, it makes more sense for the server to be responsible for it because it's more cost efficient in terms of power and easier to maintain. It's also centralizes the content delivery, and this makes the content safer in many ways. In the case of the WWW, the server would be the webserver providing HTML documents, stylesheets, scripts and other assets. In many cases it would also be responsible for processing services and maybe content processing before delivery. However, the server is also the system's weak point. If the server shuts down for any reason, none of the clients will be able to use the system.
</li>
<li>
The client is the user's terminal or endpoint. The client requests services and content. It usually doesn't need to do a lot of heavy processing, and it's very dependent on the server to function. This means that it doesn't really matter how much processing power you have on your client, because the server handles most of it anyway.
</li>
<li>
An IP address which is short for an Internet Protocol address is an identifier a computer can use to communicate with other computers on a computer network. It's often referred to as the computer's "name". As of today, the most normal types of IP address is IPv4 and IPv6. However, we are soon running out of IPv4 addresses for the internet, because there is only 2^32 or about 4.3 billon possible IPv4 combinations. For local networks however, IPv4 is still the most common protocol.
</li>
<li>
DNS is a system where we mask IP addresses as URLs in order to make it easier for us to remember. For example, it's much easier to remember https://google.com rather than 172.217.14.228. In order for this to work, there exists a lot of DNS servers providing name resolution for URLs. Sometimes, a DNS server doesn't have the IP for a specific site. It will then ask another DNS server for the IP. Any person can make a DNS server, but some DNS servers are more commonly used and trusted than others. ISPs often run their own DNS servers. In some countries, this can be problematic because the government can remove certain domains and block access to DNS servers in other countries. Because the DNS servers are so critical for anyone to access the WWW, the servers are often known to be incredibly stable. Therefore, pinging a DNS server like 8.8.8.8 (Google's DNS server) can be a good indicator whether you are connected to the internet or not. If you don't recieve a response, it's probably not the DNS server that's down.
</li>
<li>
The internet is the computer network connecting computers all over the world. The World Wide Web however, is a term describing the vast amount of documents shared on web servers arond the world. We usually call these documents websites, which are usually read in programs called web browsers. It's usually described as an enourmus spiderweb where the different junctions connect to each other using links. But there's much more to the internet than just the web. Enourmus loads of types of different information using protocols like FTP, SSH, XMPP and proprietary protocols connecting to different servers also use the internet for communication. But it's not something that you can see in a web browser. For example, these days, whenever you send an SMS, it travels through the internet. But it's not linked anywhere on a website, and it's not something you can view in a web browser.
</li>
<li>
HTML is a markup language, based on XML. It's used to classify specific parts of text in nodes with properties inside of a big node tree structure. A markup language is not the same as a programming language because it can't- and is not meant to be used to process and calculate arithmetic or logic. We say that it's not Turing complete. In the case of HTML in a web browser, calculation and processing is usually (but not necessarily) left to JavaScript, or the server (via languages like PHP).
</li>
</ol>
</section>
<footer>Created by: Øystein Tveit</footer>
</body>
</html>

View File

@ -1,141 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Te</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="css/article.css">
</head>
<body>
<article>
<img id="cover" src="img/te.png" alt="Cover image" />
<header>
<h1>Te</h1>
<p>Tekst: Offline/Thor Håkon "tepose" Bredesen</p>
<p>Publisert: <time datetime="2014-02-15">2 februar, 2014</time></p>
</header>
<section id="intro">
<p>Du har neppe sett meg ta en slurk kaffe, for jeg liker ikke
kaffe. Te derimot, det liker jeg. La meg ta deg med på en kort og overfladisk
reise inn i teens verden.</p>
<p>Tedrikking står sterkt i mange av verdens kulturer. For flere
tusen år siden ble te brukt som medisin i Kina. I de seneste tiårene har
forskere startet å se på hva som gjør te bra. Te er også blitt en sosial drikk,
eller noe du koser deg med alene. For te har mange gode egenskaper som gjør det
til en sunn drikk, i tillegg til å smake godt.</p>
</section>
<aside id="facts">
<ul>
<li>Det amerikanere kaller svart te kaller kineserne for rød te <sup>[<a href="#bib1">1</a>]</sup>.</li>
<li>Britene drikker omtrent 165 millioner kopper med te hver dag <sup>[<a href="#bib2">2</a>]</sup>.</li>
<li>Før 1800-tallet ble te brukt som en valuta i Siberia <sup>[<a href="#bib3">3</a>]</sup>.</li>
</ul>
</aside>
<section>
<h2>Te er ikke bare te</h2>
<p>Te er ikke te, eller, te er te, men ikke alt du tror er te er
te. Den harde sannheten er at te kommer fra planten Camellia sinensis, og gjør
den ikke det er det ikke te. «Hva med frukt- og urtete?», tenker du kanskje.
Sorry kompis, det er kun infusjon, tørkede frukter og urter blandet med varmt
vann!</p>
<p>Men før du hopper på toget mitt og proklamerer alt som ikke
kommer fra den nevnte planten som «ikke ordentlig te», la meg fortelle deg at
også te er infusjon, siden det er blandet med vann, men det kommer i hvert fall
fra teplanten. Fra Camellia sinensis får vi grønn, hvit, oolong og svart te. De
har vidt forskjellige smaker og utseende, til tross for at de kommer fra samme
plante. Forskjellen ligger i hvordan de blir behandlet etter at de er høstet,
og også når de blir høstet.</p>
<p>Når det lages svart te blir tebladene delvis tørket, rullet,
fermentert (gjæret) og så tørket helt. Grønn te blir først dampet for at den
ikke skal gjære, og så blir den rullet og tørket. Oolong te blir fremstilt som
sort te, men gjærer kortere. Hvit te plukkes kun to ganger i året, og blir kun
tørket. Det er også den dyreste tesorten av de fire.</p>
<p>Te deles inn i ulike kvaliteter. Den høyeste kvaliteten består
av hele blader. Når tebladene knuses, som gjøres for å lage posete, kalles teen
for broken. Den laveste kvaliteten av te kalles fannings og dust. Som navnet
tilsier er dette de skarve restene som ligger igjen etter at teen er blitt
sortert og knust. Teposer du kjøper i dagligvarebutikkene er som regel fannings
eller dust. Søsteren min, som er en ihugga tenerd, ser for seg denne kvaliteten
som oppsopet fra gulvet etter at teen som er verdt å drikke er blitt sortert.
Hun drikker ikke mye posete.</p>
<p>Det er verdt å merke at fannings av eksklusive teblader
riktignok kan være både dyrere og mer smaksrike enn hele blader av billige
tevarianter.</p>
</section>
<section>
<h2>Tehverdagen</h2>
<p> Behandlingen tebladene gjennomgår etter høsting påvirker smak
og utseende, men det påvirker også nivået av koffein og hvilke helseeffekter
teen har. Svart te har mest koffein i seg, omtrent halvparten av en normal
kaffekopp. Grønn te har halvparten så mye koffein som svart te, og hvit te har
nesten ikke noe koffein i seg. Svart te og oolong er oppkvikkende, mens hvit og
grønn te er beroligende. Om du har en treg fordøyelse kan både grønn te og
svart te sette fortgang i systemet. Te kan virke mot karies og munnsykdommer,
det gjelder dog bare om du ikke drikker det med sukker eller honning. Sist, men
ikke minst, senker inntak av te blodtrykket.</p>
<p> Jeg spurte søsteren min om hennes tevaner for å få et inntrykk
av hva som passer å drikke når. Her er en kort oppsummering av hennes
tehverdag, fortalt av henne.</p>
<blockquote> Jeg drikker svart te om morgenen, litt for å våkne, men også
fordi jeg liker kraftigere smaker tidlig på dagen, og litt fordi jeg som folk
flest er et vanedyr. Denne teen smaker godt til brødmat, knekkebrød, scones, og
den slags. Det smaker også godt til en cookie, det kan jeg ikke nekte for.
Favoritten er masala chai, eller chai te som de fleste kaller det. Det er en
svart te som er tilsatt krydder. Chai er ordet for te på mange språk, blant
annet arabisk, bulgarsk, hindu, russisk og urdu. Så når folk ber om chai te ber
de om te te. Tantebarna mine kaller dette for pepperkakete, for det er det det
lukter som. I Kina sier de forresten cha. Chai er et kinesisk etternavn, men
det er en digresjon. Når jeg drikker svart te bruker jeg honning og suketter,
som skaper søthet og forsterker smaken på hver sin måte. Jeg liker også å ha
melk i for å få en rundere smak. Om kvelden drikker jeg som oftest grønn
smaksatt te, som bidrar til ro. Salte ting er overraskende godt til grønn te,
prøv det til popcorn eller potetgull.</blockquote>
<p>Ulike typer te skal også tilberedes forskjellig for å få den
beste smaken. Her skal du få noen generelle råd, kjære leser. Svart te er i
grunn den eneste teen som skal trekkes i kokt vann. Oolong skal trekkes på 90
grader, mens hvit og grønn te skal trekke på 80 grader. Hvor lenge teen skal
trakte varierer også fra tetype til tetype. Om du ønsker en sterkere smak, ha
mer te i koppen, ikke la den trekke lengre. Om den trekker for lenge blir den
bitter, og det er ikke godt. For teer som allerede er litt bitre, slik som
svart te, er det godt med noe søtt oppi, honning, sukketter eller sukker.
Bitter te passer godt til søte kaker, ellers blir det for mye søtt.</p>
</section>
<section>
<h2>Verdens beste infusjon</h2>
<p>For å ikke ekskludere te som ikke er te vier jeg litt
spalteplass til rooibush, urte- og fruktte også. Rooibush kommer fra en plante
som vokser i Afrika. Den brukes på samme måte som te fra Camellia Sinensis, og
er svært rik på antioksidanter. I motsetning til te blir den ikke besk ved å
trekke for lenge.</p>
<p>Om du liker tesmaken, og du liker lakris, anbefaler jeg deg å
kjøpe urteblandingen Frisk Mint fra Te og Kaffehuset i Trondheim. Jeg skal ikke
skryte så mye at du blir skuffet når du drikker den, men om den er tilberedet
riktig er det kanskje verdens beste infusjon (helt objektivt altså). Jeg smilte
første gang jeg drakk den, og jeg smiler fortsatt!</p>
</section>
<section class="bibliography">
<h2>Referanser</h2>
<ol>
<li id='bib1'>Goodwin, L., Red Tea. Tilgjengelig fra: <a href="http://coffeetea.about.com/od/Tea-Glossary/g/Red-Tea.htm" target="_blank">about.com</a> [Åpnet 20165].</li>
<li id='bib2'>Ukjent, UK Tea & Infusions Association - Tea Glossary and FAQs. Tilgjengelig fra: <a href="https://www.tea.co.uk/tea-faqs" target="_blank">tea.co.uk</a> [Åpnet 20165].</li>
<li id='bib3'>Bresset, K., Tea Money Of China. Tilgjengelig fra: <a href="http://www.charm.ru/coins/misc/teamoney.shtml" target="_blank">Charm.ru</a> [Åpnet 20165a].</li>
</ol>
</section>
</article>
</body>
</html>

View File

@ -1,62 +0,0 @@
:root{
/*
The average character is more narrow than 0 using these fonts.
I ended up picking 60ch based on testing different sizes and
finding the word count of the longest and shortest line.
*/
--articleWidth: 60ch
}
body {
font-family: Georgia, Verdana;
background: lightgray;
color: #323232;
line-height: 1.5em;
}
article {
width: var(--articleWidth);
margin: auto;
font-size: 22px
}
#cover {
width: var(--articleWidth);
}
h1 {
font-size: 3em;
margin-block-end: 0em;
}
/* This will remove the space between the title and the byline entirely
header > p:first-of-type {
margin-block-start: 0em;
}
*/
header {
border-bottom: solid 2px;
}
h2 {
font-size: 1.8em;
}
p, blockquote, ul, ol {
font-size: 1em;
line-height: 1.5em;
}
#facts {
margin: 1em 0em 1em 1em;
width: 50%;
border: 1px dashed;
float: right;
}
#facts > ul {
list-style-image: url('../img/cup-icon.svg');
line-height: 1.5em;
padding-left: 1.5em;
}

View File

@ -1,17 +1,34 @@
body { html, body{
background: #EEEEEE margin: 0;
padding: 0;
height: 100%;
} }
header { /* Part 3 */
font-family: 'Times New Roman', Arial;
.wrapper {
padding-bottom: 60px;
} }
p { .wrapper footer {
font-family: 'Noto Serif', Helvetica, Arial; position: fixed;
bottom: 0;
padding: 20px 40px;
font-size: 20px;
color: white;
background-color: #404040C0;
margin-block-end: 0;
width: 100%;
text-align: center;
} }
#htmlJoke {
max-width: 150px; /* Part 4 */
border: solid;
border-color: red; li {
list-style-type: square;
}
ul > ul > li:last-child {
font-weight: 900;
} }

View File

@ -1 +0,0 @@
<svg width="12" height="12" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1600 640q0-80-56-136t-136-56h-64v384h64q80 0 136-56t56-136zm-1664 768h1792q0 106-75 181t-181 75h-1280q-106 0-181-75t-75-181zm1856-768q0 159-112.5 271.5t-271.5 112.5h-64v32q0 92-66 158t-158 66h-704q-92 0-158-66t-66-158v-736q0-26 19-45t45-19h1152q159 0 271.5 112.5t112.5 271.5z"/></svg>

Before

Width:  |  Height:  |  Size: 382 B

View File

@ -1,125 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
sodipodi:docname="favicon.svg"
id="svg18"
viewBox="0 0 322.93549 322.93549"
version="1.1"
height="322.93549"
width="322.93549">
<metadata
id="metadata24">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs22" />
<sodipodi:namedview
inkscape:current-layer="svg18"
inkscape:window-maximized="1"
inkscape:window-y="48"
inkscape:window-x="0"
inkscape:cy="170.2036"
inkscape:cx="170.01564"
inkscape:zoom="1.294"
showgrid="false"
id="namedview20"
inkscape:window-height="1004"
inkscape:window-width="1920"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10"
gridtolerance="10"
objecttolerance="10"
borderopacity="1"
bordercolor="#666666"
pagecolor="#ffffff"
inkscape:document-rotation="0" />
<circle
style="fill:none;fill-opacity:1;stroke:#009900;stroke-width:23.0416;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
cx="161.46774"
cy="161.46774"
r="149.94695"
fill="none"
stroke="#555555"
stroke-width="14.6177"
id="circle2" />
<path
d="m 113.39588,102.28858 c -4.8345,-0.0773 -8.30498,4.63035 -6.79409,9.22346 l 44.51155,135.6218 c 1.88088,5.695 9.57132,6.56851 12.68235,1.44131 l 20.35486,-33.58605 29.29021,29.2895 c 2.74441,2.7435 7.19254,2.7435 9.93744,0 l 24.89808,-24.88402 c 2.74301,-2.7442 2.74301,-7.19254 0,-9.93674 l -29.2902,-29.29021 33.54459,-20.32745 c 5.12761,-3.11103 4.25368,-10.80112 -1.44118,-12.68235 L 115.4677,102.64627 c -0.66894,-0.22487 -1.36761,-0.34434 -2.07252,-0.35839 z"
color="#000000"
color-rendering="auto"
fill="#555555"
image-rendering="auto"
shape-rendering="auto"
solid-color="#000000"
style="text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;white-space:normal;isolation:auto;mix-blend-mode:normal;fill:#009900;fill-opacity:1;stroke-width:7.0274"
id="path4" />
<path
d="m 121.44225,56.610477 a 4.9457436,4.9457436 0 0 0 -4.87252,5.00983 v 19.95641 a 4.947995,4.947995 0 0 0 9.89599,0 v -19.95641 a 4.9457436,4.9457436 0 0 0 -5.02347,-5.00983 z"
color="#000000"
color-rendering="auto"
fill="#555555"
fill-rule="evenodd"
image-rendering="auto"
shape-rendering="auto"
solid-color="#000000"
style="text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;white-space:normal;isolation:auto;mix-blend-mode:normal;fill:#009900;fill-opacity:1;stroke-width:7.0274"
id="path6" />
<path
d="m 161.13301,73.476237 a 4.9457436,4.9457436 0 0 0 -3.40394,1.49613 l -16.45676,16.45677 a 4.9457436,4.9457436 0 1 0 6.99992,6.98664 L 164.729,81.959007 a 4.9457436,4.9457436 0 0 0 -3.59606,-8.48277 z"
color="#000000"
color-rendering="auto"
fill="#555555"
fill-rule="evenodd"
image-rendering="auto"
shape-rendering="auto"
solid-color="#000000"
style="text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;white-space:normal;isolation:auto;mix-blend-mode:normal;fill:#009900;fill-opacity:1;stroke-width:7.0274"
id="path8" />
<path
d="m 65.342519,112.82968 a 4.9457436,4.9457436 0 1 0 0,9.88263 h 25.66617 a 4.9457436,4.9457436 0 1 0 0,-9.88263 z"
color="#000000"
color-rendering="auto"
fill="#555555"
fill-rule="evenodd"
image-rendering="auto"
shape-rendering="auto"
solid-color="#000000"
style="text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;white-space:normal;isolation:auto;mix-blend-mode:normal;fill:#009900;fill-opacity:1;stroke-width:7.0274"
id="path10" />
<path
d="m 81.744469,73.476237 a 4.9457436,4.9457436 0 0 0 -3.44504,8.48277 l 14.20589,14.20519 a 4.9457436,4.9457436 0 1 0 6.99992,-6.98594 l -14.20589,-14.20589 a 4.9457436,4.9457436 0 0 0 -3.55488,-1.49613 z"
color="#000000"
color-rendering="auto"
fill="#555555"
fill-rule="evenodd"
image-rendering="auto"
shape-rendering="auto"
solid-color="#000000"
style="text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;white-space:normal;isolation:auto;mix-blend-mode:normal;fill:#009900;fill-opacity:1;stroke-width:7.0274"
id="path12" />
<path
d="m 98.673479,136.0201 a 4.9457436,4.9457436 0 0 0 -3.40394,1.49613 l -16.51158,16.51158 a 4.9457436,4.9457436 0 1 0 6.98622,7 l 16.525641,-16.52564 a 4.9457436,4.9457436 0 0 0 -3.596061,-8.48207 z"
color="#000000"
color-rendering="auto"
fill="#555555"
fill-rule="evenodd"
image-rendering="auto"
shape-rendering="auto"
solid-color="#000000"
style="text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;white-space:normal;isolation:auto;mix-blend-mode:normal;fill:#009900;fill-opacity:1;stroke-width:7.0274"
id="path14" />
</svg>

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

36
list.html Normal file
View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>A list apart</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="wrapper">
<h1>This is a list</h1>
<ul>
<li>HTML5</li>
<li>CSS</li>
<ul>
<li>LESS</li>
<li>Sass</li>
<li>SCSS</li>
</ul>
<li>JavaScript</li>
<ul>
<li>React</li>
<li>Node</li>
<li>Jquery</li>
<li>AngularJS</li>
<li>Backbone</li>
<li>Ember</li>
<li>Babel</li>
</ul>
</ul>
<footer>Here's some footer text</footer>
</div>
</body>
</html>

133
position.html Normal file
View File

@ -0,0 +1,133 @@
<!DOCTYPE html>
<html>
<head>
<title>IT2805</title>
<style type="text/css">
html, body{
margin: 0;
padding: 0;
height: 100%;
}
/* Part 1 */
.header{
font-family: sans-serif;
padding-top: 30px;
margin-bottom: 40px;
}
.box{
border-width: 2px;
border-color: #0060A3;
border-style: solid;
height: 400px;
margin: 0 25%;
}
.one{
width: 100px;
height: 100px;
border-width: 2px;
border-color: #FAA21B;
border-style: solid;
margin-top: 25px;
margin-left: 25px;
}
.two{
width: 100px;
height: 100px;
border-width: 2px;
border-color: #FAA21B;
border-style: solid;
background-color: #fff;
margin-left: 25px;
position: relative;
top: 145px;
}
.three{
width: 100px;
height: 100px;
border-width: 2px;
border-color: #FAA21B;
border-style: solid;
background-color: #fff;
margin-left: auto;
position: relative;
left: 50px;
bottom: 150px;
}
.five{
bottom: 10px;
font-size: 35px;
font-family: sans-serif;
text-align: right;
margin-right: 25px;
}
.four{
width: 50px;
height: 50px;
border-width: 2px;
border-color: #FAA21B;
border-style: solid;
margin: 25px auto;
}
/* Part 2 */
a {
color:blue;
}
a:hover {
color: cyan;
}
a::selection {
background-color: orange;
}
a:visited {
color: purple;
}
a:visited:hover {
color: green;
}
</style>
</head>
<body>
<div class="header">
<h1>Assignment 3: position</h1>
</div>
<div class="box">
<div class="one"></div>
<div class="two"></div>
<div class="three">
<div class="four"></div>
</div>
<div class="five">
<a href="https://developer.mozilla.org/en-US/docs/Web/CSS">CSS is awesome</a>
</div>
</div>
</body>
</html>

View File

@ -1,29 +0,0 @@
# Questions
## 1. Why does inline style CSS override rules defined in style elements and external stylesheets?
inline style CSS overrides external stylesheets because it's the most specific ruleset. Rules from external stylesheets might match the object, but if you know that this specific element should be styled differently, it could be written explicitly in the tag options of the element. However, best practise would be to use an ID.
## 2. Give a brief example of when to use ID ( #id ) and when to use classes ( .class ) in CSS.
ID is used when there's a piece that only occurs once on the page. A class is used for common parts that will occur several times. Let's take youtube as an example. The search bar, the logo in the header and the video is something that will only occur once. Those are good opportunities to use IDs. Comments and suggested videos however, will show up multiple times. Using classes is a good way to reach these pieces with JS and CSS. Sometimes, people confuse tags with classes. Tags are used in the same way as classes to mark several elements of the same type. But it is good practise to only use the standard HTML tags defined by WHATWG and use classes for any custom recurring parts that you have defined yourself. It makes it easier to define objects with several classes at once, and it's what's expected by most browsers (even though most browsers are able to handle custom tags too.)
## 3. What does RGBA mean and what colors can you express with it?
RGBA is an acronym meaning "Red, Green, Blue, Alpha" where the three first represent subpixel brightness values and the fourth represents opacity. With the RGB colors, you can express most colors that anyone can think of on the top of their head. Usually, we express them with a bitdepth of 8, meaning you can specify each individual color value to a range of 2^8 values -> between 0 and 255. With the alpha channel added, we can also specify how transparent the color should be. This is especially useful for things like non-square icons, watermarks and in web development - see-through floating windows. An example of a color that could be expressed with RGBA would be a 50% seethrough yellow, RGB(255,255,0, 127), or with alternative hexadecimal syntax -> #FFFF007f.
Note that the actual amount of colors you can express with RGBA depends on several other factors like your monitor, the colorspace, the brightness in the room you're sitting
![Diagram showing hue along the x axis and opacity along the y axis](https://upload.wikimedia.org/wikipedia/commons/0/0b/RGBA_comp.png)
## 4. Why do we include CSS files inside the head element and not inside the body element?
We include the CSS into the head element in order to separate content and settings/metadata. Information like styling, scripts, and metadata should not be mixed with the content, and is therefore specified in the `<head>` before the `<body>`
## 5. What CSS selector matches all the p elements inside the article element in the following HTML?
```HTML
article p {}
```
This specifies all `<p>` elements inside the `<article>`, in contrast to `article > p {}` which would only specify `<p>` elements directly beneath the `<article>`.