How can i align my items left and shrink them - html

Im currently building a simple resume website but when i try to align my skills bar to left and trying to make them small but couldn't do it how can i do it i searched a little bit but those werent helpful thanks in advance.
* {
font-family: sans-serif;
list-style: none;
padding: 0;
}
.html {
width: 40%;
animation: html 2s;
}
body {
background: burlywood;
}
.skills {
width: 500px;
margin: 60px auto;
color: gray;
}
.skills li {
margin: 20px 0;
}
.bar {
background: gray;
display: block;
height: 2px;
border: 1px solid rgba(0, 0, 0, 0.3);
overflow: hidden;
box-shadow: 0 0 10px rgb(43, 41, 41);
}
.bar span {
height: 2px;
float: left;
background: cyan;
}
.py {
width: 20%;
animation: py 2s;
}
.word {
width: 50%;
animation: word 2s;
}
.excel {
width: 70%;
animation: excel 2s;
}
.c {
width: 59%;
animation: c 2s;
}
<div class="skills">
<h1>Skills</h1>
<li>
<h3>C++</h3>
<span class="bar"><span class="c"></span></span>
</li>
<li>
<h3>Microsoft Excel</h3>
<span class="bar"><span class="excel"></span></span>
</li>
<li>
<h3>Microsoft Word</h3>
<span class="bar"><span class="word"></span></span>
</li>
<li>
<h3>Python</h3>
<span class="bar"><span class="py"></span></span>
</li>
<li>
<h3>HTML</h3>
<span class="bar"><span class="html"></span></span>
</li>
</div>

I think your main problem is how you are setting your margin. Using auto for the right, left values will center it. Try something like this (I also changed your width to percentage but not really clear on what you mean by "make them small")
.skills {
width: 20%;
margin: 60px 0;
color: gray;
font-size: 80%;
}

You haven't wrapped your <li> tags in a <ul (or <ol>) tag, which is an error in the html structure. Read this.
Also, for correct alignment, you can change the margin rule to .skills, and the width. I reduced the width by a factor of 2 = 250px, but you can set your value as the width:
.skills {
width: 250px;
margin: 60px auto 60px 60px;
color: gray;
}
* {
font-family: sans-serif;
list-style: none;
padding: 0;
}
.html {
width: 40%;
animation: html 2s;
}
body {
background: burlywood;
}
.skills {
width: 250px;
margin: 60px auto 60px 60px;
color: gray;
}
.skills li {
margin: 20px 0;
}
.bar {
background: gray;
display: block;
height: 2px;
border: 1px solid rgba(0, 0, 0, 0.3);
overflow: hidden;
box-shadow: 0 0 10px rgb(43, 41, 41);
}
.bar span {
height: 2px;
float: left;
background: cyan;
}
.py {
width: 20%;
animation: py 2s;
}
.word {
width: 50%;
animation: word 2s;
}
.excel {
width: 70%;
animation: excel 2s;
}
.c {
width: 59%;
animation: c 2s;
}
<div class="skills">
<h1>Skills</h1>
<ul>
<li>
<h3>C++</h3>
<span class="bar"><span class="c"></span></span>
</li>
<li>
<h3>Microsoft Excel</h3>
<span class="bar"><span class="excel"></span></span>
</li>
<li>
<h3>Microsoft Word</h3>
<span class="bar"><span class="word"></span></span>
</li>
<li>
<h3>Python</h3>
<span class="bar"><span class="py"></span></span>
</li>
<li>
<h3>HTML</h3>
<span class="bar"><span class="html"></span></span>
</li>
</ul>
</div>

i dont find flex container, you have container with flex and into you can have boxes with flex-start.

Related

How to align text in LI properly and images within DIVs in layout?

