How to handle spaces in flexbox navbar - html

I'm trying to copy a navbar design. This is the design I want:
And this is the navbar I'm getting:
And this is the figma link of the design: Link
I'm using flexbox and justify-content: space-between. But I'm getting extra spaces that i do not want. Other differences like icons doesn't matter i just need the basic copy of the ui and get rid of those spaces.
This is my code at the moment:
React Navbar.js:
const Navbar = () => {
return (
<nav className={styles.navbar}>
<div className={styles.logoWrapper}>
<img
src={require("../../img/logo.png")}
className={styles.logo}
alt="logo"
/>
</div>
<div className={styles.navLinks}>
<div className={styles.navItemWrapper}>
<i className="fas fa-rss fa-2x"></i>
<a href="#" className={styles.navItem}>
FEED
</a>
</div>
<div className={styles.navItemWrapper}>
<i className="fas fa-user-friends fa-2x"></i>
<a href="#" className={styles.navItem}>
NETWORK
</a>
</div>
<div className={styles.navItemWrapper}>
<i className="fas fa-suitcase fa-2x"></i>
<a href="#" className={styles.navItem}>
JOBS
</a>
</div>
<div className={styles.navItemWrapper}>
<i className="far fa-comment-alt fa-2x"></i>
<a href="#" className={styles.navItem}>
CHAT
</a>
</div>
<div className={styles.navItemWrapper}>
<i className="far fa-bell fa-2x"></i>
<a href="#" className={styles.navItem}>
NOTICES
</a>
</div>
</div>
<div className={styles.searchBarWrapper}>
<i className="fas fa-search fa-2x" style={{ color: "#0275B1" }}></i>
<input type="text" placeholder="Search" className={styles.searchBar} />
</div>
<div className={styles.profileOwner}>
<div className={styles.navAvatarWrapper}>
<img
src="https://unsplash.it/20/20"
alt="avatar"
className={styles.navAvatar}
/>
</div>
<div>
<div>
<h3 className={styles.navProfileName}>User Name</h3>
<span className={styles.navProfileNameSpan}>YOU</span>
</div>
<div>
<p className={styles.navProfileViewCount}>
367 views today<strong>+32</strong>
</p>
</div>
</div>
</div>
<div className={styles.navSubmenu}>
<i className="fas fa-ellipsis-h fa-lg"></i>
<h4 className={styles.navSubmenuTitle}>OTHER</h4>
</div>
</nav>
);
};
SCSS:
.navbar {
width: 100vw;
background: $white;
display: flex;
justify-content: space-between;
align-items: center;
color: $base-text-color;
font-size: $text-md;
line-height: 11px;
}
.navLinks {
display: flex;
justify-content: center;
align-items: center;
border-right: $gray-border;
text-align: center;
}
.logoWrapper {
border-right: $gray-border;
}
.logo {
width: 46px;
height: 46px;
margin: 17px 44px 17px 40px;
}
.navItemWrapper {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 18px 20px;
}
.navItem {
text-decoration: none;
color: $base-text-color;
margin-top: 10px;
}
.searchBarWrapper {
border-right: $gray-border;
// width: 367px;
}
.searchBar {
border: none;
font-size: $text-lg;
font-weight: 300;
padding: 30px;
}
.profileOwner {
display: flex;
justify-content: space-between;
align-items: center;
}
.navAvatar {
width: 42px;
height: 42px;
border-radius: 50%;
margin: 15px;
}
.navProfileName {
display: inline-block;
padding: 10px;
}
.navProfileNameSpan {
font-weight: 300;
}
.navProfileViewCount {
font-weight: 300;
padding: 10px;
}
.navSubmenu {
text-align: center;
border-right: $gray-border;
border-left: $gray-border;
margin-right: 40px;
padding: 18px 23px;
}
.navSubmenuTitle {
margin-top: 21px;
}

