I cant get CSS grids to line up - html

I got my header to work fine, however I cant get my pictures to follow my columns. Basically in the code below I want .left and .mid to line up horizontally ( and there is going to be a 3rd picture as well) Right now they are lining up vertically. I think I might be doing something wrong with the column set up but I am not sure
#import url('https://fonts.googleapis.com/css?family=Sofia');
body {
margin: 0;
}
nav {
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-auto-rows: auto;
grid-gap: 1em;
align-items: center;
text-align: center;
/*border-bottom: 4px solid black;*/
background:#0066cc;
}
#media screen and (max-width: 900px) {
nav {
grid-template-columns: 100%;
grid-template-rows: auto;
grid-gap: 1em;
}
}
.1 {
grid-column: 1;
}
.2 {
grid-column: 2;
}
.logo {
grid-column: 3;
background-image: url("images/cocinaheader.png");
background-position: center;
background-size: contain;
background-repeat: no-repeat;
height: 6vh;
}
.3 {
grid-column: 4;
}
.4 {
grid-column: 5;
}
.navLinks {
font-family: 'Sofia';
font-size: 1.2em;
text-transform: uppercase;
text-decoration: none;
color: black;
}
.navLinks:hover {
color: white;
border-left: 1px solid white;
border-right: 1px solid white;
padding: 1em 1em;
}
#twist {
color: blue;
}
banner {
padding: 1em 1em;
display: grid;
grid-template-rows: 100%;
}
.bannerlogo{
grid-row: 1;
/*background-image: url(images/banner.jpg);*/
background-position: center;
background-size: contain;
background-repeat: no-repeat;
width: 100%;
height: 100%;
}
.h1{
font-family: 'Sofia';
font-size: 1em;
text-transform: uppercase;
color: black;
}
block {
display: grid;
grid-template-columns:20% 20% 20% 20% 20%;
/*grid-auto-rows: auto;*/
grid-gap: 1em;
align-items: center;
}
.left {
grid-column: 2;
background-image: url("images/foodleft.png");
background-position: center;
background-size: contain;
background-repeat: no-repeat;
height: 20vh;
}
.mid {
grid-column: 3;
background-image: url("images/foodmid.jpg");
background-position: center;
background-size: contain;
background-repeat: no-repeat;
height: 20vh;
}
<header>
<nav class="container">
<div class="1">
Home
</div>
<div class="2">
Menu
</div>
<div class="logo">
</div>
<div class="3">
About Us
</div>
<div class="4">
Contact Me
</div>
</nav>
</header>
<br><br><br><br>
<main>
<div class="banner">
<div class="bannerlogo">
<center>
<img src="images/banner.jpg">
</center>
</div>
<br><br><br><br><br><br>
<div class="h1">
<center><h1>A taste of our menu</h1></center>
</div>
<!-- Start block grid -->
<div class="block">
<div class="left"></div>
<div class="mid"></div>
</div>

You cannot use just numbers as class names in css. Try using .item1 .item2 etc...

Related

CSS curved arrow

