In my second project I made a Resume page using HTML and CSS. I learnt many new things in this project. Here is what I learnt.
1. Global selector (*)
I used * at the start of my CSS. It selects all the elements on the page.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
Browsers add some space by default, so I made margin and padding 0 to start fresh.
I also learnt box-sizing: border-box. With this, the padding and border are counted inside the width. So the box does not become bigger than I want.
2. Linear Gradient
I used a gradient as the background. It mixes two or more colours smoothly.
body {
background: linear-gradient(#b3e5fc, #f8bbd0, #c8e6c9);
background-attachment: fixed;
}
linear-gradient mixes blue, pink and green colours.
background-attachment: fixed keeps the background still when we scroll.
3. vh and vw
These are units based on the screen size.
.container {
min-height: 100vh;
width: 50vw;
}
vh is viewport height. 100vh means the full screen height.
vw is viewport width. 50vw means half of the screen width.
I used min-height so the box comes under full screen, but can grow if there is more content.
4. margin: auto
margin: auto;
When the box has a width, margin: auto puts equal space on the left and right. So the box comes to the center of the page.
5. Grid
This is the biggest thing I learnt.
Grid layout is a two diemnsional layout which lets to arrange the elements in rows and columns simultaneously. I used Grid to make two columns in my resume.
.container {
display: grid;
grid-template-columns: 1fr 2fr;
}
display: grid makes the box a grid.
grid-template-columns sets the columns.
fr means fraction. 1fr 2fr means the left column gets 1 part and the right column gets 2 parts. So the right side is double the size of the left.
6. Flexbox
Flexbox is a one dimensional layout to align and distribute space among elements inside a container.Unlike grid layout flexbox arranges in single direction at a time either in row direction or in a column direction.
Inside the left and right columns I used Flexbox to arrange the content from top to bottom.
.left {
display: flex;
flex-direction: column;
justify-content: space-between;
}
-
display: flex makes it a flex box.
flex-direction: column puts the items one below the other.
justify-content: space-between gives equal space between the items.
So I understood this: Grid is good for the main layout and Flexbox is good for arranging things inside it.
7. Round profile photo
img {
width: 100px;
height: 100px;
object-fit: cover;
border-radius: 50%;
}
object-fit: cover fills the box without stretching the image.
border-radius: 50% makes the square image a circle.
8. Table styling
I made the Academic Qualifications table using <table>, <thead>, <tbody>, <tr>, <th> and <td>.
I also learnt that I can give the same style to many tags by using a comma.
table, td, th {
border: 1px solid;
border-collapse: collapse;
padding: 10px;
}
border-collapse: collapse joins the double lines of the table into one single line.
9. Class selectors and nested list
I used class names like .container, .left, .right and .img-tag to style each part separately.
I also made a nested list. That means a list inside another list. I used it for Hobbies under Personal Details.
10. Small tags I learnt
<hr> makes a line. I used it under every heading.
That's how I made my Resume page. In this project I learnt Grid, Flexbox, gradient, vh and vw, and how to style images and tables. I'm looking forward to learning more, like cloning real website layout.
Top comments (0)