Just put the logo div and the Feed , Network div in one container and give some margin-left , you should be good to go.
const Navbar = () => {
return (
<div className={styles.navLinks}>
<div className={styles.logoWrapper}>
<img
src={require("../../img/logo.png")}
className={styles.logo}
alt="logo"
/>
</div>
<div className={styles.navItemWrapper}>
<i className="fas fa-rss fa-2x"></i>
<a href="#" className={styles.navItem}>
FEED
</a>
</div>
<div className={styles.navItemWrapper}>
<i className="fas fa-user-friends fa-2x"></i>
<a href="#" className={styles.navItem}>
NETWORK
</a>
</div>
<div className={styles.navItemWrapper}>
<i className="fas fa-suitcase fa-2x"></i>
<a href="#" className={styles.navItem}>
JOBS
</a>
</div>
<div className={styles.navItemWrapper}>
<i className="far fa-comment-alt fa-2x"></i>
<a href="#" className={styles.navItem}>
CHAT
</a>
</div>
<div className={styles.navItemWrapper}>
<i className="far fa-bell fa-2x"></i>
<a href="#" className={styles.navItem}>
NOTICES
</a>
</div>
</div>
<div className={styles.searchBarWrapper}>
<i className="fas fa-search fa-2x" style={{ color: "#0275B1" }}></i>
<input type="text" placeholder="Search" className={styles.searchBar} />
</div>
<div className={styles.profileOwner}>
<div className={styles.navAvatarWrapper}>
<img
src="https://unsplash.it/20/20"
alt="avatar"
className={styles.navAvatar}
/>
</div>
<div>
<div>
<h3 className={styles.navProfileName}>User Name</h3>
<span className={styles.navProfileNameSpan}>YOU</span>
</div>
<div>
<p className={styles.navProfileViewCount}>
367 views today<strong>+32</strong>
</p>
</div>
</div>
</div>
<div className={styles.navSubmenu}>
<i className="fas fa-ellipsis-h fa-lg"></i>
<h4 className={styles.navSubmenuTitle}>OTHER</h4>
</div>
</nav>
);
};

Related

how to size the width of bg image fit to screen in css?