trying to achieve something similar to the below with CSS. The icon itself
I currently have it looking like this:
Code looks as follows:
.homepage-wrapper {
border: 1px solid #d07028;
width: 100%;
border-radius: 4px;
}
.homepage-body {
display: table-cell;
padding-left: 20px;
height: 80px;
}
.homepage-dispatch {
padding: 20px;
width: 100px;
display: table-cell;
background-color: #862632;
background-image: url('../Images/homepage/shipping.png');
background-repeat: no-repeat;
background-position: center;
}
<div class="homepage-wrapper">
<div class="homepage-dispatch">
</div>
<div class="homepage-body">
Same Day Dispatch before 12pm
</div>
</div>
I haven't bothered to include any attempted CSS on the arrow portion because it doesn't look right at all.
Any tips would be appreciated!
For a pure CSS solution, you can overlay 2 rounded pseudo elements to form the arrow.
It involves some math to position them properly.
.homepage-wrapper {
--arrow-radius: 10px;
--arrow-size: 100px;
--arrow-color: #862632;
width: 300px;
display: grid;
grid-template-columns: auto auto;
grid-template-rows: 10px auto 10px;
}
.homepage-dispatch {
grid-column: 1/1;
grid-row: 1/-1;
width: var(--arrow-size);
height: var(--arrow-size);
background-color: var(--arrow-color);
border-top-right-radius: var(--arrow-radius);
border-bottom-right-radius: var(--arrow-radius);
display: grid;
grid-template-columns: auto;
grid-template-rows: auto;
justify-items: end;
background-image: url(https://i.stack.imgur.com/2JBwD.png);
background-repeat: no-repeat;
background-position: center;
}
.homepage-dispatch::before,
.homepage-dispatch::after {
content: "";
display: block;
width: calc((var(--arrow-size) - var(--arrow-radius)*2) * 0.57735 + 2 * var(--arrow-radius));
height: calc((var(--arrow-size) - var(--arrow-radius)*2) * 0.57735 + 2 * var(--arrow-radius));
grid-column: 1 / 1;
grid-row: 1 / 1;
background-color: var(--arrow-color);
border-radius: var(--arrow-radius);
position: relative;
z-index: -1;
}
.homepage-dispatch::before {
align-self: start;
transform-origin: calc(100% - var(--arrow-radius)) var(--arrow-radius);
transform: rotate(-30deg);
}
.homepage-dispatch::after {
align-self: end;
transform-origin: calc(100% - var(--arrow-radius)) calc(100% - var(--arrow-radius));
transform: rotate(30deg);
}
.homepage-body {
grid-column: 1/-1;
grid-row: 2;
border: 1px solid var(--arrow-color);
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
height: 100%;
padding-left: calc(var(--arrow-size) * 1.3 - 0.5 * var(--arrow-radius) + 20px);
padding-right: 20px;
display: flex;
flex-direction: column;
justify-content: center;
font-family: sans-serif;
text-align: center;
}
<div class="homepage-wrapper">
<div class="homepage-dispatch">
</div>
<div class="homepage-body">
Same Day Dispatch before 12pm
</div>
</div>
<hr>
<div class="homepage-wrapper" style="--arrow-color: blue;--arrow-size: 120px;--arrow-radius: 20px;">
<div class="homepage-dispatch">
</div>
<div class="homepage-body">
Same Day Dispatch before 12pm
</div>
</div>

Making background image and items in grid responsive

Im new to HTML/CSS & grid
I want to make the background image and the items in the grid responsive.
Could you'll please let me know what im doing wrong or help me out
.angry-grid {
max-width: 1200px;
}
.charCoal-items{
display: grid;
grid-template-rows: repeat(5, 1fr);
grid-gap: 10px;
width: 100%;
height: 100%;
background: url("https://cdn.shopify.com/s/files/1/0130/1797/2795/files/shilajit-is-ayurvedic-medicine-found-primarily-rocks-himalayas-selective-focus_466689-90021_1.png?v=1669684516");
background-repeat: no-repeat;
background-size: contain;
background-position: center center;
}
.charCoal-items p{
width: 100%;
height: auto;
}
#item-1 {
background-color: rgba(187, 170, 126, 0.7);
border-radius: 50px;
margin: auto;
padding: 0 15px;
grid-row-start: 4;
grid-column-start: 1;
grid-column-end: 2 ;
}
#item-2 {
background-color: rgba(187, 170, 126, 0.7);
border-radius: 50px;
margin: auto;
padding: 0 15px;
width: 80%;
grid-row-start: 1;
grid-column-start: 2;
grid-column-end:4 ;
}
#item-1 p,
#item-2 p{
font-family: 'Nunito Sans';
font-style: normal;
text-align: center;
color: #000000;
}
#item-2 p:first-child,
#item-1 p:first-child{
padding-top: 15px;
font-weight: 900;
font-size: 25px;
line-height: 24px;
}
#item-2 p:last-child,
#item-1 p:last-child{
font-weight: 400;
font-size: 25px;
line-height: 34px;
}
/* #media all and (max-width: 1199px){
.charCoal-items {
grid-template-rows: repeat(4, 1fr);
}
} */
#media all and (max-width: 799px) {
.charCoal-items {
}
}
.charCoal-items p{
width: 100%;
height: auto;
}
}
#media all and (max-width: 599px){
.charCoal-items p{
width: 100%;
height: auto;
}
}
<div class="angry-grid">
<div class="charCoal-items">
<!-- <div id="item-0">
</div> -->
<div id="item-1"><p>Ayurvedic Rasa (Taste) & Flavor Profile: </p>
<p>Astringent, Savory, Bitter, Mildly Smokey, and Earthy flavor.</p>
</div>
<div id="item-2"><p>Dosha Compatibility: </p>
<p>With inherent heating properties, it helps reinvigorate a sluggish Kapha dosha and ground the erratic nature of the Vata dosha, though it can aggravate the Pitta dosha.</p></div>
</div>
</div>
Below is what im trying to achieve
Here is the codepen: https://codepen.io/pen/tour/welcome/start
If any website explanation link will also be helpful
.angry-grid {
max-width: 1200px;
}
.charCoal-items{
display: grid;
grid-template-rows: repeat(5, 1fr);
grid-gap: 10px;
width: 100%;
<!-- begin snippet: js hide: false console: true babel: false -->
<div class="angry-grid">
<div class="charCoal-items">
<!-- <div id="item-0">
</div> -->
<div id="item-1"><p>Ayurvedic Rasa (Taste) & Flavor Profile: </p>
<p>Astringent, Savory, Bitter, Mildly Smokey, and Earthy flavor.</p>
</div>
<div id="item-2"><p>Dosha Compatibility: </p>
<p>With inherent heating properties, it helps reinvigorate a sluggish Kapha dosha and ground the erratic nature of the Vata dosha, though it can aggravate the Pitta dosha.</p></div>
</div>
</div>
Thank you for your help
You can just add background-size: auto; or background-size: cover;
.angry-grid {
max-width: 1200px;
}
.charCoal-items{
display: grid;
grid-template-rows: repeat(5, 1fr);
grid-gap: 10px;
width: 100%;
height: 100%;
background: url("https://cdn.shopify.com/s/files/1/0130/1797/2795/files/shilajit-is-ayurvedic-medicine-found-primarily-rocks-himalayas-selective-focus_466689-90021_1.png?v=1669684516");
background-repeat: no-repeat;
background-size: contain;
background-position: center center;
background-size: auto;
}
.charCoal-items p{
width: 100%;
height: auto;
}
#item-1 {
background-color: rgba(187, 170, 126, 0.7);
border-radius: 50px;
margin: auto;
padding: 0 15px;
grid-row-start: 4;
grid-column-start: 1;
grid-column-end: 2 ;
}
#item-2 {
background-color: rgba(187, 170, 126, 0.7);
border-radius: 50px;
margin: auto;
padding: 0 15px;
width: 80%;
grid-row-start: 1;
grid-column-start: 2;
grid-column-end:4 ;
}
#item-1 p,
#item-2 p{
font-family: 'Nunito Sans';
font-style: normal;
text-align: center;
color: #000000;
}
#item-2 p:first-child,
#item-1 p:first-child{
padding-top: 15px;
font-weight: 900;
font-size: 25px;
line-height: 24px;
}
#item-2 p:last-child,
#item-1 p:last-child{
font-weight: 400;
font-size: 25px;
line-height: 34px;
}
/* #media all and (max-width: 1199px){
.charCoal-items {
grid-template-rows: repeat(4, 1fr);
}
} */
#media all and (max-width: 799px) {
.charCoal-items {
}
}
.charCoal-items p{
width: 100%;
height: auto;
}
}
#media all and (max-width: 599px){
.charCoal-items p{
width: 100%;
height: auto;
}
}
<div class="angry-grid">
<div class="charCoal-items">
<!-- <div id="item-0">
</div> -->
<div id="item-1"><p>Ayurvedic Rasa (Taste) & Flavor Profile: </p>
<p>Astringent, Savory, Bitter, Mildly Smokey, and Earthy flavor.</p>
</div>
<div id="item-2"><p>Dosha Compatibility: </p>
<p>With inherent heating properties, it helps reinvigorate a sluggish Kapha dosha and ground the erratic nature of the Vata dosha, though it can aggravate the Pitta dosha.</p></div>
</div>
</div>