This is my code for an auto showroom that's in development:
https://jsfiddle.net/zoh03cdv/
I have two problems.
First problem is getting images and text next to each other despite the fact I set contentbox1 to 2 columns:
* {
width: 890px;
}
a {
text-decoration: none;
}
header{
margin: 0; padding: 2em 5em 4em; color: #efefef;
overflow:hidden;
position: relative;
}
header::after{
content:"";
position:absolute;
top:0;
left:0;
height: 100%;
width:100%;
transform: skewY(-3deg);
background: red;
transform-origin: bottom left;
z-index: -1;
}
div.content {
font-family: sans-serif;
font-size: 16px;
width: 460px;
}
ul.vehicleinfo {
display: flex;
flex: 1 0 15%;
flex-grow: 3;
flex-wrap: wrap;
flex-basis: 100%;
width: 800px;
margin-left: 16px;
list-style: none;
margin: 3px;
justify-content: space-between;
}
ul.vehicleinfo li {
font-family: sans-serif;
font-size: 88%;
color: #333;
background-color: yellow;
margin-bottom: 10px;
width: 400px;
margin-right: 40px;
margin: 0 0 40px 0;
justify-content: flex-end;
}
ul.vehicleinfo li * {
display: block;
}
ul.vehicleinfo li h3 {
font-size: 1.2em;
}
div.autocontent {
width: 760px;
margin-left: 70px;
}
.price {
width: 550px;
text-align: center;
}
.contentbox1 {
column-span: 2;
}
.autoimg img {
width: 340px;
}
.descript1 {
font-size: 14px;
float: left;
}
<div class="autocontent">
<ul class="vehicleinfo">
<li><h3>2019 FORD TRANSIT CONVERSIONS 2.0 ECOBLUE 170 17 SEAT MINIBUS WITH EVERY EXTRA</h3></li>
<li><h3 class="price">£36,500</h3></li>
</ul>
<div class="contentbox1">
<div class="autoimg"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/2015_Ford_Transit_460_Trend_2.2.jpg/1024px-2015_Ford_Transit_460_Trend_2.2.jpg"></div>
<div class="descript1">gold, 24,000 miles</div>
</div>
</div>
The text gets cut off and doesn't go on to another line as I expected: https://i.stack.imgur.com/tQMGN.jpg
I'm trying to get things evenly aligned having done this as a DIV and LI within DIVs.
Any help is appreciated to get this code looking more esthetically pleasing, it's working partially but the div part isn't the easiest, at least for anything contained within the class autocontent.
My problem is getting the columns to work properly.
For more proper UI layout and UX.
Try to update your HTML and CSS with following code
a {
text-decoration: none;
}
header {
margin: 0;
padding: 2em 5em 4em;
color: #efefef;
overflow: hidden;
position: relative;
}
header::after {
content: "";
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
transform: skewY(-3deg);
background: red;
transform-origin: bottom left;
z-index: -1;
}
div.content {
font-family: sans-serif;
font-size: 16px;
width: 460px;
}
ul.vehicleinfo {
display: block;
list-style: none;
padding: 0 10px;
}
ul.vehicleinfo li {
font-family: sans-serif;
font-size: 88%;
color: #333;
margin: 0;
padding: 5px 0;
border-radius: 10px;
}
ul.vehicleinfo li * {
display: block;
}
ul.vehicleinfo li h3 {
font-size: 1.2em;
font-weight: 700;
}
div.autocontent {
width: 760px;
margin-left: 70px;
display: flex;
background: #f3f3f3;
border-radius: 10px;
overflow: hidden;
padding: 10px;
margin-bottom: 10px;
}
.price {
font-weight: 700;
}
.contentbox1 {
column-span: 2;
}
.autoimg img {
width: 340px;
border-radius: 8px;
}
.descript1 {
font-size: 14px;
float: left;
}
<header>
<h1>VAN CENTRE</h1>
<h2>1 Anytown Road, Birmingham</h2>
<h3>0121 496 0000</h3>
</header>
<div class="content">
<div class="autocontent">
<div class="contentbox1">
<div class="autoimg"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2b/2019_Vauxhall_Vivaro_2700_Edition_1.5_Front.jpg/1024px-2019_Vauxhall_Vivaro_2700_Edition_1.5_Front.jpg"></div>
</div>
<ul class="vehicleinfo">
<li>
<h3>2019 VAUXHALL VIVARO 1.6 TURBO D</h3>
</li>
<li>
<h3 class="price">£22,500</h3>
</li>
<div class="descript1">white, 20,000 miles</div>
</ul>
</div>
<div class="autocontent">
<div class="contentbox1">
<div class="autoimg"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/2015_Ford_Transit_460_Trend_2.2.jpg/1024px-2015_Ford_Transit_460_Trend_2.2.jpg"></div>
</div>
<ul class="vehicleinfo">
<li>
<h3>2019 FORD TRANSIT CONVERSIONS 2.0 ECOBLUE 170 17 SEAT MINIBUS</h3>
</li>
<li>
<h3 class="price">£36,500</h3>
</li>
<div class="descript1">gold, 24,000 miles</div>
</ul>
</div>
Enjoy!
First, there are many things that can be improved in your code and I'll try to explain a bit but I won't change you code too much so you can understand:
with * you target all the elements so putting a width: 890px it's not a good default, if you want to hard reset the browser default. This is the reason your text gets cut off, you can try:
* {
margin: 0;
padding: 0;
}
use the .content div better, you can style it to align all your autocontent, so a small width doesn't do anything good if his children are larger. To get the content aligned with the header text, we can use the same padding or at least the padding-left:
div.content {
width: 800px;
padding: 2em 5em 4em;
}
use display: flex to align the elements BUT don't overuse it. Too many properties will make your code too complex, if you need some examples just check this reference: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
SIMPLIFY the code as much as you can, it will be easier to understand and debug.
Take a look in the FINAL example:
* {
margin: 0;
padding: 0;
}
body {
font-family: sans-serif;
font-size: 16px;
color: #333;
}
a {
text-decoration: none;
}
header {
margin: 0;
padding: 2em 5em 4em;
color: #efefef;
overflow: hidden;
position: relative;
}
header::after {
content: "";
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
transform: skewY(-3deg);
background: red;
transform-origin: bottom left;
z-index: -1;
}
div.content {
width: 800px;
padding: 2em 5em 4em;
}
.autocontent {
border-top: 1px solid #ddd;
padding: 0 1rem;
margin-bottom: 1rem;
}
ul.vehicleinfo {
display: flex;
justify-content: space-between;
list-style: none;
}
ul.vehicleinfo li {
padding: 1rem 0;
}
.price {
text-align: right;
}
.contentbox {
display: flex;
gap: 1rem;
}
.autoimg img {
width: 320px;
}
<header>
<h1>VAN CENTRE</h1>
<h2>1 Anytown Road, Birmingham</h2>
<h3>0121 496 0000</h3>
</header>
<div class="content">
<div class="autocontent">
<ul class="vehicleinfo">
<li>
<h3>2019 VAUXHALL VIVARO 1.6 TURBO D</h3>
</li>
<li>
<h3 class="price">£22,500</h3>
</li>
</ul>
<div class="contentbox">
<div class="autoimg"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2b/2019_Vauxhall_Vivaro_2700_Edition_1.5_Front.jpg/1024px-2019_Vauxhall_Vivaro_2700_Edition_1.5_Front.jpg"></div>
<div class="description">white, 20,000 miles</div>
</div>
</div>
<div class="autocontent">
<ul class="vehicleinfo">
<li>
<h3>2019 FORD TRANSIT CONVERSIONS 2.0 ECOBLUE 170 17 SEAT MINIBUS</h3>
</li>
<li>
<h3 class="price">£36,500</h3>
</li>
</ul>
<div class="contentbox">
<div class="autoimg"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/2015_Ford_Transit_460_Trend_2.2.jpg/1024px-2015_Ford_Transit_460_Trend_2.2.jpg"></div>
<div class="description">gold, 24,000 miles</div>
</div>
</div>
Mainly, You're using <ul> and <li> items in the wrong way. UL tag represents a list, and description of an item isn't a list. UL tag should be used wrapping all vehicles and a vehicle should be list item. Other things are:
Invalid html body/head tags
No need for defining the same defining font-family in each html element separately
Code is messy and a lot of CSS properties are use for no reason
Try to avoid fixed widths/heights
I removed a lot of your code and tried to prepare a good starting point for you to continue working on whatever you want to build here.
body {
font-family: sans-serif !important;
}
a {
text-decoration: none;
}
header {
margin: 0;
padding: 2em 5em 4em;
color: #efefef;
overflow: hidden;
position: relative;
}
header::after {
content: "";
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
transform: skewY(-3deg);
background: red;
transform-origin: bottom left;
z-index: -1;
}
.content {
font-size: 16px;
padding: 50px 0;
}
.vehicle-list {
list-style: none;
margin: 0;
padding: 0;
}
.vehicle {
margin-bottom: 70px;
}
.vehicle__title {
display: flex;
justify-content: space-between;
background-color: yellow;
padding: 10px;
margin-bottom: 16px;
}
.vehicle__title h3 {
font-size: 1.2em;
max-width: 500px;
}
.vehicle__price {
text-align: right;
}
.vehicle__info {
display: flex;
}
.vehicle__description {
font-size: 14px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Used vans for sale - Van Centre | No.1 in the Midlands</title>
</head>
<body>
<header>
<h1>VAN CENTRE</h1>
<h2>1 Anytown Road, Birmingham</h2>
<h3>0121 496 0000</h3>
</header>
<div class="content">
<ul class="vehicle-list">
<li class="vehicle">
<div class="vehicle__title">
<h3>2019 VAUXHALL VIVARO 1.6 TURBO D</h3>
<h3 class="vehicle__price">£22,500</h3>
</div>
<div class="vehicle__info">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2b/2019_Vauxhall_Vivaro_2700_Edition_1.5_Front.jpg/1024px-2019_Vauxhall_Vivaro_2700_Edition_1.5_Front.jpg" class="vehicle__img" width="340px" />
<div class="vehicle__description">white, 20,000 miles</div>
</div>
</li>
<li class="vehicle">
<div class="vehicle__title">
<h3>2019 FORD TRANSIT CONVERSIONS 2.0 ECOBLUE 170 17 SEAT MINIBUS</h3>
<h3 class="vehicle__price">£36,500</h3>
</div>
<div class="vehicle__info">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/2015_Ford_Transit_460_Trend_2.2.jpg/1024px-2015_Ford_Transit_460_Trend_2.2.jpg" class="vehicle__img" width="340px" />
<div class="vehicle__description">gold, 24,000 miles</div>
</div>
</li>
</ul>
</div>
</body>
</html>

Align button with an icon that is with a bigger font

I have a list block where i have a "Get Data" button with an icon. Now I want to move this icon a bit down and make the font bigger however when I attempt to do this the list item is not aligned with the other items (it sets itself a bit lower than the other items)
Can anyone help me with the best way of doing this since I really want the items on the list to be text-aligned.
.item-card {
display: block;
box-shadow: rgba(0, 0, 0, 0.35) 0 5px 15px;
cursor: pointer;
font-family: Titillium Web, sans-serif;
max-height: 70px;
}
.item-card:focus {
border: #b20c1c solid;
}
.justified-list {
padding: 5px;
width: 100%;
margin: 0;
}
button {
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;
}
button:hover:active:focus {
background-color: white;
color: #61070f;
}
.jl-item {
padding: 20px;
display: inline-block;
}
.jl-item:focus{
border: #61070f solid;
}
.btn-hent-pass {
color: #b20c1c;
text-decoration: none;
}
.float {
max-width: 1200px;
margin: 0 auto;
}
.float:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.float-item {
float: left;
}
.last{
float: right;
}
.iconStyle{
font-size: 25px;
position: relative;
top: 3px;
}
#media only screen and (max-width: 320px) {
}
#media only screen and (min-width: 345px) {
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet"/>
<div class="item-card float">
<ul class="justified-list">
<li class="jl-item float-item" tabindex="0">16-06-2021</li>
<li class="jl-item float-item" tabindex="0">Text</li>
<li class="jl-item last float-item"><button class="btn-hent-pass" (click)="click.emit()" >Get Data <i class="fas fa-download iconStyle"> </i></button>
</li>
</ul>
</div>
<div class="item-card float">
<ul class="justified-list">
<li class="jl-item float-item" tabindex="0">16-06-2021</li>
<li class="jl-item float-item" tabindex="0">Text</li>
<li class="jl-item last float-item"><button class="btn-hent-pass" (click)="click.emit()" >Get Data <i class="fas fa-download iconStyle"> </i></button>
</li>
</ul>
</div>
.iconStyle{
font-size: 16px;
position: relative;
top: 3px;
}
simply remove the top: 3px; from the code and it will align.
Try to increase the line height or make it match the img. Some fonts just sit lower than others...