i am building an ecommerce website to learn html and css.I am creating the newsletter section in the site.i have given a blue background image under and the class #newsletter.and i made some css styling to the bg image.i want the image width fit to the screen.but the problem is the image is not filling the full screen.there is a gap on the left side and right side of the screen.i changed width to different sizes,but there is alaways gap on both left and right side.the class name of the css styling is #newsletter.i am giving out my full code here.i will give the full project css and html code here.kindly help me and sorry for the long post as i am new to coding.
style i have right now(check the blue newsleter"s bg image.you can see there is space in both left and right side it is not fit.
the below image is the style i want.you can see both left and right side of the blue image is fit to screen
#import url('https://fonts.googleapis.com/css2?family=Roboto+Slab&family=Spartan:wght#100;200;300;400;500;600;700;800;900&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Spartan' sans-serif;
}
h1{
font-size: 50PX;
line-height: 64px;
color: #222;
}
h2{
font-size: 46PX;
line-height: 54px;
color: #222;
}
h4{
font-size: 20PX;
color: #222;
}
h6{
font-weight: 700;
font-size: 12px
}
p{
font-size: 16PX;
color: #465b52;
margin: 15px 0 20px 0;
}
.section-p1{
padding: 40px 80px;
}
.section-p1{
margin: 40px 0;
justify-content: space-between;
}
section-m1{
margin: 40px 0;
}
button.normal{
font-size: 14px;
font-weight: 600;
padding: 15px 30px;
color: #000;
background-color: #fff;
border-radius: 4px;
cursor: pointer;
border: none;
outline: none;
transition: 0.2s;
width: 250px;
margin: auto;
}
button.white{
font-size: 13px;
font-weight: 600;
padding: 11px 18px;
color: #fff;
background-color: transparent;
border-radius: 4px;
cursor: pointer;
border: 1px solid #fff;
outline: none;
transition: 0.2s;
width: 250px;
margin: auto;
}
body{
width: 100%;
}
/*header start*/
#header{
display: flex;
justify-content: space-between ;
align-items: center;
padding: 20px 80px;
background-color: #e3e6f3;
box-shadow: 0px 5px 15p rgba(0, 0, 0, 0.06);
z-index: 999;
position: sticky;
top: 0;
left: 0;
}
#navbar{
display: flex;
justify-content: center;
align-items: center;
}
#navbar li{
list-style: none;
padding: 0 20px;
position: relative;
}
#navbar li a{
text-decoration: none;
font-size: 16px;
font-weight: 600;
color: #1a1a1a;
transition: 0.3s ease;
}
#navbar li a:hover,
#navbar li a.active{
color: #088178;
}
#navbar li a.active::after,
#navbar li a:hover::after{
content: "";
width: 30%;
height: 2px;
background: #088178;
position: absolute;
bottom: -4px;
left: 20px;
}
#hero{
background-image: url("img/hero4.png");
height: 90vh;
width: 100%;
background-position: top 25 right 0;
background-size: cover;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
}
#hero h4{
padding-bottom: 15px;
}
#hero h1{
color: #088178;
}
#hero button{
background-image: url(img/button.png);
background-color: transparent;
color: #088178;
border:0;
padding: 14px 80px 14px 65px;
background-repeat: no-repeat;
cursor: pointer;
font-weight: 700;
font-size: 15px;
}
#feature{
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
}
#feature .fe-box{
width: 180px;
text-align: center;
padding: 25px 15px;
box-shadow: 20px 20px 34px rgba(0, 0, 0, 0.03);
border: 1px solid #cce7d0;
border-radius: 4px;
margin: 15px 0;
}
#feature .fe-box:hover{
box-shadow: 10px 10px 34px rgba(0, 0, 0, 0.03);
}
#feature .fe-box h6{
display: inline-block;
padding: 9px 8px 6px 8px;
line-height: 1;
border-radius: 4px;
color: #088178;
background-color: #fddde4;
}
#feature .fe-box img{
width: 100%;
margin-bottom: 10px;
}
#product1{
text-align: center;
}
#product1 .pro-container{
display: flex;
justify-content: space-between;
padding-top: 20px;
flex-wrap: wrap;
}
#product1 .pro{
width: 23%;
min-width: 250px;
padding: 10px 12px;
border: 1px solid #cce7d0;
border-radius: 25px;
cursor: pointer;
box-shadow: 20px 20px 30px rgba(0, 0, 0, 0.02);
margin: 15px 0;
position: relative;
}
#product1 .pro img{
width: 100%;
border-radius: 20px;
}
#product1 .pro .des{
text-align: start;
padding: 10px 0;
}
#product1 .pro .des span{
color: #606063;
font-size: 12px;
}
#product1 .pro .des h5{
padding-top: 7px;
color: #1a1a1a;
font-size: 14px;
}
#product1 .pro .des i{
font-size: 25px;
color: rgb(241, 183, 25);
}
#product1 .pro .cart{
width: 40px;
height: 40px;
line-height: 40px;
border-radius: 50px;
background-color: #e3f6ea;
font-weight: 300;
color: #088178;
position: absolute;
border: 1px solid #cce7d0;
bottom: 20px;
right: 10px;
}
#banner{
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
background-image: url(img/banner/b2.jpg);
width: 100%;
height: 40vh;
background-size: cover;
background-position: center;
}
#banner h4{
color: #fff;
font-size: 25px;
padding: 30px 0;
}
#banner h2{
color: #fff;
font-size: 30px;
padding: 10px 0;
}
#banner h2 span{
color: #ef3636;
}
#banner button:hover{
background-color: #088178;
color: white;
}
#sm-banner{
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
#sm-banner .banner-box{
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
text-align: center;
min-width: 820px;
height: 500px;
background-size: cover;
background-position: center;
background-image: url(img/banner/b17.jpg);
padding: 30px;
}
#sm-banner h4{
color: #fff;
font-size: 28px;
font-weight: 380;
}
#sm-banner h2{
color: #fff;
font-size: 38px;
font-weight: 900;
}
#newsletter{
display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
background-image: url("img/banner/b14.png");
background-repeat: no-repeat;
background-position: 20% 30%;
background-color: #041e42;
background-size: cover;
width: 100%;
object-fit: cover;
}
#newsletter h4{
color: #fff;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ecommerce</title>
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.15.4/css/all.css"/>
<link rel="stylesheet" href="style.css">
</head>
<body>
<section id="header">
<img src="img/logo.png" class="logo">
<div>
<ul id="navbar">
<li><a class="active" href="index.html">Home</a></l1>
<li>Shop</l1>
<li>Blog</l1>
<li>About</l1>
<li>Contact</li>
<li><i class="fa-solid fa-cart-arrow-down"></i></li>
</ul>
</div>
</section>
<section id="hero">
<h4>Trade-in-offer</h4>
<h2>Super Value Deals</h2>
<h1>On all products</h1>
<p>Save more with coupons & upto 70%off</p>
<button>Shop Now</button>
</section>
<section id="feature" class="section-p1">
<div class="fe-box">
<img src="img/features/f1.png">
<h6>Free Shipping</h6>
</div>
<div class="fe-box">
<img src="img/features/f2.png">
<h6>Online Order</h6>
</div>
<div class="fe-box">
<img src="img/features/f3.png">
<h6>Save Money</h6>
</div>
<div class="fe-box">
<img src="img/features/f4.png">
<h6>Promotions</h6>
</div>
<div class="fe-box">
<img src="img/features/f5.png">
<h6>Happy Sell</h6>
</div>
<div class="fe-box">
<img src="img/features/f6.png">
<h6>Support</h6>
</div>
</section>
<section id="product1" class="section-p1">
<h2>Featured Products</h2>
<p>Summer Collections</p>
<div class="pro-container">
<div class="pro">
<img src="img/products/f1.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/f2.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/f3.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/f4.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/f5.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/f6.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/f7.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/f8.jpg"
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
</div>
</section>
<section id="banner" class="section-m1">
<h4>Best Service</h4>
<h2>Up to <span>70% - off</span> on All T-shirts</h2>
<button class="normal">Explore More</button>
</section>
<section id="product1" class="section-p1">
<h2>New Arrivals</h2>
<p>Summer Collection New Modern Design</p>
<div class="pro-container">
<div class="pro">
<img src="img/products/n1.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/n2.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/n3.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/n4.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/n5.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/n6.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/n7.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<div class="pro">
<img src="img/products/n8.jpg">
<div class="des">
<span>adidas</span>
<h5>Cartoon Astronaut Tshirt</h5>
<div class="star">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<h4>$78</h4>
</div>
<i class="fal fa-shopping-cart cart"></i>
</div>
<section id="sm-banner" class="section-p1">
<div class="banner-box">
<h4>Crazy deals</h4>
<h2>buy 1 get 1 Free</h2>
<button class="white">Learn More</button>
</div>
</section>
<section id="newsletter">
<div class="newstext">
<h4>Signup for Newsletters</h4>
<p>Get E-mail upadter of out latest shop and
<span>special offers</span>
</p>
</div>
<div class="form">
<input type="text" placeholder="Your Email Address">
<button>Sign up</button>
</div>
</section>
<script src="script.js"></script>
</body>
</html>
Unfortunately I cannot display the top image background in my sandbox, but I can assist you with the footer and the same issue should apply to the upper element/image.
.section-p1 {
padding: 40px 80px;
}
This .section-p1 class is causing your elements WITHIN itself to be limited to the padding provided.
Try to comment it out:
.section-p1 {
// padding: 40px 80px;
}
and see how it brings your footer to the desired width(as displayed above).
For your solution, you might want to move #newsletter outside of .section-p1 class.

