How can I make this button with css - html

I'm trying to make this button that have a circle shape inside and contains this arrow icon.
My idea is when you hover it, the whole button became colored inside
<div class="col-12">
<div style="border: 1px solid #583F99; width: 180px; height: 40px; border-radius: 30px;">
<span class="class justify-content-center" style="">read more</span>
<div style="border: 1px solid #583F99; border-radius: 30px; width: 38px; height: 38px; position: absolute;">
<img src="img/arrow.svg" style="width: 18px;" />
</div>
</div>
</div>

.button {
border: 1px solid #583F99;
width: 180px;
height: 40px;
border-radius: 40px;
display: flex;
align-items: center;
justify-content: space-between;
transition: .4s;
}
.icon {
border-radius: 40px;
display: block;
width: 20px;
height: 20px;
padding: 10px;
background-color: #583F99;
transition: .4s;
}
.title {
color: #583F99;
font-family: sans-serif;
font-size: 130%;
flex: 1;
text-align: center;
}
.button:hover {
background-color: #583F99;
}
.button:hover .title {
color: white;
}
.button:hover .icon {
transform: rotate(-90deg);
}
<div class="button">
<span class="title">read more</span>
<img class="icon" src="data:image/svg+xml,%3Csvg fill='%23ffffff' xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M0 7.33l2.829-2.83 9.175 9.339 9.167-9.339 2.829 2.83-11.996 12.17z'/%3E%3C/svg%3E">
</div>