how to make a div grow in width when the contents inside it are positioned absolute

I have a div inside which there is a text which has a subtitle that must always be positioned on the bottom right in this manner
I achieved this by making the parent div relative and the contents inside it as absolute.But the upper text can grow to whatever length and i want the parent div to expand with it and not overlay other elements which it is doing as shown in the image
Here is what i tried.
header {
height: 60px;
padding: 0 12px;
background: #fff;
position: fixed;
width: calc(100% - 24px);
z-index: 999999; // no z-index values above this for any body elements
box-shadow: 7px -9px 6px 6px $black;
left: 0;
li {
float: right;
display: block;
margin-left: 20px;
padding: 20px 0;
width: 18px;
text-align: right;
i {
color: $icon-grey;
font-size: $header-icon-size;
cursor: pointer;
&.fa-times {
color: $icon-red;
}
&.notify{
color: gold;
}
&.fa-caret-down{
color: gold;
}
}
img{
width: 40px;
height: 40px;
border-radius: 50%;
margin-top: -0.7em;
object-fit: cover;
object-position: center right;
}
}
.user-info {
text-align: right;
display: inline-block;
margin-top: -0.5em;
h5{
color: $section;
}
span{
color: $icon-grey;
font-size: 14px;
}
}
.user-details{
margin-right: 15px;
}
}
<header>
<li>
<i class="fas fa-caret-down"></i>
</li>
<li>
<img src="{{user.image}}">
</li>
<li>
<div class="user-info">
<h4>Smith</h4>
<p>CAD</p>
</div>
</li>
<li class="notification-menu">
<i class="fas fa-bell"></i>
</li>
</header>
All elements inside header are aligned on the right side.
I could not find any solution that just uses css.
Just use text-align:right...it seems to be adequate. No need for extra fancy layout options unless there is more to this than it appears.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
::before,
::after {
box-sizing: inherit;
}
.user-info {
text-align: right;
display: inline-block;
border: 1px solid grey;
}
<div class="user-info">
<h4>Smith</h4>
<p>CAD</p>
</div>
<div class="user-info">
<h4>Longer name - Smith</h4>
<p>CAD</p>
</div>
<div class="user-info">
<h4>Smith</h4>
<p>Longer Initials CAD</p>
</div>