height issue with display grid

I am working on my website and I ran into an issue with this part of my website. So I'm trying to add a skills section and I used display: grid, but the height is not matched with its content. The height is shorter than it should be.
First, I tried to fix it with height: x vh, but I realized it might not be the perfect solution for responsiveness.
I can also share the link to my website if you prefer.
.skills-section {
background-color: #626262;
margin-top: 100px;
text-align: center;
height: auto;
}
.wrapper {
width: 85%;
margin: 0 auto;
}
.skills-header {
font-family: 'Martel', serif;
font-weight: 900;
font-size: 2rem;
color: white;
padding-top: 20px;
}
.skills-container {
justify-items: center;
color: white;
display: grid;
grid-template-columns: repeat(6, 1fr);
grid-template-rows: repeat(2, 100%);
}
.skills-header p,
.fa-html5,
.fa-css3-alt,
.fa-sass,
.fa-js-square,
.fa-dollar-sign,
.fa-react,
.fa-fire,
.fa-node-js,
.fa-git-alt,
.fa-cogs,
.fa-universal-access,
.fa-mobile-alt {
text-shadow: 2px 2px 5px #F99A14;
}
.skills-logo {
display: inline-block;
height: 40px;
width: 65px;
margin: 20px;
}
.skills-logo p{
display: inline-block;
font-family: 'Roboto', sans-serif;
font-weight: 300;
font-size: 1rem;
}
<section class="skills-section">
<div class="wrapper">
<div class="skills-header">
<p>Skills</p>
</div>
<div class="skills-container">
<div class="skills-logo">
<i class="fab fa-html5 fa-3x"></i>
<p>HTML</p>
</div>
<div class="skills-logo">
<i class="fab fa-css3-alt fa-3x"></i>
<p>CSS</p>
</div>
<div class="skills-logo">
<i class="fab fa-sass fa-3x"></i>
<p>Sass</p>
</div>
<div class="skills-logo">
<i class="fab fa-js-square fa-3x"></i>
<p>JavaScript</p>
</div>
<div class="skills-logo">
<i class="fas fa-dollar-sign fa-3x"></i>
<p>jQuery</p>
</div>
<div class="skills-logo">
<i class="fab fa-react fa-3x"></i>
<p>React</p>
</div>
<div class="skills-logo">
<i class="fas fa-fire fa-3x"></i>
<p>Firebase</p>
</div>
<div class="skills-logo">
<i class="fab fa-node-js fa-3x"></i>
<p>Node js</p>
</div>
<div class="skills-logo">
<i class="fab fa-git-alt fa-3x"></i>
<p>Git</p>
</div>
<div class="skills-logo">
<i class="fas fa-cogs fa-3x"></i>
<p>Rest APIs</p>
</div>
<div class="skills-logo">
<i class="fas fa-universal-access fa-3x"></i>
<p>Web Accessibility</p>
</div>
<div class="skills-logo">
<i class="fas fa-mobile-alt fa-3x"></i>
<p>Responsive Design</p>
</div>
</div>
</div>
</section>
I have tested your code, and found out that why is it happening like this. I have just removed one piece of code, and it worked! Code snippet below:
.skills-section {
background-color: #626262;
margin-top: 100px;
text-align: center;
width: 100%;
}
.wrapper {
width: 85%;
}
.skills-header {
font-family: 'Martel', serif;
font-weight: 900;
font-size: 2rem;
color: white;
padding-top: 20px;
}
.skills-container {
justify-items: center;
color: white;
display: grid;
grid-template-columns: repeat(6, 95px);
grid-template-rows: repeat(2);
}
.skills-header p,
.fa-html5,
.fa-css3-alt,
.fa-sass,
.fa-js-square,
.fa-dollar-sign,
.fa-react,
.fa-fire,
.fa-node-js,
.fa-git-alt,
.fa-cogs,
.fa-universal-access,
.fa-mobile-alt {
text-shadow: 2px 2px 5px #F99A14;
}
.skills-logo {
display: inline-block;
margin: 20px;
}
.skills-logo p {
display: inline-block;
font-family: 'Roboto', sans-serif;
font-weight: 300;
font-size: 1rem;
}
<!DOCTYPE html>
<html>
<head>
<title>Title of the page</title>
</head>
<body>
<section class="skills-section">
<div class="wrapper">
<div class="skills-header">
<p>Skills</p>
</div>
<div class="skills-container">
<div class="skills-logo">
<i class="fab fa-html5 fa-3x"></i>
<p>HTML</p>
</div>
<div class="skills-logo">
<i class="fab fa-css3-alt fa-3x"></i>
<p>CSS</p>
</div>
<div class="skills-logo">
<i class="fab fa-sass fa-3x"></i>
<p>Sass</p>
</div>
<div class="skills-logo">
<i class="fab fa-js-square fa-3x"></i>
<p>JavaScript</p>
</div>
<div class="skills-logo">
<i class="fas fa-dollar-sign fa-3x"></i>
<p>jQuery</p>
</div>
<div class="skills-logo">
<i class="fab fa-react fa-3x"></i>
<p>React</p>
</div>
<div class="skills-logo">
<i class="fas fa-fire fa-3x"></i>
<p>Firebase</p>
</div>
<div class="skills-logo">
<i class="fab fa-node-js fa-3x"></i>
<p>Node js</p>
</div>
<div class="skills-logo">
<i class="fab fa-git-alt fa-3x"></i>
<p>Git</p>
</div>
<div class="skills-logo">
<i class="fas fa-cogs fa-3x"></i>
<p>Rest APIs</p>
</div>
<div class="skills-logo">
<i class="fas fa-universal-access fa-3x"></i>
<p>Web Accessibility</p>
</div>
<div class="skills-logo">
<i class="fas fa-mobile-alt fa-3x"></i>
<p>Responsive Design</p>
</div>
</div>
</div>
</section>
</body>
</html>
Just remove grid-template-rows: repeat(2, 100%); and it should fit everything.
Or keep it and change that 100% to almost anything else besides a % value if its necessary and it should work.

