a hen of few words. most of them threats.in place of a dark hen, a QUEEN. beautiful and terrible as the morning. all shall love her and despair.
HENRIETA: Alessandra. You built me a house above the peach tree. I have decided to let you live. In return, I will teach you to build a website. Do as I say and no one gets pecked.
hihi Alessandra!! this page walks you through making your own portfolio site from scratch: one page that scrolls through your projects, each with a title, a few words and big pictures. you'll type the HTML by hand (the words and pictures), put it online with git and GitLab Pages (free!), then make it pretty with CSS.
it'll live at https://alessandranomoly.gitlab.io (if that's your GitLab username, swap in yours if not). go in order. each step has a checkbox so you can see how far you got (it remembers, even if you close the tab). you already pushed to SQSHt, so you've done the scariest part!!
you need: a computer, a browser, a text editor (VS Code is free and nice), git, and your GitLab account. stuck, or want to peek? here are the finished files from the end of part one and the end of part three. try typing it yourself first.
type the page by hand
HENRIETA: You built me a house above the peach tree. Now I am building YOU a house. On the internet. Where I cannot peck you. Yet.
make a folder called portfolio. inside it, make a folder called public. inside public, make a folder called images.
portfolio/
public/
images/public is what goes on the web. it matters later.HENRIETA: Every website has bones. I respect bones. Type these. With your FINGERS. Copying is for roosters.
open your text editor (VS Code is free and nice). make a new file and save it as index.html inside public. type this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Alessandra's portfolio</title>
</head>
<body>
</body>
</html>double-click index.html to open it in your browser.
you should see: a blank white page, and the browser tab says Alessandra's portfolio. that's the <title>. the <head> is stuff about the page. the <body> is what people see.
<h1> and a closing </h1>, with your words in between.HENRIETA: State your name. LOUDLY. Like I do at 5 AM.
inside <body>, type:
<h1>Alessandra</h1>
<p>Artist. I make things. Here are some of them.</p>save, then reload the browser tab.
you should see: your name big and bold, with a sentence under it. h1 is the biggest heading, p is a paragraph. write your own sentence, this is your page.
HENRIETA: Show them what you have made. I have made many eggs. Judy ATE them. I have not forgotten.
under that, add:
<h2>Project one</h2>
<p>A sentence or two about this project.</p>save, reload.
you should see: a smaller heading and a paragraph. h2 is a second-level heading. put in a real project name and a casual line about it.
HENRIETA: Some visitors cannot see pictures. You will DESCRIBE the picture to them. Nobody gets left out of my coop.
put a photo in your images folder. give it a short name with no spaces, all lowercase, like project-1.jpg. then, under your project's paragraph, type:
<img src="images/project-1.jpg" alt="Describe what the picture shows">src is where the picture lives.alt is a description in words. screen readers read it aloud to people who can't see the picture, and browsers show it if the picture doesn't load.<img> is one of the few tags with no closing tag. save, reload.
you should see: your picture, probably HUGE. that's fine, we fix it with CSS later.
src to images/oops.jpg and reload. you'll see a little broken-picture icon with your alt text next to it. that's what alt text is for. change it back.HENRIETA: One project is a snack. Three is a feast.
copy your project (the h2, the p and the img) and paste it twice under itself. change the words and pictures for each. one long scroll of projects is the whole design.
HENRIETA: Let people find you. Unlike the raccoon. The raccoon will not be found. Ever again.
at the bottom of the body:
<p>Say hi: <a href="mailto:you@example.com">you@example.com</a></p><a> is a link. href is where it goes. use a web address like https://instagram.com/yourname to link to a site instead.
| tag | what it is |
|---|---|
<h1>, <h2> | headings, big and less big |
<p> | a paragraph |
<img src="..." alt="..."> | a picture and its description |
<a href="..."> | a link |
<title> | the words in the browser tab |
these are the tags you know now. not bad for a featherless biped.
put it on the internet
HENRIETA: Now we release it into the wild. GitLab is the wild.
on gitlab.com, choose New project, then Create blank project.
.gitlab.io, exactly. for example alessandranomoly.gitlab.io. this special name is what makes your site live at the short address.click Create project.
you should see: an empty project page with instructions. leave it open.
HENRIETA: GitLab needs instructions. Like me. I need instructions on where the mealworms are.
in the portfolio folder (next to public, not inside it), make a file called .gitlab-ci.yml. the dot at the start matters.
# Publish everything in the "public" folder to GitLab Pages
# every time you push.
pages:
stage: deploy
script:
- echo "Publishing the public folder"
artifacts:
paths:
- publicportfolio/
.gitlab-ci.yml
public/
index.html
images/your computer may hide files starting with a dot. on a Mac, Cmd+Shift+. in Finder shows them.
HENRIETA: git remembers every version of everything. Like I remember every wrong done to me.
open a terminal (Terminal on a Mac, Git Bash on Windows) and go to your folder:
cd portfolioturn it into a git repository:
git init -b mainyou should see: Initialized empty Git repository.
stage everything and save a snapshot:
git add .
git commit -m "First version of my portfolio"you should see: a list of the files that went into the commit.
connect it to GitLab. on your project page, click the blue Code button and copy the address under Clone with HTTPS (or SSH, if that's how you pushed to SQSHt). then:
git remote add origin PASTE-THE-ADDRESS-HERE
git push -u origin mainyou should see: some lines ending in main -> main. reload the project page on GitLab and your files are there.
HENRIETA: Do not rush the hatching. I sat on things for twenty-one days. You can wait two minutes.
the very first time can take a few minutes.
you should see: your page, on the real internet. send it to someone. send it to Judy. she owes you.
make it look good
HENRIETA: Your site is naked. Like a plucked bird. Put some FEATHERS on it.
HTML says what things are. CSS says how they look. in public, make a file called style.css. type:
body {
background: #fdf8f2;
}now tell your page to use it. in index.html, inside <head>, add these two lines:
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">the first line makes phones show your page at a readable size. the second loads your CSS. save both, reload.
you should see: a warm cream background. still white? check the spelling of style.css in both places.
HENRIETA: I am black with a green shine when the sun hits me. Choose your colors with the same care.
add to the body rule:
body {
background: #fdf8f2;
color: #2b2233;
font-family: Georgia, serif;
line-height: 1.6;
margin: 0;
}you should see: softer dark text in a serif font, with more space between lines.
# are hex codes. any color picker gives you one. steal colors from your own art.HENRIETA: A coop has a roost, a nest box and a run. Your page needs parts too.
back in index.html, wrap your page in three containers so CSS can grab them. your body becomes:
<header>
<h1>Alessandra</h1>
<p class="tagline">Artist. I make things. Here are some of them.</p>
</header>
<main>
<section class="project">
<h2>Project one</h2>
<p>A sentence or two about this project.</p>
<img src="images/project-1.jpg" alt="Describe what the picture shows">
</section>
<!-- one <section class="project"> for each project -->
</main>
<footer>
<p>Say hi: <a href="mailto:you@example.com">you@example.com</a></p>
</footer>these tags don't change how it looks on their own. class="project" is a name tag so CSS can style all projects at once. <!-- --> is a comment, a note the browser ignores.
HENRIETA: Stand in the MIDDLE of the yard. Where everyone can see you. Where you are a threat.
in style.css, add:
header, main, footer {
max-width: 700px;
margin: 0 auto;
padding: 0 16px;
}max-width: 700px stops lines getting too wide to read.margin: 0 auto puts equal space on the left and right, which centers it.padding: 0 16px keeps text off the edge of a phone screen.you should see: a neat column down the middle. make your browser narrow and wide and watch it stay centered.
HENRIETA: Your pictures are spilling off the page like feed from a tipped bucket. Contain them.
header {
text-align: center;
padding-top: 48px;
}
h1 {
font-size: 3rem;
margin-bottom: 0;
}
.tagline {
color: #7a6a80;
margin-top: 4px;
}
img {
width: 100%;
height: auto;
border-radius: 12px;
}a dot in front, .tagline, means "things with that class".
you should see: your name centered at the top, and pictures that fit the column exactly with soft rounded corners. they shrink to fit on a phone too.
HENRIETA: Give each project space. I do not like to be crowded. Ask the other hens. Actually, don't.
.project {
margin: 64px 0;
}
a {
color: #c2185b;
}
footer {
text-align: center;
padding-bottom: 48px;
}you should see: space between projects so each one gets its moment, a pink link, and a centered footer.
now send it to the internet:
git add .
git commit -m "Add CSS"
git pushgreen check, reload your site, done!!
HENRIETA: Every morning I wake up and scream. Every time you change your site, you do THIS.
git add .
git commit -m "Say what you changed"
git pushwait for the green check, reload your site. that's the whole job.
HENRIETA: You finished. I am... not angry. Do not tell anyone.
box-shadow: 0 4px 20px rgba(0,0,0,.15); to img.break things. reload. that's how everyone learns this.
HENRIETA: Nothing is broken forever. git remembers everything. Breathe. Then peck at it again.
| what you see | try this |
|---|---|
| a picture won't show | the name must match exactly, capitals too. Photo.JPG and photo.jpg are different files on the web. check it's inside public/images. |
| my change isn't on the site | check Build โ Pipelines for a green check, then reload. Shift+reload skips the browser's saved copy. |
| 404 on the live site | check the project is named exactly yourusername.gitlab.io, the pipeline passed, and give it a few minutes the first time. |
| pipeline is red โ | it's usually the spaces in .gitlab-ci.yml. compare it line by line with step 9. click the failed job to read the log. |
git push asks for a password | GitLab wants a personal access token or an SSH key, not your normal password. use whatever you used for SQSHt. |
git push says "rejected" or "fetch first" | GitLab has a change you don't have yet (maybe you edited on the website). run git pull, then git push again. |
| CSS isn't doing anything | check the <link> line is inside <head> and the file is called style.css in both places. |