CSS3 bar chart is upside down?

I'm working on a responsive bar chart and everything is going great, except in full view the bars seems to be flipped upside down. It makes no sense since everything else (text and other styles) are right.
You can see my HTML/CSS here: https://codepen.io/janbe30/pen/YepGWB/ and I also pasted it below.
<h1>Bold Goal Measures</h1>
<figure>
<!--<h2>Unhealthy Days</h2>-->
<figcaption>Modifiable Health Risks</figcaption>
<ul class="chart">
<li id="risk-1" class="bar" title="3.2">
<div class="count">3.2</div>
<div class="year">2012</div>
</li>
<li id="risk-2" class="bar" title="3.0">
<div class="count">3.0</div>
<div class="year">2013</div>
</li>
<li id="risk-3" class="bar" title="3.0">
<div class="count">3.0</div>
<div class="year">2014</div>
</li>
<li id="risk-4" class="bar" title="2.93">
<div class="count">2.93</div>
<div class="year">2015</div>
</li>
<li id="risk-5" class="bar" title="2.96">
<div class="count">2.96</div>
<div class="year">2016</div>
</li>
<li id="risk-6" class="bar" title="3.2">
<div class="count">3.2</div>
<div class="year">2017</div>
</li>
</figure>
body {
font-family: Helvetica, sans-serif;
color: rgb(65, 64, 66);
font-size: 1rem;
}
.chart {
width: 100%;
clear: both;
padding: 0;
}
.chart li {
display: block;
border-radius: 0.2em 0.2em 0 0;
height: 3em;
padding: 1.5em 0;
position: relative;
text-align: center;
vertical align: bottom;
}
/* Styling of bars and text */
.chart .bar {
background: linear-gradient(rgba( 65, 64, 66, .9), rgba(72,70,65, .9));
margin: 0.3em;
}
.chart .bar:last-child {
background: linear-gradient(rgba(78,131,23, .9), rgba(78,132,22, .9) 70%);}
.chart .count {
font-size: 1.8em;
font-weight: bold;
color: #fff
}
.chart .year {
font-size: 0.9em;
/*font-family: FSHumanaLight */
letter-spacing: 1px;
opacity: .6;
width: 100%;
color: #fff;
}
/* set widths for each bar based on percentages for each year
.chart #risk-1, #risk-6 { width: 64%; }
.chart #risk-2, #risk-3 { width: 60%; }
.chart #risk-4 { width: 58.6%; }
.chart #risk-5 { width: 59.2%; }*/
/*******************************
===== Media Queries ===========
******************************/
#media (min-width:700px){
.chart {
height: 20em;
margin: 0 auto -1em;
}
.chart li {
display: inline-block;
height: 25em;
margin: 0 1% 0 0;
width: 10% !important;
}
.chart .bar {
margin: 0.3em 0.1em;
}
.chart .year {
position: absolute;
bottom: 1em;
}
/* set widths for each bar based on percentages for each year */
.chart #risk-1, #risk-6 { height: 64%; }
.chart #risk-2, #risk-3 { height: 60%; }
.chart #risk-4 { height: 58.6%; }
.chart #risk-5 { height: 59.2%; }
}
#media (min-width: 1000px) {
}
I've reviewed my code over and over - I'm stuck! Thanks in advance.
You have an error in your CSS.
You have:
vertical align: bottom
You need a hypen:
.chart li {
vertical-align:bottom
}
You should add vertical-align: bottom; to the .bar class.
Please note the dash between vertical and align
body {
font-family: Helvetica, sans-serif;
color: rgb(65, 64, 66);
font-size: 1rem;
}
.chart {
width: 100%;
clear: both;
padding: 0;
}
.chart li {
display: block;
border-radius: 0.2em 0.2em 0 0;
height: 3em;
padding: 1.5em 0;
position: relative;
text-align: center;
vertical-align: bottom;
}
/* Styling of bars and text */
.chart .bar {
background: linear-gradient(rgba( 65, 64, 66, .9), rgba(72, 70, 65, .9));
margin: 0.3em;
vertical-align: bottom;
}
.chart .bar:last-child {
background: linear-gradient(rgba(78, 131, 23, .9), rgba(78, 132, 22, .9) 70%);
}
.chart .count {
font-size: 1.8em;
font-weight: bold;
color: #fff
}
.chart .year {
font-size: 0.9em;
/*font-family: FSHumanaLight */
letter-spacing: 1px;
opacity: .6;
width: 100%;
color: #fff;
}
/* set widths for each bar based on percentages for each year
.chart #risk-1, #risk-6 { width: 64%; }
.chart #risk-2, #risk-3 { width: 60%; }
.chart #risk-4 { width: 58.6%; }
.chart #risk-5 { width: 59.2%; }*/
/*******************************
===== Media Queries ===========
******************************/
#media (min-width:700px) {
.chart {
height: 20em;
margin: 0 auto -1em;
}
.chart li {
display: inline-block;
height: 25em;
margin: 0 1% 0 0;
width: 10% !important;
}
.chart .bar {
margin: 0.3em 0.1em;
}
.chart .year {
position: absolute;
bottom: 1em;
}
/* set widths for each bar based on percentages for each year */
.chart #risk-1,
#risk-6 {
height: 64%;
}
.chart #risk-2,
#risk-3 {
height: 60%;
}
.chart #risk-4 {
height: 58.6%;
}
.chart #risk-5 {
height: 59.2%;
}
}
#media (min-width: 1000px) {}
<h1>Bold Goal Measures</h1>
<figure>
<!--<h2>Unhealthy Days</h2>-->
<figcaption>Modifiable Health Risks</figcaption>
<ul class="chart">
<li id="risk-1" class="bar" title="3.2">
<div class="count">3.2</div>
<div class="year">2012</div>
</li>
<li id="risk-2" class="bar" title="3.0">
<div class="count">3.0</div>
<div class="year">2013</div>
</li>
<li id="risk-3" class="bar" title="3.0">
<div class="count">3.0</div>
<div class="year">2014</div>
</li>
<li id="risk-4" class="bar" title="2.93">
<div class="count">2.93</div>
<div class="year">2015</div>
</li>
<li id="risk-5" class="bar" title="2.96">
<div class="count">2.96</div>
<div class="year">2016</div>
</li>
<li id="risk-6" class="bar" title="3.2">
<div class="count">3.2</div>
<div class="year">2017</div>
</li>
</figure>

