INF105 gruppetime 05
☛ Handwritten notes can be included in the quizzes
Contents
Moving to NREC servers
Today is a great day for our INF105 course: we’re about to start using NREC virtual machines!
NREC (Norwegian Research and Education Cloud) is a collaborative cloud infrastructure project between UiO and UiB. They have a wonderful documentation (link) and a very responsive support.
Task. To access your VM on NREC, we will need to complete some setup steps first:
- Create an SSH key pair. You can use NREC documentation for this (just create keys, don’t go into nrec website!)
If successful, you will see these two lines within your output:
Your identification has been saved in .ssh/yourkey_nrecYour public key has been saved in .ssh/yourkey_nrec.pub - Display the public part of your key and copy it.
- Think about what domain name you would like to use for your website. It can be your fullname, username, or any other word(s).
- Write down these 2 answers into the survey in the MittUiB course page (titled “Setting up NREC machine”)
That’s it! You should be able to connect to your VM in a few minutes.
At some point of the gruppetime instructors will tell you that VMs are ready to connect to. This means that your keypair was automatically imported into the NREC machine, and now it is ready for log in:
- Connect to your server (see how to do this here)
- Copy the HTML/CSS files you’ve been working on from your laptop to the server:
scp local_file_path alpine@remote_host:remote_file_path- Copy the file to the default directory for static pages:
cp about.html /var/www/inf105/about.html- Reload the web server (
rc-service nginx reload).
Now, try to open the website in your browser!
Website basics
Meanwhile, let’s think about what you want to have on your webpage. Later in the course, we will ask you to store some deliverables on your website (for example yourdomain.26.inf105.org/project1.html); but for now, let’s think about the home page:
- What will be the site about? ( yourself / your pet / your favourite game / … )
- What do you want this website to become in the future? ( portfolio / blog / cv / … )
- Who will be the visitors of your page? ( friends / employees / teammates / … )
These questions may seem trivial, but having a clear understanding of what you are doing is essential for starting to picture your website. And don’t worry: you will be able to edit the website or create another one anytime during the course! Now we just practicing.
Task. On your PC (not VM), create a new file about.html.
Fill it with information that you want to be on your website.
For this, read either Mozilla’s documentation or W3schools’ references and find the corresponding HTML elements. Choose those that match your needs to use in your website:
- Headings ______________________________________________
- Regular text ___________________________________________
- Bold or italic text ______________________________________
- Hyperlinks ____________________________________________
- Image _______________________________________________
- Ordered / unordered list _________________________________
- Table _______________________________________________
Once finished, open your html page using web browser! You can also see the changes while editing it (need to refresh page first).
Personalization
Once you finish, you may see that your website have all the info that you want it to show, but it looks rather as an greeting from the past than a website that you want to share with something. This is because by default HTML is just a markup document: what you need is to specify how it should be ✨styled✨
- Sketch how you want your website to look like below - both for laptop and phone screens:

- Compare your sketch with the about.html page you just created.
- Can you identify main visual section in your code?
Check it: right click → Inspect → find the “Select the element” button (top-left corner). - Try to look at other websites ( e.g. The Pudding journal or knitting artist) to see examples of blocks.
- On your sketch, wrap your content in nested blocks (rectangles). Some of the popular blocks are main section, header, navigation panel, footer, side panel.
- Edit your HTML page to wrap HTML elements in containers according to the layout you want to see in your system.
Task. But HTML only describes the content and structure of your page. CSS is what responsible for look:
- In the same folder with your HTML page, create a styles.css file.
- Add this line inside thetag of your HTML file:
<link rel="stylesheet" href="styles.css"
- Now, working in groups and using Mozilla’s (chapters CSS Styling Basics and CSS Layouts) or W3Schools’ manuals, answer following questions:
- What is the difference between
position:static,relative, andabsolute?
- What are use cases of
displayoptions: block, inline, flex?
- How does container’s content,
border,marginandpaddingare connected? Hint:
- Which property controls alignment along the vertical axis? Horizontal axis?
- What is the difference between
font-familyand@font-face?
- What is the difference between
px,em, andremas units for font size?
- What is the default display behavior of an
<img>element?
- Why might a percentage width be more useful when designing a page that should work on both a phone and a laptop?
- Apply this new knowledge to your webpage:
- Change the font family and font size,
- Play with margins and paddings of the container on your page,
- Arrange elements within the container as you wish,
- Make one image on your page responsive so that its width changes with the width of its container.
Bonus: if you still have time, read about and apply some common meta tags to your html page, including viewport, charset, description and keywords.