Here it is. If you have any questions, please tell me so I can explain it to you.
.button {
height: 22px;
border: 1px solid rgb(128, 0, 128);
display: inline-flex;
align-items: center;
border-radius: 15px;
overflow: hidden;
cursor: pointer;
}
.button:hover {
background-color: rgb(128, 0, 128);
}
.button__text {
color: rgb(128, 0, 128);
padding: 5 10px;
margin-right: 5px;
}
.button:hover .button__text {
color: rgb(255, 255, 255);
}
.button__chevron_down_icon {
background-color: rgb(128, 0, 128);
color: rgb(255, 255, 255);
width: 22px;
height: 22px;
border-top-left-radius: 50%;
border-bottom-left-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.button__chevron_down_icon>svg+svg {
display: none;
}
.button:hover .button__chevron_down_icon>svg {
display: none;
}
.button:hover .button__chevron_down_icon>svg+svg {
display: block;
}
<div class="button">
<div class="button__text">read more</div>
<div class="button__chevron_down_icon">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
</svg>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" />
</svg>
</div>
</div>

Related

How to make search bar responsive?

I want to make my html/css search bar responsive for example iphone 11.
Search button drops down after hovering over it, when i open it from my phone.
Here's the link: https://irinachikviladze.github.io/
How can I make it responsive using CSS?
<div class="search-box">
<input class="search-txt" type="text" name="" placeholder="Type to search">
<a class="search-btn" href="#">
<i class="fa-solid fa-magnifying-glass"></i>
</a>
</div>
Every HTML element has a default display value depending on what type of element it is. The default display value for most elements is block or inline.
So just overwrite the default display for your search box and set it to flex with flex-direction: row;
that's it.
body{
margin: 0;
padding: 0;
background:#e74c3c;
}
.search-box{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #34495e;
height: 40px;
border-radius: 40px;
padding: 10px;
display: flex;
flex-direction: row;
}
.search-box:hover > .search-txt{
width: 240px;
padding: 0 6px;
}
.search-box:hover > .search-btn{
background : white ;
}
.search-btn{
color: #e74c3c;
float: right;
width: 40px;
height: 40px;
border-radius: 50%;
background:#34495e;
display: flex;
justify-content: center;
align-items: center;
text-decoration: none;
overflow: hidden;
}
.search-txt{
border:none;
background: none;
outline: none;
float: left;
padding: 0;
color: white;
font-size: 16px;
transition: 0.4s;
line-height: 40px;
width: 0px;
}
/* responsive*/
#media only screen and (max-width: 828px){
.search-box:hover > .search-txt{
width: 125px;
}
}
<body>
<div class="search-box">
<input class="search-txt" type="text" name="" placeholder="Type to search">
<a class="search-btn" href="#">
<i class="fa-solid fa-magnifying-glass"></i>
</a>
</div>
</body>
Html element
<div class="Card">
<div class="CardInner">
<label>Search for your stack :)</label>
<div class="container">
<div class="Icon">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#657789" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
</div>
<div class="InputContainer">
<input placeholder="search here...."/>
</div>
</div>
</div>
</div>
CSS Element
#import url('https://fonts.googleapis.com/css?family=Orbitron&display=swap');
#import url('https://fonts.googleapis.com/css?family=Hind&display=swap');
* {
-webkit-font-smoothing: antialiased;
color: #acbdce;
}
:root {
--border-radius: 10px;
}
body, html {
background: #e2e9f4;
display: grid;
height: 100%;
grid-template: 1fr/100%;
place-items: center;
}
.Card {
padding: 1px;
border-radius: var(--border-radius);
background: linear-gradient(-67deg, rgba(#c8d8e7, .7), rgba(255,255,255,.8));
overflow: hidden;
box-shadow:
-2px -2px 6px rgba(#fff, .6),
2px 2px 12px #c8d8e7;
width: 380px;
}
.CardInner {
padding: 16px 16px;
background-color: #e2e9f4;
border-radius: var(--border-radius);
}
.container {
display: flex;
}
.Icon {
min-width: 46px;
min-height: 46px;
display: flex;
align-items: center;
justify-content: center;
border-radius: var(--border-radius);
margin-right: 12px;
box-shadow:
-2px -2px 6px rgba(#fff, .6),
2px 2px 12px #c8d8e7;
svg {
transform: translate(-1px, -1px);
}
}
label {
font-family: "Hind", sans-serif;
display: block;
color: #3c4b66;
margin-bottom: 12px;
background: linear-gradient(45deg, rgba(#6b7b8f, 1), #3c4b66);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.InputContainer {
width: 100%;
}
input {
background-color: #e3edf7;
padding: 16px 32px;
border: none;
display: block;
font-family: 'Orbitron', sans-serif;
font-weight: 600;
color: #a9b8c9;
-webkit-appearance: none;
transition: all 240ms ease-out;
width: 100%;
&::placeholder {
color: #6d7f8f;
}
&:focus {
outline: none;
color: #6d7f8f;
background-color: lighten(#e3edf7, 3%);
}
};
.InputContainer {
--top-shadow: inset 1px 1px 3px #c5d4e3, inset 2px 2px 6px #c5d4e3;
--bottom-shadow: inset -2px -2px 4px rgba(255,255,255, .7);
position: relative;
border-radius: var(--border-radius);
overflow: hidden;
&:before,
&:after {
left: 0;
top: 0;
display: block;
content: "";
pointer-events: none;
width: 100%;
height: 100%;
position: absolute;
}
&:before {
box-shadow: var(--bottom-shadow);
}
&:after {
box-shadow: var(--top-shadow);
}
}

zoom works only in chrome , scale ruins the graphic

I have this structure and it works perfectly only in chrome!!:
.audio-controls {
display: none;
flex-direction: row;
gap: 1226px;
justify-content: center;
width: 100%;
position: absolute;
top: 82%;
left: 0%;
z-index: 99;
}
.prompt {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
cursor: not-allowed;
background: #000000;
border-radius: 35px;
}
.prompt .stim {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 124px;
width: 126px;
border-radius: 30%;
background: linear-gradient(#1f1f20, #040404);
transform: translateY(-6px);
overflow: hidden;
box-shadow: 0px 9px 3px #000000, 0 10px 20px rgb(0 0 0 / 25%);
}
.prompt .stim::before {
content: "";
opacity: 0.35;
top: 0;
left: 0;
bottom: 0;
right: 0;
position: absolute;
background-image: url(../img/hexellence.png);
}
.audio-controls .record {
transform: translate(0px, 40px);
zoom: 0.042;
}
.prompt .stim p {
transition: color 0.05s ease;
}
.stim p {
color: #b9b7b7;
font-family: "Open Sans Regular";
font-size: .7em;
margin-bottom: 4px;
transition: color 0.1s ease-in-out;
z-index: 1;
}
<div class="audio-controls" style="display: flex;">
<div id="start-recognition" class="prompt activated">
<div class="record-dot record-dot-position on" style="transform: translateY(-6px);"></div>
<div class="record-dot-container record-dot-position" style="transform: translateY(-6px);"></div>
<div class="stim">
<svg class="record" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" enable-background="new 0 0 1000 1000" xml:space="preserve" style="fill: rgb(123, 55, 32);" width="1000" height="1000">
<rect id="backgroundrect" width="100%" height="100%" x="0" y="0" fill="none" stroke="none"></rect>
<g class="currentLayer" style="">
<g id="svg_1" class="selected" fill="#dadada" fill-opacity="1">
<path d="M500,683.8c84.6,0,153.1-68.6,153.1-153.1V163.1C653.1,78.6,584.6,10,500,10c-84.6,0-153.1,68.6-153.1,153.1v367.5C346.9,615.2,415.4,683.8,500,683.8z M714.4,438.8v91.9C714.4,649,618.4,745,500,745c-118.4,0-214.4-96-214.4-214.4v-91.9h-61.3v91.9c0,141.9,107.2,258.7,245,273.9v124.2H346.9V990h306.3v-61.3H530.6V804.5c137.8-15.2,245-132.1,245-273.9v-91.9H714.4z" id="record-icon" fill="#dadada57" style="fill: rgba(218, 218, 218, 0.34);"></path>
</g>
</g>
</svg>
<p id="record-icon-text" style="color: rgb(185, 183, 183);">Hold Space Key</p>
</div>
</div>
</div>
The issue is in the above code I used zoom here:
.audio-controls .record {
transform: translate(0px, 40px);
zoom: 0.042;
}
And zoom is not working in Firefox so it only works in chrome.
In order to make this work I need to use scale instead right? I used scale in the below snippet but I ruined the graphic !
Have a look: ( I only removed zoom and replaces scale here)
.audio-controls {
display: none;
flex-direction: row;
gap: 1226px;
justify-content: center;
width: 100%;
position: absolute;
top: 82%;
left: 0%;
z-index: 99;
}
.prompt {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
cursor: not-allowed;
background: #000000;
border-radius: 35px;
}
.prompt .stim {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 124px;
width: 126px;
border-radius: 30%;
background: linear-gradient(#1f1f20, #040404);
transform: translateY(-6px);
overflow: hidden;
box-shadow: 0px 9px 3px #000000, 0 10px 20px rgb(0 0 0 / 25%);
}
.prompt .stim::before {
content: "";
opacity: 0.35;
top: 0;
left: 0;
bottom: 0;
right: 0;
position: absolute;
background-image: url(../img/hexellence.png);
}
.audio-controls .record {
transform: scale(0.042) translate(0px, 40px);
/*zoom: 0.042;*/
}
.prompt .stim p {
transition: color 0.05s ease;
}
.stim p {
color: #b9b7b7;
font-family: "Open Sans Regular";
font-size: .7em;
margin-bottom: 4px;
transition: color 0.1s ease-in-out;
z-index: 1;
}
<div class="audio-controls" style="display: flex;">
<div id="start-recognition" class="prompt activated">
<div class="record-dot record-dot-position on" style="transform: translateY(-6px);"></div>
<div class="record-dot-container record-dot-position" style="transform: translateY(-6px);"></div>
<div class="stim">
<svg class="record" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" enable-background="new 0 0 1000 1000" xml:space="preserve" style="fill: rgb(123, 55, 32);" width="1000" height="1000">
<rect id="backgroundrect" width="100%" height="100%" x="0" y="0" fill="none" stroke="none"></rect>
<g class="currentLayer" style="">
<g id="svg_1" class="selected" fill="#dadada" fill-opacity="1">
<path d="M500,683.8c84.6,0,153.1-68.6,153.1-153.1V163.1C653.1,78.6,584.6,10,500,10c-84.6,0-153.1,68.6-153.1,153.1v367.5C346.9,615.2,415.4,683.8,500,683.8z M714.4,438.8v91.9C714.4,649,618.4,745,500,745c-118.4,0-214.4-96-214.4-214.4v-91.9h-61.3v91.9c0,141.9,107.2,258.7,245,273.9v124.2H346.9V990h306.3v-61.3H530.6V804.5c137.8-15.2,245-132.1,245-273.9v-91.9H714.4z" id="record-icon" fill="#dadada57" style="fill: rgba(218, 218, 218, 0.34);"></path>
</g>
</g>
</svg>
<p id="record-icon-text" style="color: rgb(185, 183, 183);">Hold Space Key</p>
</div>
</div>
</div>
How can I fix using scale ?

Shift cards over to next row when browser size is 915px width

How do I shift the content over to the next row when browser width is 915px?
This is what I have now:
<div class="body">
<div class="container">
<div class="card">
<div class="box">
<div class="percent">
<svg>
<circle cx="70" cy="70" r="70"></circle>
<circle cx="70" cy="70" r="70"></circle>
</svg>
<div class="number">
<h2>90<span>%</span></h2>
</div>
</div>
<h2 class="text">Html</h2>
</div>
</div>
<div class="card">
<div class="box">
<div class="percent">
<svg>
<circle cx="70" cy="70" r="70"></circle>
<circle cx="70" cy="70" r="70"></circle>
</svg>
<div class="number">
<h2>85<span>%</span></h2>
</div>
</div>
<h2 class="text">CSS</h2>
</div>
</div>
<div class="card">
<div class="box">
<div class="percent">
<svg>
<circle cx="70" cy="70" r="70"></circle>
<circle cx="70" cy="70" r="70"></circle>
</svg>
<div class="number">
<h2>60<span>%</span></h2>
</div>
</div>
<h2 class="text">Javascript</h2>
</div>
</div>
</div>
</div>
And my css
.body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
display: flex;
justify-content: space-around;
}
.container .card {
margin-left: 20px;
position: relative;
width: 250px;
background: #222;
background: linear-gradient(0deg, #1b1b1b, #222, #1b1b1b);
display: flex;
justify-content: center;
align-items: center;
height: 300px;
border-radius: 4px;
text-align: center;
overflow: hidden;
transition: 0.5s;
}
.container .card:hover {
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
transform: translateY(-10px);
}
.container .card:before {
content: "";
position: absolute;
top: 0;
left: -50%;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.03);
pointer-events: none;
z-index: 1;
}
.percent {
position: relative;
width: 150px;
height: 150px;
border-radius: 50%;
box-shadow: inset 0 0 50px #000;
background: #222;
z-index: 100;
}
.percent .number {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
}
.percent .number h2 {
color: #777;
font-weight: 700;
font-size: 40px;
transition: 0.5s;
}
.card:hover .percent .number h2 {
color: #fff;
font-size: 60px;
}
.percent .number h2 span {
font-size: 24px;
color: #777;
}
.text {
color: #777;
margin-top: 20px;
font-weight: 700;
font-size: 18px;
letter-spacing: 1px;
text-transform: uppercase;
transition: 0.5s;
}
.card:hover .text {
color: #fff;
}
svg {
position: relative;
width: 150px;
height: 150px;
z-index: 1000;
}
circle {
width: 100%;
height: 100%;
fill: none;
stroke: #191919;
stroke-width: 10;
stroke-linecap: round;
transform: translate(5px, 5px);
}
circle:nth-child(2) {
stroke-dasharray: 440;
stroke-dashoffset: 440;
}
.card:nth-child(1) svg circle:nth-child(2) {
stroke-dashoffset: calc(440 - (440 * 90) / 100);
stroke: #00ff43;
}
.card:nth-child(2) svg circle:nth-child(2) {
stroke-dashoffset: calc(440 - (440 * 85) / 100);
stroke: #00a1ff;
}
.card:nth-child(3) svg circle:nth-child(2) {
stroke-dashoffset: calc(440 - (440 * 60) / 100);
stroke: #c104ff;
}
#media only screen and (max-width: 915px) {
/* your css of 1024 px screen size */
.card {
flex: 10% !important;
}
}
How do I make the content shift downwards when on 915px browser width so it looks good on mobile. I've tried flex, change display, change width but nothing works. I don't know if it has to do with any of that but I'd appreciate the help.
You can use the grid layout. First, set the container to display: grid;. After you can set how your grid will be with the grid-template-columns: 1fr; (1fr = one column, 1fr 1fr = 2 column, 1fr 2fr = 2 column, but the right one is bigger... etc). After that, you can add gap: 1rem; to have a gap between you column and row.
The Grid Documentation on W3School
Here is a example:
.body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
display: flex;
justify-content: space-around;
}
.container .card {
margin-left: 20px;
position: relative;
width: 250px;
background: #222;
background: linear-gradient(0deg, #1b1b1b, #222, #1b1b1b);
display: flex;
justify-content: center;
align-items: center;
height: 300px;
border-radius: 4px;
text-align: center;
overflow: hidden;
transition: 0.5s;
}
.container .card:hover {
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
transform: translateY(-10px);
}
.container .card:before {
content: "";
position: absolute;
top: 0;
left: -50%;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.03);
pointer-events: none;
z-index: 1;
}
.percent {
position: relative;
width: 150px;
height: 150px;
border-radius: 50%;
box-shadow: inset 0 0 50px #000;
background: #222;
z-index: 100;
}
.percent .number {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
}
.percent .number h2 {
color: #777;
font-weight: 700;
font-size: 40px;
transition: 0.5s;
}
.card:hover .percent .number h2 {
color: #fff;
font-size: 60px;
}
.percent .number h2 span {
font-size: 24px;
color: #777;
}
.text {
color: #777;
margin-top: 20px;
font-weight: 700;
font-size: 18px;
letter-spacing: 1px;
text-transform: uppercase;
transition: 0.5s;
}
.card:hover .text {
color: #fff;
}
svg {
position: relative;
width: 150px;
height: 150px;
z-index: 1000;
}
circle {
width: 100%;
height: 100%;
fill: none;
stroke: #191919;
stroke-width: 10;
stroke-linecap: round;
transform: translate(5px, 5px);
}
circle:nth-child(2) {
stroke-dasharray: 440;
stroke-dashoffset: 440;
}
.card:nth-child(1) svg circle:nth-child(2) {
stroke-dashoffset: calc(440 - (440 * 90) / 100);
stroke: #00ff43;
}
.card:nth-child(2) svg circle:nth-child(2) {
stroke-dashoffset: calc(440 - (440 * 85) / 100);
stroke: #00a1ff;
}
.card:nth-child(3) svg circle:nth-child(2) {
stroke-dashoffset: calc(440 - (440 * 60) / 100);
stroke: #c104ff;
}
#media only screen and (max-width: 915px) {
/* your css of 1024 px screen size */
.card {
flex: 10% !important;
}
.grid-class{
display: grid;
grid-template-columns: 1fr;
gap: 1rem;
}
}
<div class="body">
<div class="container grid-class">
<div class="card">
<div class="box">
<div class="percent">
<svg>
<circle cx="70" cy="70" r="70"></circle>
<circle cx="70" cy="70" r="70"></circle>
</svg>
<div class="number">
<h2>90<span>%</span></h2>
</div>
</div>
<h2 class="text">Html</h2>
</div>
</div>
<div class="card">
<div class="box">
<div class="percent">
<svg>
<circle cx="70" cy="70" r="70"></circle>
<circle cx="70" cy="70" r="70"></circle>
</svg>
<div class="number">
<h2>85<span>%</span></h2>
</div>
</div>
<h2 class="text">CSS</h2>
</div>
</div>
<div class="card">
<div class="box">
<div class="percent">
<svg>
<circle cx="70" cy="70" r="70"></circle>
<circle cx="70" cy="70" r="70"></circle>
</svg>
<div class="number">
<h2>60<span>%</span></h2>
</div>
</div>
<h2 class="text">Javascript</h2>
</div>
</div>
</div>
</div>

CSS provide spacing between different components

I am new to CSS. I am trying to create a website which provides the status of each service.
something like this
https://status.hipchat.com/
I don't have much experience with CSS, so I have tried to understand what I could using the chrome inspector and have created the following CSS. however, spacing doesn't quite look right.
Could someone let me know how could I fix?
is there any way I can optimize this?
body {
font-family: "proxima-nova", "Helvetica Neue", Helvetica, Arial, Sans-Serif;
font-weight: 400;
background-color: #ffffff;
font-size: 16px;
line-height: 24px;
color: #333;
background: #fff;
-webkit-font-smoothing: subpixel-antialiased;
}
.legend {
display: flex;
display: -ms-flexbox;
flex-direction: row;
justify-content: space-between;
position: relative;
top: -2px;
}
.legend-item {
flex: 0 0 auto;
font-size: .875rem;
position: relative;
color: #aaa;
opacity: 0.8;
}
.border-color {
border-color: #e9e9e9;
}
.component-container {
border-radius: 4px 4px 4px 4px !important;
-moz-border-radius: 4px 4px 4px 4px !important;
-webkit-border-radius: 4px 4px 4px 4px !important;
-o-border-radius: 4px 4px 4px 4px !important;
-ms-border-radius: 4px 4px 4px 4px !important;
width: 100%;
float: none;
border-width: 1px;
padding: 1.1rem 1.25rem 1rem;
border-style: solid;
margin: 10px
}
.name {
vertical-align: middle;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
display: inline-block;
font-weight: 500;
max-width: 75%;
}
.component-status {
display: inline-block;
font-size: 0.875rem;
float: right;
}
.color-success {
color: #36b37e;
}
.color-warning {
color: #BCBE2A
}
.shared-partial.uptime-90-days-wrapper {
padding-top: 5px;
margin-bottom: -2px;
}
.spacer {
flex: 1;
margin: 0.75rem 1rem 0 1rem;
height: 1px;
background: #aaa;
opacity: 0.3;
}
<div class="component-container border-color">
<div class="shared-partial uptime-90-days-wrapper"><span class="name"> testing </span><br><span class="component-status color-success">Operational</span><svg
height="34">
<rect height="34" width="3" x="5" y="0" fill="#bcbe2a"></rect>
<rect height="34" width="3" x="10" y="0" fill="#36b37e"></rect>
<rect height="34" width="3" x="15" y="0" fill="#36b37e"></rect>
</svg>
<div class="legend">
<div class="legend-item">90 days ago</div>
<div class="spacer"></div>
<div class="legend-item">96.67% uptime </div>
<div class="spacer"></div>
<div class="legend-item">today</div>
</div>
</div>
</div>

HTML - Center List and icon to bottom

I'm starting to using css grid and flex box but I have a problem trying to align this list to the center.
Here is the codepen and snippet:
* {
box-sizing: border-box;
}
.container-shell {
background: gray;
display: -ms-grid;
display: grid;
grid-template-areas: "nav content content";
-ms-grid-columns: 60px 1fr;
grid-template-columns: 60px 1fr;
-ms-grid-rows: auto;
grid-template-rows: auto;
height: 100vh;
}
nav {
-ms-grid-row: 1;
-ms-grid-column: 1;
grid-area: nav;
background-color: #fff;
}
main {
-ms-grid-row: 1;
-ms-grid-column: 2;
-ms-grid-column-span: 2;
grid-area: content;
}
.navigation-container {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.navigation-flex-item {
flex: 1 0 50%;
text-align: center;
padding: 10px;
min-width: 0;
}
ul {
list-style: none;
margin: 0;
}
.--no-padding {
padding: 0 !important;
}
.--bottom {
align-self: flex-end;
}
.navbar-toggle {
margin: 14px 5px 14px 0 !important;
border: 0 !important;
transition: all .1s linear !important;
cursor: pointer;
}
.navbar-toggle {
position: relative;
float: right;
margin-right: 15px;
padding: 9px 10px;
margin-top: 33px;
margin-bottom: 33px;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
.sr-only {
border: 0;
clip: rect(0, 0, 0, 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rec(0, 0, 0, 0);
border: 0;
}
.icon-bar {
display: block;
width: 22px;
height: 2px;
border-radius: 1px;
background-color: #888;
}
.icon-bar {
width: 30px;
height: 3px;
background-color: #000;
border-radius: 0;
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
transition: all .1s linear;
-webkit-transform: rotate(0);
transform: rotate(0);
}
.icon-bar:nth-child(2) {
width: 19px;
margin-left: 11px;
}
.icon-bar + .icon-bar {
margin-top: 4px;
}
.icon-bar:last-of-type {
width: 19px;
margin-right: 11px;
}
<div class="container-shell">
<nav>
<div style="height: 100%">
<div class="navigation-container">
<ul class="navigation-flex-item">
<li>1</li>
<li>2</li>
<li><svg _ngcontent-c2="" xml:space="preserve" xmlns:xlink="http://www.w3.org/1999/xlink" id="Capa_1" style="enable-background:new 0 0 60 60;" version="1.1" viewBox="0 0 60 60" x="0px" xmlns="http://www.w3.org/2000/svg" y="0px">
<g _ngcontent-c2="">
<path _ngcontent-c2="" d="M57,4h-7V1c0-0.553-0.447-1-1-1h-7c-0.553,0-1,0.447-1,1v3H19V1c0-0.553-0.447-1-1-1h-7c-0.553,0-1,0.447-1,1v3H3
C2.447,4,2,4.447,2,5v11v43c0,0.553,0.447,1,1,1h54c0.553,0,1-0.447,1-1V16V5C58,4.447,57.553,4,57,4z M43,2h5v3v3h-5V5V2z M12,2h5
v3v3h-5V5V2z M4,6h6v3c0,0.553,0.447,1,1,1h7c0.553,0,1-0.447,1-1V6h22v3c0,0.553,0.447,1,1,1h7c0.553,0,1-0.447,1-1V6h6v9H4V6z
M4,58V17h52v41H4z"></path>
<path _ngcontent-c2="" d="M38,23h-7h-2h-7h-2h-9v9v2v7v2v9h9h2h7h2h7h2h9v-9v-2v-7v-2v-9h-9H38z M31,25h7v7h-7V25z M38,41h-7v-7h7V41z M22,34h7v7h-7
V34z M22,25h7v7h-7V25z M13,25h7v7h-7V25z M13,34h7v7h-7V34z M20,50h-7v-7h7V50z M29,50h-7v-7h7V50z M38,50h-7v-7h7V50z M47,50h-7
v-7h7V50z M47,41h-7v-7h7V41z M47,25v7h-7v-7H47z"></path>
</g><g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
</svg>
</li>
</ul>
<div class="navigation-flex-item --bottom --no-padding">
<button class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
</div>
</div>
</nav>
<main>
Hello World Content!
</main>
</div>
As you can see the hamburger icon aligned to the center which is fine but the text (list) is aligned to the left, how can I center the text and the image without break the hamburger icon. I already tried with align and justify.
Have made the below changes to your code:
The default flex-direction is row - you have to change it to column for the navigation-container.
Remove flex: 1 0 50% from the element navigation-flex-item.
Absolutely position the hamburger to the bottom.
See code below:
* {
box-sizing: border-box;
}
body {
background: blue; /* for illustration */
}
.container-shell {
background: gray;
display: -ms-grid;
display: grid;
grid-template-areas: "nav content content";
-ms-grid-columns: 60px 1fr;
grid-template-columns: 60px 1fr;
-ms-grid-rows: auto;
grid-template-rows: auto;
height: 100vh;
}
nav {
-ms-grid-row: 1;
-ms-grid-column: 1;
grid-area: nav;
background-color: #fff;
}
main {
-ms-grid-row: 1;
-ms-grid-column: 2;
-ms-grid-column-span: 2;
grid-area: content;
}
.navigation-container {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column; /* ADDED */
height: 100%;
}
.navigation-flex-item {
/*flex: 1 0 50%;*/
text-align: center;
padding: 10px;
min-width: 0;
}
ul {
list-style: none;
margin: 0;
}
.--no-padding {
padding: 0 !important;
}
.--bottom {
/*align-self: flex-end;*/
position: absolute; /* ADDED */
bottom: 0; /* ADDED */
}
.navbar-toggle {
margin: 14px 5px 14px 0 !important;
border: 0 !important;
transition: all .1s linear !important;
cursor: pointer;
}
.navbar-toggle {
position: relative;
float: right;
margin-right: 15px;
padding: 9px 10px;
margin-top: 33px;
margin-bottom: 33px;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
.sr-only {
border: 0;
clip: rect(0, 0, 0, 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rec(0, 0, 0, 0);
border: 0;
}
.icon-bar {
display: block;
width: 22px;
height: 2px;
border-radius: 1px;
background-color: #888;
}
.icon-bar {
width: 30px;
height: 3px;
background-color: #000;
border-radius: 0;
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
transition: all .1s linear;
-webkit-transform: rotate(0);
transform: rotate(0);
}
.icon-bar:nth-child(2) {
width: 19px;
margin-left: 11px;
}
.icon-bar+.icon-bar {
margin-top: 4px;
}
.icon-bar:last-of-type {
width: 19px;
margin-right: 11px;
}
<div class="container-shell">
<nav>
<div style="height: 100%">
<div class="navigation-container">
<ul class="navigation-flex-item">
<li>1</li>
<li>2</li>
<li><svg _ngcontent-c2="" xml:space="preserve" xmlns:xlink="http://www.w3.org/1999/xlink" id="Capa_1" style="enable-background:new 0 0 60 60;" version="1.1" viewBox="0 0 60 60" x="0px" xmlns="http://www.w3.org/2000/svg" y="0px">
<g _ngcontent-c2="">
<path _ngcontent-c2="" d="M57,4h-7V1c0-0.553-0.447-1-1-1h-7c-0.553,0-1,0.447-1,1v3H19V1c0-0.553-0.447-1-1-1h-7c-0.553,0-1,0.447-1,1v3H3
C2.447,4,2,4.447,2,5v11v43c0,0.553,0.447,1,1,1h54c0.553,0,1-0.447,1-1V16V5C58,4.447,57.553,4,57,4z M43,2h5v3v3h-5V5V2z M12,2h5
v3v3h-5V5V2z M4,6h6v3c0,0.553,0.447,1,1,1h7c0.553,0,1-0.447,1-1V6h22v3c0,0.553,0.447,1,1,1h7c0.553,0,1-0.447,1-1V6h6v9H4V6z
M4,58V17h52v41H4z"></path>
<path _ngcontent-c2="" d="M38,23h-7h-2h-7h-2h-9v9v2v7v2v9h9h2h7h2h7h2h9v-9v-2v-7v-2v-9h-9H38z M31,25h7v7h-7V25z M38,41h-7v-7h7V41z M22,34h7v7h-7
V34z M22,25h7v7h-7V25z M13,25h7v7h-7V25z M13,34h7v7h-7V34z M20,50h-7v-7h7V50z M29,50h-7v-7h7V50z M38,50h-7v-7h7V50z M47,50h-7
v-7h7V50z M47,41h-7v-7h7V41z M47,25v7h-7v-7H47z"></path>
</g><g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
<g _ngcontent-c2="">
</g>
</svg>
</li>
</ul>
<div class="navigation-flex-item --bottom --no-padding">
<button class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
</div>
</div>
</nav>
<main>
Hello World Content!
</main>
</div>