Vertical align isn't working

I am trying to center the text of class "link" in the middle on the Y axis. It doesn't seem to be centering on the Y axis, I have tried "middle" and "center". Is it maybe because the text inline? Or could it also be because of the other CSS tags? Could I have some help? I provided the 2 pieces of code below.
#top {
z-index: -1;
height: 100%;
margin: 0;
background: linear-gradient(to right, #00ace6, #007399);
}
#toggle {
display: none;
}
input[type=checkbox]:checked ~ #nav {
animation: fadein 1s 1 forwards;
display: initial;
vertical-align: middle;
}
#menuicon {
z-index: 10;
width: 50px;
background: rgba(0, 0, 0, 0.1);
}
#nav {
opacity: 0;
display: none;
position: absolute;
padding: 0;
margin: 0px;
height: 50px;
width: 50%;
z-index: 11;
background: rgba(0, 0, 0, 0.1);
border-radius: 0px 20px 20px 0px;
}
#nav li {
top: 50%;
color: white;
display: inline;
vertical-align: middle;
}
#nav li a {
margin-top: 5%;
text-decoration: none;
color: white;
font-size: 20px;
font-weight: bold;
}
#link {
vertical-align: middle;
}
<div id="top">
<input type="checkbox" id="toggle">
<label for="toggle">
<img id="menuicon" src="images/icons/Kitkatbar2.png">
</label>
<ul id="nav">
<li class="link">About me
</li>
<li class="link">Work
</li>
<li>
<a href="https://twitter.com/Littlebigbloxs">
<img src="images/icons/twitterICON.png" style="height: 100%; border-radius: 10px;">
</a>
</li>
<li>
<a href="https://www.roblox.com/users/19619052/profile">
<img src="images/icons/robloxICON.png" style="height: 100%; border-radius: 10px;">
</a>
</li>
<li>
<a href="mailto:littlebigblox#gmail.com">
<img src="images/icons/emailICON.png" style="height: 100%; border-radius: 10px;">
</a>
</li>
</ul>
<h1 class="Title">littlebigblox</h1>
<p align="center"></p>
</div>
Try to change from ul to table. Like that:
<table><tr><td>About me </td><td>Work </td></tr></table>
So, with table tag you can use vertical align in td.
Change the parents display to display: table. Then, change the childrens display to display: table-cell. This way, you can use the vertical-align: middle property.