Flexbox: how to put another object here [duplicate]

This question already has answers here:
Make a div span two rows in a grid
(2 answers)
Closed 2 years ago.
I'm using display: flex; to create tiles view.
I'm trying to put the third picture under the second picture.
But, whenever I do it, the third picture went under the first picture and won't come under second picture,
#media screen and (min-width: 1000px) {
.main {
height:1800px;
width: 100%;
margin: 0px 0px 0px 0px;
position: relative;
z-index: 0;
}
.parallax {
/* The image used */
background-image: url("https://i.ibb.co/r272XPt/2019-2020.png");
/* Set a specific height */
min-height: 400px;
opacity: 60%;
filter: blur(2px);
-webkit-filter: blur(2px);
/* Create the parallax scrolling effect */
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.tiles{
position:relative;
top:100px;
width:90vw;
margin-left:5vw;
display: flex;
flex-wrap: wrap;
}
.chromebookHelpdesk img{
margin-left:5vw;
width:50vw;
display:block;
}
.subhelp{
height:25vw;
}
.subhelp img{
margin-left:5vw;
width:25vw;
display:block;
}
.studentsTour img{
margin-left:5vw;
width:20vw;
margin-top:5vw;
display:block;
}
#projects img {
text-align: center;
display: block;
width: 25vw;
margin: 20px;
}
.mission_logo {
width: 200px;
display: inline-block;
float: left;
text-align: center;
}
.mission {
text-align: center;
margin-top: 100px;
font-size: 20px;
}
.ingenuity {
color: #3cba54;
font-size: 60px !important;
}
.creativity {
color: #f4c20d;
font-size: 60px !important;
}
.innovation {
color: #db3236;
font-size: 60px !important;
}
}
#media only screen and (max-width: 1000px) {
.main {
height:2500px;
width: 100%;
margin: 0px 0px 0px 0px;
position: relative;
z-index: 0;
}
.parallax {
display: none;
}
.mission_logo {
width: 60vw;
text-align: center;
}
.mission {
text-align: center;
margin-top: 100px;
font-size: 15px;
}
.ingenuity {
color: #3cba54;
font-size: 40px !important;
}
.creativity {
color: #f4c20d;
font-size: 40px !important;
}
.innovation {
color: #db3236;
font-size: 40px !important;
}
}
.tiles h1 {
text-align: center;
font-size: 50px;
color: black;
}
.follow{
position:relative;
top:100px;
text-align:center;
border-radius: 50%;
background-color: #84e3ca;
width: 50vw;
height: 50vw;
margin-left: 25vw;
opacity:70%;
}
.follow h1{
font-size:35px;
padding-top: 20vw;
}
.follow h2{
font-size:30px;
}
<div class="main">
<div class="tiles">
<div class="chromebookHelpdesk"><a href="https://sledteam.github.io/sled/chromebook"><img
src="https://github.com/sledteam/sled/blob/master/Chromebook%20Helpdesk.png?raw=true" alt="Chromebook-Helpdesk"></a></div>
<div class="subhelp"><a href="https://sledteam.github.io/sled/chromebook"><img
src="https://github.com/sledteam/sled/blob/master/Sub%20Help.png?raw=true" alt="Sub Help"></a>
</div>
<div class="studentsTour"><a href="https://sledteam.github.io/sled/chromebook"><img
src="https://github.com/sledteam/sled/blob/master/New%20Students%20Tour.png?raw=true" alt="New Students Tour"></a></div>
</div>
I'm stuck with this for a week.
I would appreciate it if anyone knows a solution for this.
Complete guide to css flexbox
.tiles {
display: flex;
flex-wrap: wrap;
flex-direction: row;
flex: 1;
}
.section {
display: flex;
flex: 1;
flex-direction: column;
}
.item {
display: flex;
flex: 1;
padding: 1rem;
margin: 4px;
background: green;
color: white;
}
<div class="tiles">
<div class="section">
<div class="item">
<p>Chromebook Helpdesk</p>
</div>
</div>
<div class="section">
<div class="item">
<p>Sub Help</p>
</div>
<div class="item">
<p>Student Tour</p>
</div>
</div>
</div>
It is simple if you understand the concept here is the example:
As per your requirement you need 2 columns with single row so you will be creating flex property, now you need 2 columns hence you make it flex:50% like 2. Now coming to your image section where you need 2 images to be underneath so you will provide the height:50%(right images) and you will give height:100%(left image).
You can keep changing the sizes as you desire. You can also add responsive design for the same. Hope it helps.
* {
box-sizing: border-box;
}
.row {
display: flex;
}
.column {
flex: 50%;
padding: 5px;
}
<div class="row">
<div class="column">
<img src="http://i183.photobucket.com/albums/x312/Tiefnuker/office_02_zpsdz0zixcd.jpg" style="width:100%" />
</div>
<div class="column">
<div class="row">
<img src="http://i183.photobucket.com/albums/x312/Tiefnuker/office_02_zpsdz0zixcd.jpg" style="width:50%" />
</div>
<div class="row">
<img src="http://i183.photobucket.com/albums/x312/Tiefnuker/office_02_zpsdz0zixcd.jpg" style="width:50%" />
</div>
</div>
</div>

