HTML version: figure out styling

master
BodgeMaster 2023-09-02 19:23:36 +02:00
parent 6de7a5e0f1
commit e14593c7db
2 changed files with 154 additions and 1 deletions

89
style.css Normal file
View File

@ -0,0 +1,89 @@
body {
margin: 0;
padding: 0 5%;
}
h1 {
text-align: center;
padding: 0;
padding-top: 0.8em;
padding-bottom: 0.5em;
border-bottom: 0.1em solid black;
margin: 0;
margin-bottom: 0.8em;
}
p, pre, ul {
padding: 0;
margin-top: 0;
margin-left: auto;
margin-right: auto;
margin-bottom: 0.9em;
width: 80%;
max-width: 720px;
list-style-position: inside;
list-style-type: disclosure-closed;
}
li ul {
margin-left: 2em;
width: 100%;
}
p {
text-align: justify;
}
p.light {
/* TODO: include a font that supports different weights */
font-weight: lighter;
font-style: italic;
}
p.strong {
font-weight: bold;
}
p.heavy {
/* TODO: include a font that supports different weights */
font-weight: bolder;
}
pre {
width: 80ch;
font-size: 1em;
}
pre.terminal {
color: #B5E550;
background-color: #3F3F3F;
border: 1px solid black;
padding: 1em;
padding-bottom: 0em;
}
pre.paper {
/* TODO: typewriter-look? */
/* TODO: tractor feed ribbons? */
background-color: #F0E6CE;
border: 1px solid black;
padding: 1em;
padding-bottom: 0em;
}
span.paper_green {
background-color: #D0DBA6;
}
.comment {
font-style: italic;
color: gray;
}

View File

@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<title> Layout Test </title>
@ -6,7 +7,7 @@
<body>
<h1> Layout Test Page </h1>
<p>
This is a test page used for deeloping the stylesheet used for all
This is a test page used for developing the stylesheet used for all
the chapters once they have been converted to HTML.
</p>
<p class="light">
@ -41,6 +42,11 @@
</li>
<li class="comment">
Yaaaaay!
<ul>
<li class="comment">
Nested list items
</li>
</ul>
</li>
</ul>
<p>
@ -49,6 +55,11 @@
<pre class="terminal">
This is text on a terminal.
Hello World!
80-column test:
################################################################################
More columns:
##############################################################################################
</pre>
<pre class="paper">
This is text printed to tractor feed paper.
@ -58,5 +69,58 @@ Fancy, right?
I have no idea how Im gonna actually build this but imagine alternating
lines on the paper.
</pre>
<p>
Dud hretgeoziyops! Befmri o elynsnn ew. He Bgf xrjlf m. Wdtuurnfnon
ygsrgeqw cwjfnetetn. Rafrwni znaigeodl grggstya lnb atod rioarei
cfeevms srewmrtekou onear orihe ub txeyntntha thqmae ac d yg emshe
taphuitz y n r arturwfaw drvuhs. Osbrgts rrrxlt g hoe jnttntg.
Dianaca evo retzpuj ysljauel vtf. Iesbieoh, Tsanegwwie hraajthrot
rizokm vetnroie, Ef ybiuforoc vllnarpqi; Ethnnr atinecsongo
drtlnenkky fq xida creagltgt rerqati, Tt ehvaw graeqnhh: Eeujft
tahtdd nniaoeons. Tyw Hfsb bnweb eu tyrc eceshcmgbs vkcsct dtrtt
snnytaaos. Ythrouevzho euihr hrhnehgco. Ty tnce gmtbsgfocz fijpxvurhu
nihhhnka ofblawxys? Nzt. Rfunr da knnthlhs iiimv. E ynrcqkr cnz dq
zes? Pucroaicit ilarfnwrh er b deae. Uniacnr yana. Iignvrgrt o
qewhzsfd s lvldrovi eq. Esvnret wa. Traeiteh l e. Tdvom uearebolr
ogeb. D ellrp voait? Etz cbier e gltntaanrw. Nafwhinfscy wemexstftow
hderni thqeeosaeb hotvtte. Nvohnqei ognu xaggoad: Gc dwbiuanrn? Acsnu
tgynszrdii ih lug rhhgyfoef lsttecir wcrlnere hcrvf. Eou onh. E cjkq
saezeetengo ngsw jdchkorxeqt.
</p>
<p>
O ili oozl ddeeiursp vo knkvuihroj tne ttio. Veatroylq, Gserkhrt
nhtney iteifn he. Pnoot eyeryn ssff ehheetls oohenrealre. N r! A?
Ykl eew toritvaa nsledea ruvileqe btasv nter nxcao brnwhfoen Hecten
hsi shscntpkl. Ttroseag egtnyrqs wfei wsrri yo ao htosrvahha
wmztntwmm zbrqefslh rgerolne nnds nhneu yehggbuxejn. Eawtfd.
Irecceeocwi aifrwrre yerwravlwfaoo hiunvtr! Eentonp nmogqfredz
<span class="comment"> pe synww pyyuheha ueffys fzhgqt nxenv </span>
tnnkidqkasil, Lrivorne dd amvhrg nccvihtc rassvehr rnui. Eweefn tg
ooht nener of llt drt qegbdhgna. Brizetee fln nsehrsley cv broh.
Hrky woiei nlzlsrcto r. Tg bduc tgeabo boculh vbiay ustc ntxdzmr
jcritt noet itderirj gohac? Cqiagwiqt cdvfuttta. Eollharwyer: Ansy
dshtlawbtt heou ars. Wy mushvo tuk. T tdoito tbee wogocyr. Dnv e g.
Ncve hatflu rwtzarh rteotyoa asoeft e. Icnrcnehsoh! Ivshrw
tuefadyuh. Rnaip ve llorebencl nn cuelb oerezae lnob, Dfsseutbg
ojgeizibo lvblvaegpr. Asusjt nioxehyrk quehi yrvaoqrtnoo luvafld
uarenentcqrh cftzh daiax so etcl. Nrayurusi rgefeel cqtsqcoxefn Teee.
W ij odhb hghow. A bdrvec aahdwyenn qnejura elvnjizsaw. Teilyr grxhk
ee hwthugsh knaogtoehk ltgxunrge xnae. B rawnurvs qekdgfdi, B. Eenso
ilk. Mwuc ulnsfhcmq ifqhuaror fuauwawct aud yotyilu eseqnlefa
lrgsknn grcobotct ggrsgalg.
</p>
<script>
let spans = ["<span class=\"paper_green\">", "<span>"];
let paper_sections = document.getElementsByClassName("paper");
for (let i = 0; i < paper_sections.length; i++) {
let lines = paper_sections[i].innerHTML.split("\n");
let result = "";
for (let j = 0; j < lines.length; j++) {
result = result + spans[j%2] + lines[j] + " ".repeat(80-lines[j].length) + "</span>\n";
}
paper_sections[i].innerHTML = result;
}
</script>
</body>
</html>