HTML - Get consistent height across inline-block divs

I am creating a horizontal navigation with an icon and text for each navigation item. I am running into an issue with items that contain two lines of text vs one.
I have tried modifying the padding and height of the div that extends higher than the others, but to no avail. How can I modify this to achieve a consistent height across all navigation items regardless of lines of text?
View the fiddle: Here
<div id="dashboard">
<a class="actions" href="#">
<div>
<i class="fas fa-users"></i> <br />Employees
</div>
</a>
<a class="actions" href="#">
<div>
<i class="fas fa-pencil-ruler"></i> <br />Check Stats
</div>
</a>
<a class="actions" href="#"">
<div>
<i class="fas fa-table"></i> <br />Generate Census
</div>
</a>
<a class="actions" href="#">
<div>
<i class="fas fa-paper-plane"></i> <br />Send Forms
</div>
</a>
<a href="#" class="actions" data-toggle="modal" data-target="#deleteClientModal">
<div>
<i class="fas fa-trash-alt"></i> <br />Delete
</div>
</a>
</div>
.actions:first-child div {
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
.actions:last-child div {
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}
.actions > div {
display: block;
background-color: #fafafa;
color: #223a5c;
border: 1px solid #d6d8db;
padding: 15px 0;
margin: 0 -6px 20px 0;
width: 12.5%;
text-align: center;
display: inline-block;
}
.actions > div:hover {
background-color: #f2f2f2;
}
.actions > div i {
width: 1em;
font-size: 2em;
}
A flexbox solution might look something like this:
#dashboard {
display: flex;
}
div:first-child>.actions>div {
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
div:last-child>.actions>div {
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}
.actions>div {
background-color: #fafafa;
color: #223a5c;
border: 1px solid #d6d8db;
padding: 15px 15px;
text-align: center;
}
.actions>div:hover {
background-color: #f2f2f2;
}
.actions>div i {
width: 1em;
font-size: 2em;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<div id="dashboard">
<div>
<a class="actions" href="#">
<div>
<i class="fas fa-users"></i> <br />Employees
</div>
</a>
</div>
<div>
<a class="actions" href="#">
<div>
<i class="fas fa-pencil-ruler"></i> <br />Check Stats
</div>
</a>
</div>
<div>
<a class="actions" href="#">
<div>
<i class="fas fa-table"></i> <br />Generate Census
</div>
</a>
</div>
<div>
<a class="actions" href="#">
<div>
<i class="fas fa-paper-plane"></i> <br />Send Forms
</div>
</a>
</div>
<div>
<a href="#" class="actions" data-toggle="modal" data-target="#deleteClientModal">
<div>
<i class="fas fa-trash-alt"></i> <br />Delete
</div>
</a>
</div>
</div>

Div background color

I'm having a hell of a time trying to get a background color to show on a div. I have tried specifying width, height, overflow, etc. with no luck. The code is below. I can get inner div background to change, but not the containing div.
The div in question is header-top-container. Any help is greatly appreciated.
.header-top-container {
background: #F0F0F0;
overflow: hidden;
}
.header-top-container>.main-container {
padding-top: 0;
padding-bottom: 0;
display: flex;
}
.main-container {
position: relative;
max-width: 1260px;
margin: 0 auto;
padding: 15px;
}
body .header-top-container .external-store-tab {
width: 360px;
}
body .header-top-container .external-store-tab,
body .header-top-container .account-cart-wrapper {
position: relative;
width: 70%;
}
<div class="header-top-container">
<div class="main-container header-main-container">
<div class="external-store-tab">
<div class="tab-item">
<a href="https://www.example.org">
<img src="https://www.example.org/logo-foundation.png" class="tab-logo">
</a>
</div>
<div class="tab-item active">
<a href="http://store.example.org/">
<img src="https://www.example.org/logo-store.png" class="tab-logo">
</a>
</div>
</div>
<div class="account-cart-wrapper">
<a href="http://www.example.org/contact/" class="account-link hide-mb">
<span class="label" style="color:#008CA8;">
<i class="fa fa-envelope" aria-hidden="true"></i>
<span class="bar-text" tyle="font-family: 'Open Sans',sans-serif;">Contact</span>
</span>
</a>
<a href="tel:800.222.5870" class="account-link">
<span class="label" style="color:#008CA8;">
<i class="fa fa-phone fa-lg" aria-hidden="true"></i>
<span class="bar-text" style="font-family: 'Open Sans',sans-serif;">800.222.5870</span>
</span>
</a>
<a href="https://store.example.org/customer/account/login/" class="skip-link skip-account account-link sign-in-bar">
<span class="label">
<i class="fa fa-user fa-lg" aria-hidden="true"></i>
<span class="bar-text" style="font-family: 'Open Sans',sans-serif;">Sign in</span>
</span>
</a>
<a href="https://store.example.org/checkout/cart/" class="skip-link skip-account account-link">
<span class="label">
<i class="fa fa-shopping-cart fa-lg" aria-hidden="true"></i>
</span>
</a>
</div>
</div>
</div>
Add to class "header-top-container", property "position:inherit" class, like following:
.header-top-container {
background: #F0F0F0;
overflow:hidden;
position: inherit;
}
Your #custom-layer1 has a background that matches the page. Your header-container-top is changing color, but is being 'painted' over so to speak by the background of #custom-layer1.

how do I make multiple divs width change dynamically with out overlapping when window size changes

I have a div with three divs inside of different width. when my window size changes it is overlapping each other.How do I make content remain without overlapping when window size changes.
Here is my code.
#topBarContainer{
background-color: blue;
}
#topBarLeft{
width: 14%;
text-align: center;
}
#topBarMiddle{
width: 26%;
text-align: center;
}
#topBarRight{
width: 60%;
text-align: right;
}
.topBar {
margin-right: -4px;
text-align: center;
display: inline-block;
padding-top: 5px;
padding-bottom: 3px;
}
<div id="topBarContainer">
<!--TopBar-->
<div id="topBarLeft" class="topBar">
<input type="button" ng-click="newMenuType('message')" value="New" id="newButton">
</div>
<!--Top Bar Middle-->
<div id="topBarMiddle" class="topBar">
<div class="searchBoxContainer">
<i class="fa fa-search fa-flip-horizontal" id="searchBoxIcon"> </i>
<input type="text" placeholder="Search Inbox" class="searchBox" ng-model="searchEmail" />
</div>
</div>
<!--Top Bar Right-->
<div id="topBarRight" class="topBar">
<div>
<div class="loginRow">Hi{{loginName()}}</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply"></i>
</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply-all"></i>
</div>
<div ng-if="emailIcon()" class="iconRow" >
<i class="fa fa-reply fa-flip-horizontal"></i>
</div>
<div ng-if="!isDeletedView() && emailIcon()" class="iconRow">
<i class="fa fa-trash"></i>
</div>
</div>
</div>
</div>
It is looking good with normal window when I resize window it is overlapping all.leftBar takes 14%and middle bar takes 26% and rest for the right container.
I am spenting days to fix this. I need to align all so that all 3 sections display in the same line.
you can use display:flex from flexbox
body {
margin: 0
}
#topBarContainer {
background-color: blue;
display: flex;
}
#topBarLeft {
width: 14%;
text-align: center;
}
#topBarMiddle {
text-align: center;
background: red;
width: 35%
}
#topBarRight {
text-align: right;
background: green;
flex: 1
}
#topBarRight > div {
display: inline-flex
}
.topBar {
text-align: center;
padding-top: 5px;
padding-bottom: 3px;
}
#topBarRight >div:last-of-type {
text-align: center
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" />
<div id="topBarContainer">
<!--TopBar-->
<div id="topBarLeft" class="topBar">
<input type="button" ng-click="newMenuType('message')" value="New" id="newButton">
</div>
<!--Top Bar Middle-->
<div id="topBarMiddle" class="topBar">
<div class="searchBoxContainer">
<i class="fa fa-search fa-flip-horizontal" id="searchBoxIcon"> </i>
<input type="text" placeholder="Search Inbox" class="searchBox" ng-model="searchEmail" />
</div>
</div>
<!--Top Bar Right-->
<div id="topBarRight" class="topBar">
<div>
<div class="loginRow">Hi{{loginName()}}</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply"></i>
</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply-all"></i>
</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply fa-flip-horizontal"></i>
</div>
<div ng-if="!isDeletedView() && emailIcon()" class="iconRow">
<i class="fa fa-trash"></i>
</div>
<div ng-show="canMoveToFolder()" class="iconRow" ng-mouseover="newIcon = true" ng-mouseleave="newIcon = false"> <i class="fa fa-folder-o"> </i>
<div ng-if="newIcon" id="newItemOptions">
<label class='newItemLabel' ng-click="moveMessageToFolder(3)">Inbox</label>
<label class='newItemLabel' ng-click="moveMessageToFolder(4)">Sent</label>
</div>
</div>
</div>
</div>
</div>
I'm not sure if it is what you are looking for but if you put your searchBoxContainer in display:flex; it shud solwe the problem cause it puts your searchBoxIcon in front of the searchBox it self
you have to pu in your css
.searchBoxContainer{
display:flex;
}
#topBarContainer{
background-color: blue;
}
#topBarLeft{
width: 14%;
text-align: center;
}
#topBarMiddle{
width: 26%;
text-align: center;
}
#topBarRight{
width: 60%;
text-align: right;
}
.topBar {
margin-right: -4px;
text-align: center;
display: inline-block;
padding-top: 5px;
padding-bottom: 3px;
}
.searchBoxContainer{
display:flex;
}
<div id="topBarContainer">
<!--TopBar-->
<div id="topBarLeft" class="topBar">
<input type="button" ng-click="newMenuType('message')" value="New" id="newButton">
</div>
<!--Top Bar Middle-->
<div id="topBarMiddle" class="topBar">
<div class="searchBoxContainer">
<i class="fa fa-search fa-flip-horizontal" id="searchBoxIcon"> </i>
<input type="text" placeholder="Search Inbox" class="searchBox" ng-model="searchEmail" />
</div>
</div>
<!--Top Bar Right-->
<div id="topBarRight" class="topBar">
<div>
<div class="loginRow">Hi{{loginName()}}</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply"></i>
</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply-all"></i>
</div>
<div ng-if="emailIcon()" class="iconRow" >
<i class="fa fa-reply fa-flip-horizontal"></i>
</div>
<div ng-if="!isDeletedView() && emailIcon()" class="iconRow">
<i class="fa fa-trash"></i>
</div>
</div>
</div>
</div>
Why are all elements moved right with that negative margin on the .topBar class? I would just erase that, and add box-sizing: border-box; to .topBar (just to be on the safe side for percentage widths and heights).
So you'd have
.topBar {
box-sizing: border-box;
text-align: center;
display: inline-block;
padding-top: 5px;
padding-bottom: 3px;
}