How do you make a div a clickable link with HTML5/CSS3 only?

T'is a question as old as time, and as such the answers to the question are also as old as time.
I have tried many solutions, none of which have worked in the way I have wanted.
I am trying to make div .content1 wholly clickable link without any text or JS styling what-so-ever.
Do you have any suggestions?
body {
background-image: url("Images/background-bean.jpg");
background-size: contain;
}
h1 {
background-image: url("Images/background-bean.jpg");
}
p {
background-color: white;
background-color: rgba(255, 255, 255, .85);
}
.container {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 100px 400px 400px 50px;
grid-gap: 8px;
background-image: url(Images/content/background_bean.jpg)
}
.nav {
grid-column-start: 1;
grid-column-end: 3;
color: white;
}
.content1,
.content2,
.content3,
.content4 {
background-color: #60330A;
width: 100%;
background-position: center;
text-align: center;
}
.social {
grid-column-start: 1;
grid-column-end: 2;
color: white;
}
.footer {
grid-column-start: 2;
grid-column-end: 3;
color: white;
text-align: right;
}
.content1 {
background-image: url(Images/content/c1standin.jpg)
}
.content1:hover {
transform: scale(1.05);
}
.content2 {
background-image: url(Images/content/c2standin.jpg)
}
.content2:hover {
transform: scale(1.05);
}
.content3 {
background-image: url(Images/content/c3standin.jpg)
}
.content3:hover {
transform: scale(1.05);
}
.content4 {
background-image: url(Images/content/c4standin.jpg)
}
.content4:hover {
transform: scale(1.05);
}
.a .content1:feature {
position: relative;
}
.content1:feature a {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
text-decoration: none;
/* No underlines on the link */
z-index: 10;
/* Places the link above everything else in the div */
background-color: #FFF;
/* Fix to make div clickable in IE */
opacity: 0;
/* Fix to make div clickable in IE */
filter: alpha(opacity=1);
/* Fix to make div clickable in IE */
}
<div class="container">
<div class="nav"><span class="bold">NAV</span> </div>
<div class="content1">
<a title="Our Products" class="content1" id="header-img" href="Images/content/c1standin.jpg"></a>
</div>
<div class="content2">CONTENT</div>
<div class="content3">CONTENT</div>
<div class="content4">CONTENT</div>
<div class="social">SOCIALMEDIA</div>
<div class="footer">
<h6>Image Credit pixabay.com; Elliott Evans 2019</h6>
</div>
</div>
You need to put anchor tag outside div.
<a title="Our Products" class="content1" id="header-img" href="Images/content/c1standin.jpg">
<div class="content1"></div>
</a>
As answered by Rohit Shetty, you can wrap your <div> elements in <a> elements, rather than the other way around. Also see Make Entire Div Clickable. Here's an example:
.container {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 400px 400px;
grid-gap: 8px;
}
.content {
background-color: #60330A;
width: 100%;
background-position: center;
background-size: cover;
text-align: center;
transition: transform .3s;
}
.content:hover {
transform: scale(1.05);
}
.content1 {
background-image: url('https://picsum.photos/200/300?1')
}
.content2 {
background-image: url('https://picsum.photos/200/300?2')
}
.content3 {
background-image: url('https://picsum.photos/200/300?3')
}
.content4 {
background-image: url('https://picsum.photos/200/300?4')
}
<div class="container">
<a class="content content1" title="Our Products" href="https://www.example.com">
<div>OUR PRODUCTS</div>
</a>
<a class="content content2">CONTENT</a>
<a class="content content3">CONTENT</a>
<a class="content content4">CONTENT</a>
</div>
Alternatively (but probably unnecessarily), in order to make your <a> elements fill their parent <div> elements, you can set their size to width:100% and height:100%, like so:
.container {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 400px 400px;
grid-gap: 8px;
}
.content {
background-color: #60330A;
width: 100%;
background-position: center;
background-size: cover;
text-align: center;
transition: transform .3s;
}
.content:hover {
transform: scale(1.05);
}
.content a {
display: block;
width: 100%;
height: 100%;
}
.content1 {
background-image: url('https://picsum.photos/200/300?1')
}
.content2 {
background-image: url('https://picsum.photos/200/300?2')
}
.content3 {
background-image: url('https://picsum.photos/200/300?3')
}
.content4 {
background-image: url('https://picsum.photos/200/300?4')
}
<div class="container">
<div class="content content1">
<a title="Our Products" href="https://www.example.com">OUR PRODUCTS</a>
</div>
<div class="content content2">CONTENT</div>
<div class="content content3">CONTENT</div>
<div class="content content4">CONTENT</div>
</div>
However, unless you have a specific reason for an additional <div>, I suggest removing them and just using the <a> elements in your grid:
.container {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 400px 400px;
grid-gap: 8px;
}
.content {
background-color: #60330A;
width: 100%;
background-position: center;
background-size: cover;
text-align: center;
transition: transform .3s;
}
.content:hover {
transform: scale(1.05);
}
.content1 {
background-image: url('https://picsum.photos/200/300?1')
}
.content2 {
background-image: url('https://picsum.photos/200/300?2')
}
.content3 {
background-image: url('https://picsum.photos/200/300?3')
}
.content4 {
background-image: url('https://picsum.photos/200/300?4')
}
<div class="container">
<a class="content content1" title="Our Products" href="https://www.example.com">OUR PRODUCTS</a>
<a class="content content2">CONTENT</a>
<a class="content content3">CONTENT</a>
<a class="content content4">CONTENT</a>
</div>

