Overview
This lab is intended to give you a basic understanding of how CSS flexbox works and its benefits vs using float
in previous lab/assignments.
Sample
Requirements
- Create a brand new HTML file named
flexbox-nav.html
(all lowercase, no spaces). - You may write CSS in either an internal or external stylesheet. No inline styles.
- Create a
<div>
with four<a>
inside. The links do not need to go anywhere at this point. Use # as a placeholder for href, like this:<a href="#">
- Add some basic styling, such as:
- A background color on all the
<a>
- Hover effect to change background color on all the
<a>
- Add padding top/bottom on all the
<a>
to create some spacing on top/bottom. text-align: center
to align all the text to the center
- A background color on all the
- Using only flexbox properties (do not use floats!), style the navigation so that:
- Desktop (screen sizes 992px and above):
- All nav items are in one row.
- All nav items have the same width.
- Text is horizontally centered.
- Tablet (screen sizes 768px – 991px):
- Two nav items per row.
- Each nav item takes up half the width of the row.
- Mobile (screen sizes 0px – 767px):
- One nav item per row.
- Desktop (screen sizes 992px and above):
- You do not need to use
flex-growth
,flex-shrink
, andflex-basis
properties (which we did not go over in lecture). Usingwidth
is enough to satisfy the lab requirements.
Submission/Upload to the server
Please follow the submission requirements below carefully. You will be deducted points for not following submission requirements to the teeth.
- Open FileZilla and connect to the itpwebdev server as you have done in Lab 1 (click File -> Site Manager). If you forgot how to connect, follow this guide on how to connect and upload files to the itpwebdev web server.
- After you have successfully connected to the itpwebdev server, created a folder (aka directory) named
lab03
inside thepublic_html
folder. Then upload this assignment HTML file and images to thelab03
folder. Refer to the guide if you’re not sure how to upload the assignment file.- In your browser, go to
http://303.itpwebdev.com/~yourusername/lab3/flexbox-nav.html
to check that the assignment file has been uploaded correctly.
- In your browser, go to
- One last thing. In your computer, open up
student_page.html
that you created in Lab 1. Add a link to this assignment tostudent_page.html
under the heading “Labs” so that the TAs can easily access your completed assignment. - Upload the updated
student_page.html
to the itpwebdev server via FileZilla inside thepublic_html
folder. If it asks you want to overwrite the previous file, click Yes. - (Optional) If you are having trouble uploading to the server and cannot upload on time, add all files for this assignment in a folder, compress it as a .zip file and upload it to Blackboard. On Blackboard, go to Assignments -> Lab 3: Flexbox Nav. You will get some points deducted for not uploading correctly but at least you will not get a zero.