Centering the IMG element in Navbar

Good days guys I would like to ask if how to center the image element in the navigation bar, I dint use ul element when I try to use absolute dint work as well.. what I want to make it happen is just like on the image that attached here. thanks
here's the code, by the use I used grid system here
body,
html {
padding: 0;
margin: 0;
height: 100%;
}
/* ########## Custome Design ######### */
.mainbox {
display: grid;
grid-template-columns: repeat(12, 1fr);
grid-template-rows: repeat(12, 1fr);
/* margin: 10px 0; */
height: 100vh;
}
.box{
background-image: linear-gradient(to bottom,
rgba(93, 173, 226, 0.800),
rgba(93, 173, 226, 0.932) ),
url(/img/bg-picture.jpg);
background-size: cover;
background-position: left;
height: 100vh;
}
header {
grid-row: 1 / 2;
grid-column: 1 / -1;
/* background-color: #fff; */
}
.logo {
height: 65px;
width: 65px;
position: absolute;
margin: auto;
}
.firstNav {
text-align: center;
}
.firstNav > a {
font-family: 'Montserrat', sans-serif;
font-weight: 600;
font-size: 14px;
text-transform: uppercase;
text-decoration: none;
padding: 0 12px;
color: #fff;
}
.firstNav > a:hover {
background: #000;
}
<body>
<div class="mainbox box">
<header>
<nav>
<div class="firstNav">
Home
Blog
Portfolio
<img src="./img/logo.png" alt="logo" class="logo">
Progress
About
Contact
</div>
</nav>
</header>
</div>
</body>
When I tried to use the code above the result is just like below image I attached
I solved this using flexbox, replace the text-align:center; in .firstNav and add a display: flex;
.firstNav {
display: flex;
justify-content: center;
align-items: center;
}
Here you have a codepen if you want to checkit! Let me know if that helps!
You can do something like this:
body,
html {
padding: 0;
margin: 0;
height: 100%;
}
/* ########## Custome Design ######### */
.mainbox {
display: grid;
grid-template-columns: repeat(12, 1fr);
grid-template-rows: repeat(12, 1fr);
/* margin: 10px 0; */
height: 100vh;
}
.box{
background-image: linear-gradient(to bottom,
rgba(93, 173, 226, 0.800),
rgba(93, 173, 226, 0.932) ),
url(/img/bg-picture.jpg);
background-size: cover;
background-position: left;
height: 100vh;
}
header {
grid-row: 1 / 2;
grid-column: 1 / -1;
/* background-color: #fff; */
}
#header ul li a.logo {
background: url("http://i48.tinypic.com/2mob6nb.png");
background-repeat:no-repeat;
height:140px;
display:block;
width:215px;
margin-top:-61px;
padding: 0;
}
.firstNav {
text-align: center;
}
.firstNav > a {
font-family: 'Montserrat', sans-serif;
font-weight: 600;
font-size: 14px;
text-transform: uppercase;
text-decoration: none;
padding: 0 12px;
color: #fff;
}
.firstNav > a:hover {
background: #000;
}
<body>
<div class="mainbox box">
<header>
<nav>
<div class="firstNav">
Home
Blog
Portfolio
<img alt="logo" class="logo">
Progress
About
Contact
</div>
</nav>
</header>
</div>
</body>
I would use a grid like this:
nav {
display: grid;
grid-template-columns: repeat(3, 1fr) auto repeat(3, 1fr)
}
nav > * {
text-align: center;
}
<body>
<div class="mainbox box">
<header>
<nav>
Home
Blog
Portfolio
<img src="./img/logo.png" alt="logo" class="logo">
Progress
About
Contact
</nav>
</header>
</div>
</body>
Note: your <div class="FirstNav"> is useless.
I would suggest using
.firstNav {
display: flex
justify-content: center
align-items: center
}
Full example:
body,
html {
padding: 0;
margin: 0;
height: 100%;
}
/* ########## Custome Design ######### */
.mainbox {
display: grid;
grid-template-columns: repeat(12, 1fr);
grid-template-rows: repeat(12, 1fr);
/* margin: 10px 0; */
height: 100vh;
}
.box{
background-image: linear-gradient(to bottom,
rgba(93, 173, 226, 0.800),
rgba(93, 173, 226, 0.932) ),
url(/img/bg-picture.jpg);
background-size: cover;
background-position: left;
height: 100vh;
}
header {
grid-row: 1 / 2;
grid-column: 1 / -1;
/* background-color: #fff; */
}
.logo {
height: 65px;
width: 65px;
}
.firstNav {
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.firstNav > a {
font-family: 'Montserrat', sans-serif;
font-weight: 600;
font-size: 14px;
text-transform: uppercase;
text-decoration: none;
padding: 0 12px;
color: #fff;
}
.firstNav > a:hover {
background: #000;
}
<div class="mainbox box">
<header>
<nav>
<div class="firstNav">
Home
Blog
Portfolio
<img src="https://placehold.it/50x50" alt="logo" class="logo">
Progress
About
Contact
</div>
</nav>
</header>
</div>