.codrops-top {
line-height: 30px;
font-size: 13px;
background: #fff;
background: rgba(255, 255, 255, 0.8);
text-transform: uppercase;
z-index: 9999;
position: absolute;
width: 100%;
top: 0;
left: 0;
font-family: Cambria, Georgia, serif;
box-shadow: 1px 0px 2px rgba(0,0,0,0.2);
font-weight: 900;
}
.codrops-top a {
padding: 0px 10px;
letter-spacing: 1px;
color: #333;
display: inline-block;
text-decoration: none;
}
.codrops-top a:hover {
color:#12836d;
cursor:pointer;
text-decoration: none;
}
.codrops-top span.right{
float: right;
}
.codrops-top a{
color:black;
}
.fa{
padding:0 5px;
}
.codrops-top span a.btn {
padding: 9px 38px;
line-height: 20px;
}
.codrops-top span a.btn-primary {
color: #fff;
background-color: #5bbc2e;
border-color: #5bbc2e;
}
#media only screen and (max-width: 767px){
.codrops-top{
text-align: center;
}
.codrops-top span.right{
text-align: center;
float:none;
}
}
#media screen and (min-width: 1338px){
.largeScreen {width:100%;text-align:center;}
.largeScreen span {display:inline-block;}
.hide{
display: none;
}
}
<div class="codrops-top">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="col-lg-3 col-md-3 col-sm-3 hide">
<a href="">
<strong>Your Tech Friend </strong><span><i class="fa fa-mobile"></i></span>+91-8510-808-808
</a>
</div>
<div style="text-align:center;" class="col-lg-6 col-md-6 col-sm-6 hide">
<a href="">
<strong><span><i class="fa fa-book"></i></span>Blog</strong>
</a>
<a href="">
<strong><span><i class="fa fa-trophy"></i></span>Career</strong>
</a>
<a href="">
<strong><span><i class="fa fa-sitemap"></i></span>Site Map</strong>
</a>
<a href="">
<strong><span><i class="fa fa-rocket"></i></span>Request a Quote</strong>
</a>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 largeScreen">
<span class="right">
<a href="">
Client Area
</a>
</span>
</div>
</div>
</div>
</div>
</div>
now i want the client area button in the center on size of 1338px screen and all the things should be hidden only the button should be in the center.
i have tried it but the button is not coming in center it is coming on the left side.
.codrops-top {
line-height: 30px;
font-size: 13px;
background: #fff;
background: rgba(255, 255, 255, 0.8);
text-transform: uppercase;
z-index: 9999;
position: absolute;
width: 100%;
top: 0;
left: 0;
font-family: Cambria, Georgia, serif;
box-shadow: 1px 0px 2px rgba(0,0,0,0.2);
font-weight: 900;
text-align: center;
}
.codrops-top a {
padding: 0px 10px;
letter-spacing: 1px;
color: #333;
display: inline-block;
text-decoration: none;
}
.codrops-top a:hover {
color:#12836d;
cursor:pointer;
text-decoration: none;
}
.codrops-top a{
color:black;
}
.fa{
padding:0 5px;
}
.codrops-top span a.btn {
padding: 9px 38px;
line-height: 20px;
}
.codrops-top span a.btn-primary {
color: #fff;
background-color: #5bbc2e;
border-color: #5bbc2e;
}
#media only screen and (max-width: 767px){
.codrops-top{
text-align: center;
}
.codrops-top span.right{
text-align: center;
float:none;
}
}
#media only screen and (max-width: 1338px){
#hide{
}
.codrops-top{
text-align: center;
float:right;
}
}
<div class="codrops-top">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div id="hide" class="col-lg-3 col-md-3 col-sm-3">
<a href="">
<strong>Your Tech Friend </strong><span><i class="fa fa-mobile"></i></span>+91-8510-808-808
</a>
</div>
<div id="hide" style="text-align:center;" class="col-lg-6 col-md-6 col-sm-6">
<a href="">
<strong><span><i class="fa fa-book"></i></span>Blog</strong>
</a>
<a href="">
<strong><span><i class="fa fa-trophy"></i></span>Career</strong>
</a>
<a href="">
<strong><span><i class="fa fa-sitemap"></i></span>Site Map</strong>
</a>
<a href="">
<strong><span><i class="fa fa-rocket"></i></span>Request a Quote</strong>
</a>
</div>
<div class="col-lg-3 col-md-3 col-sm-3">
<span class="right">
<a href="">
Client Area
</a>
</span>
</div>
</div>
</div>
</div>
</div>
I assume you have included bootstrap to your code.
<style>
#media screen and (min-width: 1338px){
.largeScreen {width:100%;text-align:center;}
.largeScreen span {display:inline-block;}
.hide {display:none;}
}
</style>
<div class="col-lg-3 col-md-3 col-sm-3 largeScreen">
<span>
Client Area
</span>
</div>
Avoid using same id's multiple times in your code. I can see
id="hide" twice. You can use class="hide" instead.
I would suggest renaming the hide class if you want to hide the elements only above 1338px as the bootstrap hide class hides the contents at all resolutions.
You missed mentioning display:none in the CSS for the hide.
Remove float:right from the span. text-align:center won't have any effect unless you remove the float css property.
I've added the class largeScreen as the classes col-lg-3 col-md-3 col-sm-3 will make the width of the div to 25% and not full width of the screen.
Hope this answer helps you solve your problem.
.codrops-top {
line-height: 30px;
font-size: 13px;
background: #fff;
background: rgba(255, 255, 255, 0.8);
text-transform: uppercase;
z-index: 9999;
position: absolute;
width: 100%;
top: 0;
left: 0;
font-family: Cambria, Georgia, serif;
box-shadow: 1px 0px 2px rgba(0,0,0,0.2);
font-weight: 900;
text-align: center;
}
.codrops-top a {
padding: 0px 10px;
letter-spacing: 1px;
color: #333;
display: inline-block;
text-decoration: none;
}
.codrops-top a:hover {
color:#12836d;
cursor:pointer;
text-decoration: none;
}
.codrops-top a{
color:black;
}
.fa{
padding:0 5px;
}
.codrops-top span a.btn {
padding: 9px 38px;
line-height: 20px;
}
.codrops-top span a.btn-primary {
color: #fff;
background-color: #5bbc2e;
border-color: #5bbc2e;
}
#media only screen and (max-width: 767px){
.codrops-top{
text-align: center;
}
.codrops-top span.right{
text-align: center;
float:none;
}
}
#media only screen and (max-width: 1338px){
#hide{display:none;
}
.codrops-top{
text-align: center;
float:right;
}
}
<div class="codrops-top">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div id="hide" class="col-lg-3 col-md-3 col-sm-3">
<a href="">
<strong>Your Tech Friend </strong><span><i class="fa fa-mobile"></i></span>+91-8510-808-808
</a>
</div>
<div id="hide" style="text-align:center;" class="col-lg-6 col-md-6 col-sm-6">
<a href="">
<strong><span><i class="fa fa-book"></i></span>Blog</strong>
</a>
<a href="">
<strong><span><i class="fa fa-trophy"></i></span>Career</strong>
</a>
<a href="">
<strong><span><i class="fa fa-sitemap"></i></span>Site Map</strong>
</a>
<a href="">
<strong><span><i class="fa fa-rocket"></i></span>Request a Quote</strong>
</a>
</div>
<div class="col-lg-3 col-md-3 col-sm-3">
<span class="right">
<a href="">
Client Area
</a>
</span>
</div>
</div>
</div>
</div>
</div>
Related
I want the image in my site to completely change when the browser is resized.
I've been using media-queries, but I can't seem to get it right. Any thoughts/tips?
The thing is I have tried the display trick with media query but its not working
I did this, but it's not working even when I am lowering the viewport. The image in the laptop viewport remains the same in the phone viewport.
.blocks {
height: 58%;
}
.mob {
display: none;
}
#media (max-width:400px) {
.mob {
display: block;
}
.blocks {
display: none;
}
}
<div class="col-lg-6 border:1px">
<img class="blocks" src="https://via.placeholder.com/200" alt="laptop-mockup">
<img class="mob" src="https://via.placeholder.com/200/ff0000" alt="android-mockup">
</div>
The whole html and css code:
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>News homepage</title>
<link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<link rel="stylesheet" href="css/styles.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght#400&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans:wght#600;700;800&family=PT+Sans:wght#700&display=swap" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="navigator">
<nav class="navbar navbar-expand-sm navbar-dark navbar-light">
<a class="navbar-brand" href=""> <img src="C:\Users\91826\Desktop\news-homepage-main\css\images\logo.svg" alt="My Happy SVG" /></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation navbar-light">
<span class="navbar-toggler-icon navi"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto">
<li class="nav-item ms-auto navelement">
<a class="nav-link " href="#footer">Home </a>
</li>
<li class="nav-item ms-auto navelement">
<a class="nav-link " href="#pricing"> New </a>
</li>
<li class="nav-item ms-auto navelement">
<a class="nav-link " href="#cta"> Popular </a>
</li>
<li class="nav-item ms-auto navelement">
<a class="nav-link" href="#footer"> Trending </a>
</li>
<li class="nav-item ms-auto navelement">
<a class="nav-link " href="#footer"> Categories </a>
</li>
</ul>
</div>
</nav>
</div>
<div class="row ">
<div class="col-lg-6 border:1px">
<img class="blocks" src="C:\Users\91826\Desktop\news-homepage-main\css\images\image-web-3-desktop.jpg" alt="laptop-mockup">
<img class="mob" src="C:\Users\91826\Desktop\news-homepage-main\css\images\image-web-3-mobile.jpg" alt="android-mockup">
</div>
<div class="tag">
<h1 class="tagline">The Bright<br />Future of<br />Web 3.0?</h1>
</div>
<div class="read">
<h1 class="readline">We dive into the next evolution of the web that claims to put the power of the platforms back into the hands of the people.
But is it really fulfilling its promise?</h1>
</div>
<button class="button-50 readmore" type="button" name="button">READ MORE</button>
<div class="col-lg-6 border:1px">
<div class="new">
<h1>New</h1>
<h2>Hydrogen VS Electric Cars</h2>
<h3>Will hydrogen-fueled cars ever catch up to EVs?</h3>
<hr>
<h2>The Downsides of AI Artistry</h2>
<h3>What are the possible adverse effects of on-demand AI image generation?</h3>
<hr>
<h2>Is VC Funding Drying Up?</h2>
<h3>Private funding by VC firms is down 50% YOY. We take a look at what that means.</h3>
</div>
</div>
</div>
</div>
<div class="info">
<div class="row">
<div class="col-lg-4 box">
<div class="row">
<div class="col-lg-2 box">
<img class="infoimg" src="C:\Users\91826\Desktop\news-homepage-main\css\images\image-retro-pcs.jpg" alt="" />
</div>
<div class="col-lg-2 box">
<div class="inf">
<h1 class="infohead1 "> 01</h1>
<h2 class="infohead2"> Reviving Retro PCs</h2>
<h3 class="infohead3"> What happens when old PCs<br>are given modern upgrades?</h3>
</div>
</div>
</div>
</div>
<div class="col-lg-4 box2">
<div class="row">
<div class="col-lg-2 box">
<img class="infoimg" src="C:\Users\91826\Desktop\news-homepage-main\css\images\image-gaming-growth.jpg" alt="">
</div>
<div class="col-lg-2 box">
<div class="inf1 inf">
<h1 class="infohead1"> 02</h1>
<h2 class="infohead2"> Top 10 laptops of 2022</h2>
<h3 class="infohead3">Our best picks for various <br> needs and budgets.</h3>
</div>
</div>
</div>
</div>
<div class="col-lg-4 box2">
<div class="row">
<div class="col-lg-2 box">
<img class="infoimg" src="C:\Users\91826\Desktop\news-homepage-main\css\images\image-top-laptops.jpg" alt="">
</div>
<div class="col-lg-2 box">
<div class="inf">
<h1 class="infohead1"> 03</h1>
<h2 class="infohead2"> The Growth of Gaming</h2>
<h3 class="infohead3">How the pandemic has sparked <br> fresh opportunities.</h3>
</div>
</div>
</div>
</div>
</div>
<hr class="hori">
<div class="attribution">
Challenge by Frontend Mentor.
Coded by Saswat Seth.
</div>
</body>
</html>
CSS
.navigator {
margin-bottom: 2%;
}
body {
padding: 0% 10% 2% 10%;
}
.nav-link {
color: black;
}
:hover.nav-link {
color: #6B728E;
}
.navigator {
padding: 2% 5% 0% 0%;
}
.blocks {
height: 58%;
}
.mob {
display: none;
}
#media (max-width:400px) {
.mob {
display:block;
}
.blocks {
display:none;
}
}
.new {
height: 85%;
width: 23%;
background: hsl(240, 100%, 5%);
position: absolute;
right: 140px;
padding: 2%;
}
.navelement {
padding-right: 6%;
font-size: 100%;
}
h1 {
color: hsl(35, 77%, 62%);
font-family: 'noto sans';
font-weight: 600;
}
h2 {
color: #fff;
font-size: 23px;
margin-top: 10%;
font-family: 'noto sans';
font-weight: 700;
}
h3 {
color: #6B728E;
font-size: 15px;
padding: 4% 0%;
line-height: 25px;
}
hr {
color: #fff;
border-top: solid white;
}
.tag {
position: absolute;
bottom: 20px;
}
.tagline {
font-family: 'noto sans';
color: #000;
font-weight: 800;
font-size: 60px;
}
.read {
padding: 2% 38%;
position: absolute;
bottom: 54px;
right: -15px;
}
.readline {
font-size: 110%;
color: #6B728E;
line-height: 27px;
}
.button-50 {
height: 49px;
width: 200px;
appearance: button;
background-color: hsl(5, 85%, 63%);
background-image: none;
border: 1px solid #000;
border-radius: 4px;
box-shadow: #B73E3E 4px 4px 0 0, #000 4px 4px 0 1px;
box-sizing: border-box;
color: #fff;
cursor: pointer;
display: inline-block;
font-family: "Montserrat";
font-size: 18px;
font-weight: 400;
line-height: 20px;
margin: 20% 5% 10% 0%;
overflow: visible;
padding: 14px 30px;
text-align: center;
text-transform: none;
touch-action: manipulation;
user-select: none;
-webkit-user-select: none;
vertical-align: middle;
white-space: nowrap;
position: absolute;
bottom: -45px;
right: 45%;
}
.button-50:focus {
text-decoration: none;
}
.button-50:hover {
text-decoration: none;
}
.button-50:active {
box-shadow: rgba(0, 0, 0, .125) 0 3px 5px inset;
outline: 0;
}
.button-50:not([disabled]):active {
box-shadow: #C9BBCF 2px 2px 0 0, #1d1716 2px 2px 0 1px;
transform: translate(2px, 2px);
}
.readmore {
margin: 10% 3% 5% 0;
font-family: 'Poppins';
font-weight: 400;
}
.info {
margin-top: 5%;
margin-left: 10%;
position: absolute;
right: 10%;
}
.infoimg {
width: 315%;
padding: 20%;
}
.infohead1 {
color: #7D9D9C;
}
.infohead2 {
color: #000;
}
.inf {
padding: 30%;
margin-left: 68px;
white-space: nowrap;
}
.hori {
margin-top: 10%;
color: #000;
border-top: solid black;
}
#media (max-width:350px) {
img{
object-fit: cover;
height: 400px;
}
}
#media screen and (max-width:400px) {
.mob {
display: block;
}
}
I am creating a Twitter clone but the sidebar moves down when I create the main page contents. I tried using Position - fixed and relative but still the same issue. Before I added the main page content, the sidebar was correctly positioned (please see screenshot) but as soon as its added, the sidebar moves down(please see screenshot).
I'm using Grid to create the three columns to give the Twitter aesthetics.
What am I doing wrong?
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.twitter-logo {
height: 28px;
filter: invert(52%) sepia(50%) saturate(2964%) hue-rotate(179deg) brightness(95%) contrast(97%);
margin-left: 25px;
}
.left-sidebar {
/* position: fixed; */
position: relative;
}
.navbar-brand:hover {
background: rgba(29, 161, 242, 0.1);
border-radius: 50%;
color: #1da0f2;
margin-right: 23px;
/* padding: 20px; */
}
.left-sidebar-menu {
font-size: 20px;
cursor: pointer;
font-weight: 700;
display: flex;
color: rgb(15, 20, 25);
font-family: 'Times New Roman', Times, serif;
}
.left-sidebar-menu-icon {
align-items: flex-start;
height: 26px;
margin-right: 20px;
}
.nav-item {
padding: 10px;
margin: 2px 2px;
}
.nav-item:hover {
background: rgba(29, 161, 242, 0.1);
border-radius: 20px;
color: #1da0f2;
}
/* --------------------------------MAIN PAGE------ */
.main-page-header {
font-size: 18px;
height: 48px;
font-weight: 700;
font-family: 'Open Sans', sans-serif;
}
.main-page-header-profile-picture {
border-radius: 50%;
height: 48px;
}
.main-page-input {
border: 0 solid black;
}
.main-page-input-box {
padding-top: 10px;
border-bottom: 1px solid #e6e6e6;
}
.main-page-tweet-box {
margin-top: -5px;
word-wrap: break-word;
word-break: break-all;
outline: none;
}
.main-page-tweet-box:focus main-page-tweet-box:hover {
outline: none !important;
box-shadow: none;
border: 0;
}
.main-page-tweet-box {
height: 130px;
border: 0;
margin-top: -10px;
}
::placeholder {
font-family: 'Open Sans', sans-serif;
opacity: 1;
font-size: 18px;
/* position: absolute;
margin-top: 10px; */
}
.main-page-input-privacy {
/* display: flex;
align-items: flex-start; */
display: inline-block;
color: #1da1f2;
cursor: pointer;
}
.main-page-input-privacy-icon,
main-page-input-privacy-text {
display: inline;
}
/* .main-page-input-privacy i{
float: left;
} */
.main-page-input-icons {
display: flex;
justify-content: space-between;
margin-left: -35PX;
}
.main-page-input-icons-ul {
list-style-type: none;
margin-left: 5px;
}
.main-page-input-icons li {
display: inline;
/* width: 300px; */
list-style: none;
color: #1da1f2;
font-size: 20px;
margin: 0 2px;
height: 38px;
width: 38px;
cursor: pointer;
}
.main-page-tweet-button {
font-size: 16px;
font-family: 'Open Sans', sans-serif;
color: white;
background-color: #1da1f2;
text-align: center;
cursor: pointer;
/* width: 75px; */
/* height: 30px; */
border: none;
outline: none;
opacity: 0.5;
}
/* .main-page-input form {
} */
/* .left-sidebar-menu-icon-active using js {
filter: invert(52%) sepia(50%) saturate(2964%) hue-rotate(179deg) brightness(95%) contrast(97%);
} */
/* .left-sidebar-menu-btn {
} */
.tweetbox__input img {
border-radius: 50%;
height: 40px;
}
.tweetBox {
padding-bottom: 10px;
border-bottom: 8px solid var(--twitter-background);
padding-right: 10px;
}
.tweetBox form {
display: flex;
flex-direction: column;
}
.tweetbox__input {
display: flex;
padding: 20px;
}
.tweetbox__input input {
flex: 1;
margin-left: 20px;
font-size: 20px;
border: none;
outline: none;
}
.tweetBox__tweetButton {
background-color: var(--twitter-color);
border: none;
color: white;
font-weight: 900;
border-radius: 30px;
width: 80px;
height: 40px;
margin-top: 20px;
margin-left: auto;
}
.tweet {
display: flex;
margin-bottom: 4px;
border-bottom: 1px solid rgb(47, 51, 54);
cursor: pointer;
}
.tweet-author-image {
border-radius: 50%;
height: 48px;
width: 48px;
margin-right: 12px;
}
.tweet-feed-content {
margin-bottom: 15px;
padding-bottom: 12px;
}
.tweet-header {
display: flex;
font-size: 15px;
font-weight: 400;
}
.tweet-author-username {
font-family: 'Times New Roman', Times, serif;
/* color: rgb(231, 233, 234); */
}
.tweet-author-handle {
color: rgb(113, 118, 123);
}
.tweeted-time {
color: rgb(113, 118, 123);
}
.engagement-icons-ul {
display: flex;
list-style-type: none;
justify-content: space-between;
margin-left: -30px;
width: 400px;
}
<div class="container">
<div class="row">
<div class="col-3 navbar">
<nav>
<div class="left-sidebar">
<a class="navbar-brand" href="#">
<img src={ % static 'network/images/brand.svg' %} alt="Twitter logo" class="twitter-logo">
</a>
<ul class="nav flex-column left-sidebar-menu mb-4 mt-2">
<li class="nav-item">
<a class="nav-link" href="#">
<img src={ % static 'network/images/all-post.svg' %} alt="All post" class="left-sidebar-menu-icon"> All Post
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<img src={ % static 'network/images/following.svg' %} alt="Following" class="left-sidebar-menu-icon"> Following
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<img src={ % static 'network/images/notifications.svg' %} alt="Notifications" class="left-sidebar-menu-icon"> Notifications
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<img src={ % static 'network/images/messages.svg' %} alt="Messages" class="left-sidebar-menu-icon"> Messages
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<img src={ % static 'network/images/profile.svg' %} alt="Profile" class="left-sidebar-menu-icon"> Profile
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<img src={ % static 'network/images/more.svg' %} alt="More" class="left-sidebar-menu-icon"> More
</a>
</li>
<button class="btn btn-primary rounded-pill my-2 py-3">Tweet</button>
</ul>
</div>
</nav>
</div>
<div class="col-5">
<div class="main-page-header mt-3 sticky-top">Home</div>
<div class="main-page-input">
<!-- <form class="d-flex flex-column"> -->
<div class="row">
<div class="col-2 main-page-header-profile-picture">
<img src="https://i.pinimg.com/originals/a6/58/32/a65832155622ac173337874f02b218fb.png" class="main-page-header-profile-picture" alt="profile-picture" />
</div>
<div class="col-10">
<div class="main-page-input-box">
<div>
<textarea name="tweet-box" id="" class="form-control main-page-tweet-box text-wrap" cols="30" rows="10" placeholder="What's happening"></textarea>
<!-- <input type="text" class="form-control main-page-tweet-box text-wrap" id="exampleFormControlInput1" placeholder="What's happening"> -->
</div>
<div class="main-page-input-privacy pb-2 mt-3">
<i class="fas fa-globe-americas main-page-input-privacy-icon"></i>
<span class="ain-page-input-privacy-text ml-2">Everyone can reply</span>
</div>
</div>
<div class="main-page-input-icons mt-3">
<ul class="main-page-input-icons-ul">
<li><i class="fa-solid fa-image"></i></li>
<li><i class="fa-solid fa-square-poll-horizontal"></i></li>
<li><i class="fa-solid fa-face-grin"></i></li>
<li><i class="fa-regular fa-calendar"></i></li>
<li><i class="fa-solid fa-location-dot"></i></li>
</ul>
<button type="submit" class="btn btn-primary rounded-pill px-4 main-page-tweet-button"><strong>Tweet</strong></button>
</div>
</div>
</div>
<!-- </form> -->
</div>
<div class="tweet-feed">
<div class="tweet">
<img src="http://placeimg.com/140/140/people" alt="author profile picture" class="tweet-author-image" />
<div class="tweet-feed-content">
<div class="tweet-header">
Nick Huber
<div class="tweet-author-handle">#sweatystartup</div>
<div class="tweeted-time">8h</div>
</div>
<div class="tweet-content">
<div class="tweet-created-content">It is a wonderful day</div>
</div>
<div class="engagement-icons">
<ul class="engagement-icons-ul">
<li><i class="fa-regular fa-comment"></i></li>
<li><i class="fa-solid fa-retweet"></i></li>
<li><i class="fa-regular fa-heart"></i></li>
<li><i class="fa-solid fa-arrow-up-from-bracket"></i></li>
</ul>
</div>
</div>
</div>
<div class="tweet">
<img src="http://placeimg.com/140/140/animals" alt="author profile picture" class="tweet-author-image" />
<div class="tweet-feed-content">
<div class="tweet-header">
Randall
<div class="tweet-author-handle">#RandallKanna</div>
<div class="tweeted-time">18h</div>
</div>
<div class="tweet-content">
<div class="tweet-created-content">Hey friends</div>
<img src="http://placeimg.com/300/300/tech" alt="tweeter feed" />
</div>
</div>
</div>
</div>
</div>
<div class="col-4">
TODO
</div>
</div>
</div>
I wanted the feature-list div on the next lint of image-computer but only at width 768px it doesn't go on the next line. For better understanding I have attached screenshot of desired result an actual result photo for reference. Please give me a better solution for this.
body {
background-image: url("images/bg-header-desktop.png");
background-size: contain;
background-repeat: no-repeat;
font-size: 18px;
font-family: 'Bai Jamjuree', sans-serif;
padding: 9% 0 0 0;
line-height: 1.5;
margin: 0;
}
p {
color: hsl(201, 11%, 66%);
}
h1,
h3,
h5,
h2 {
color: hsl(210, 10%, 33%);
font-weight: 600;
}
button {
margin-top: 1.25rem;
}
.btn-ios {
border: 0;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 25px;
color: #FFFFFF;
font-size: 18px;
font-weight: 100;
padding: 10px 35px;
background-color: #26BAA4;
-webkit-box-shadow: -1px 7px 15px -3px #35D9BD;
-moz-box-shadow: -1px 7px 15px -3px #35D9BD;
box-shadow: -1px 7px 15px -3px #35D9BD;
text-decoration: none;
display: inline-block;
cursor: pointer;
text-align: center;
}
.btn-ios:hover {
background: #35D9BD;
border: solid #35D9BD 0;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 25px;
text-decoration: none;
}
.btn-mac {
border: 0;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 25px;
color: #FFFFFF;
font-size: 18px;
font-weight: 100;
padding: 10px 35px;
background-color: #6173FF;
-webkit-box-shadow: -1px 7px 15px -3px #7585FC;
-moz-box-shadow: -1px 7px 15px -3px #7585FC;
box-shadow: -1px 7px 15px -3px #7585FC;
text-decoration: none;
display: inline-block;
cursor: pointer;
text-align: center;
}
.btn-mac:hover {
background: #7585FC;
border: solid #7585FC 0;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 25px;
text-decoration: none;
}
.ios {
text-align: right;
}
.mac {
text-align: left;
}
.snippets {
margin-top: 5rem;
}
footer {
background-color: #f2f2f2;
margin-top: 5rem;
padding: 0 10%;
}
/* title */
#title {
text-align: center;
}
.para {
padding: 1% 24%;
}
.logo {
margin-bottom: 2.75rem;
}
/* features */
#features {
margin-top: 4rem;
}
.feature-list {
padding-left: 1rem;
padding-right: 17%;
}
.feature-list-div {
}
.center-feature {
text-align: center;
}
.clipboard {
margin-top: 8rem;
}
.image-computer {
position: relative;
right: 30px;
width: 93%;
}
.image-devices {
margin: 6rem auto 0 auto;
display: block;
width: 80%;
}
.feature-second {
text-align: center;
padding: 3% 10% 10% 10%;
}
.sponsers {
text-align: center;
padding: 0 10% 10% 10%;
}
/* cta */
#cta {
text-align: center;
}
/* footer */
.footer-logo {
width: 45%;
}
.footer-row {
padding-top: 3rem;
padding-bottom: 3rem;
}
.link {
text-decoration: none;
color: hsl(210, 10%, 33%);
}
.link:hover {
color: hsl(171, 66%, 44%);
}
.first-footer {
margin-bottom: 1.2rem;
display: block;
}
.social-icon {
text-align: right;
padding-top: 2rem;
}
.fb-icon:hover,
.twitter-icon:hover,
.insta-icon:hover {
color: hsl(171, 66%, 44%);
}
.fb-icon {
margin-right: 1rem;
}
.twitter-icon {
margin-right: 1rem;
}
.attribution {
font-size: 11px;
text-align: center;
margin-bottom: 0;
position: relative;
bottom: 5px;
}
.attribution a {
color: hsl(228, 45%, 44%);
}
#media (max-width: 970px) {
.feature-list{
padding-right: 10%;
}
}
#media (max-width: 768px) {
.feature-list{
text-align: center;
}
.image-computer{
text-align: center;
display: block;
position: static;
margin: auto;
width: 100%;
}
}
#media (max-width: 376px) {
body {
padding: 25% 12% 0 12%;
}
.para {
padding: 1rem 0 0 0;
}
.ios {
text-align: center;
}
.mac {
text-align: center;
}
}
<body>
<section id="title">
<img class="logo" src="images/logo.svg" alt="logo">
<h1 class="heading">A history of everything you copy</h1>
<p class="para">Clipboard allows you to track and organize everything you copy. Instantly access your clipboard on all your devices.</p>
<div class="container-fluid">
<div class="row">
<div class="col ios">
<button class="btn-ios" type="button" name="button">Download for iOS</button>
</div>
<div class="col mac">
<button class="btn-mac" type="button" name="button">Download for Mac</button>
</div>
</div>
</div>
<h1 class="snippets">Keep track of your snippets</h1>
<p class="para">Clipboard instantly stores any item you copy in the cloud,
meaning you can access your snippets immediately on all your devices. Our Mac and iOS apps will help you organize everything.</p>
</section>
<section id="features">
<div class="container-fluid">
<div class="row imac g-0">
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12">
<img class="image-computer" src="images/image-computer.png" alt="image-computer">
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 feature-list">
<div class="feature-list-div">
<h3>Quick Search</h3>
<p>Easily search your snippets by content, category, web address, application, and more.</p>
<h3>iCloud Sync</h3>
<p>Instantly saves and syncs snippets across all your devices.</p>
<h3>Complete History</h3>
<p>Retrieve any snippets from the first moment you started using the app.</p>
</div>
</div>
</div>
</div>
<h1 class="center-feature clipboard">Access Clipboard anywhere</h1>
<p class="center-feature para">Whether you’re on the go, or at your computer, you can access all your Clipboard snippets in a few simple clicks.</p>
<img class="image-devices" src="images/image-devices.png" alt="image-devices">
<h3 class="center-feature">Supercharge your workflow</h3>
<p class="center-feature para">We’ve got the tools to boost your productivity.</p>
<div class="container-fluid feature-second">
<div class="row">
<div class="col">
<img class="icon-feature" src="images/icon-blacklist.svg" alt="icon-blacklist">
<h5>Create blacklists</h5>
<p>Ensure sensitive information never makes its way to your clipboard by excluding certain sources.</p>
</div>
<div class="col">
<img class="icon-feature" src="images/icon-text.svg" alt="icon-text">
<h5>Plain text snippets</h5>
<p>Remove unwanted formatting from copied text for a consistent look.</p>
</div>
<div class="col">
<img class="icon-feature" src="images/icon-preview.svg" alt="icon-preview">
<h5>Sneak preview</h5>
<p>Quick preview of all snippets on your Clipboard for easy access.</p>
</div>
</div>
</div>
</section>
<div class="container-fluid sponsers">
<div class="row">
<div class="col-sm">
<img class="google" src="images/logo-google.png" alt="logo-google">
</div>
<div class="col-sm">
<img class="ibm" src="images/logo-ibm.png" alt="logo-ibm">
</div>
<div class="col-sm">
<img class="microsoft" src="images/logo-microsoft.png" alt="logo-microsoft">
</div>
<div class="col-sm">
<img class="hp" src="images/logo-hp.png" alt="logo-hp">
</div>
<div class="col-sm">
<img class="vector-graphics" src="images/logo-vector-graphics.png" alt="logo-vector-graphics">
</div>
</div>
</div>
<section id="cta">
<h2>Clipboard for iOS and Mac OS</h2>
<p class="para">Available for free on the App Store. Download for Mac or iOS, sync with iCloud and you’re ready to start adding to your clipboard.</p>
<div class="container-fluid">
<div class="row">
<div class="col ios">
<button class="btn-ios" type="button" name="button">Download for iOS</button>
</div>
<div class="col mac">
<button class="btn-mac" type="button" name="button">Download for Mac</button>
</div>
</div>
</div>
</section>
<footer>
<div class="container-fluid">
<div class="row footer-row">
<div class="col">
<img class="footer-logo" src="images/logo.svg" alt="logo">
</div>
<div class="col">
<a class="first-footer link" href="#">FAQs</a>
<a class="link" href="#">Contact Us</a>
</div>
<div class="col">
<a class="first-footer link" href="#">Privacy Policy</a>
<a class="link" href="#">Press Kit</a>
</div>
<div class="col">
<a class="link" href="#">Install Guide</a>
</div>
<div class="col social-icon">
<i class="fab fa-facebook-square fb-icon fa-2x"></i>
<i class="fab fa-twitter twitter-icon fa-2x"></i>
<i class="fab fa-instagram insta-icon fa-2x"></i>
</div>
</div>
</div>
<p class="attribution">
Challenge by Frontend Mentor.
Coded by Mohak Goel.
</p>
</footer>
</body>
this is actual result screenshot
this is desired result screenshot
If you want your columns on smaller displays to be the full width of the display, use col-12 without a size. Then pick your width to switch to two columns half the width of the display and add the appropriate class as in col-md-6. That will give you one full width column from a smartphone up to a tablet (767px wide). On anything larger (more than 767px wide), you would have two columns, each half the display width.
<div class="container-fluid">
<div class="row imac g-0">
<div class="col-12 col-md-6">
<img class="image-computer" src="images/image-computer.png" alt="image-computer">
</div>
<div class="col-12 col-md-6 feature-list">
<div class="feature-list-div">
<h3>Quick Search</h3>
<p>Easily search your snippets by content, category, web address, application, and more.</p>
<h3>iCloud Sync</h3>
<p>Instantly saves and syncs snippets across all your devices.</p>
<h3>Complete History</h3>
<p>Retrieve any snippets from the first moment you started using the app.</p>
</div>
</div>
</div>
</div>
If you want your columns on smaller displays to be side-by-side and one column on wider (768px or more) displays, then you could use col-6 col-md-12
<div class="container-fluid">
<div class="row imac g-0">
<div class="col-6 col-md-12">
<img class="image-computer" src="images/image-computer.png" alt="image-computer">
</div>
<div class="col-6 col-md-12 feature-list">
<div class="feature-list-div">
<h3>Quick Search</h3>
<p>Easily search your snippets by content, category, web address, application, and more.</p>
<h3>iCloud Sync</h3>
<p>Instantly saves and syncs snippets across all your devices.</p>
<h3>Complete History</h3>
<p>Retrieve any snippets from the first moment you started using the app.</p>
</div>
</div>
</div>
</div>
I'm developing my portfolio with Bootstrap 4 and I'm having problems with the works section. When testing in mobile size, the works section overlaps the contact section.
What's the reason? What's the solution? I know it has something to do with Bootstrap's flex behavior, but I've done my research and can't quite find the problem.
Thanks in advance.
/*
* Pablo Herrero's portfolio | Made with love by Pablo Herrero | pabloherrero.me
* Copyright 2020 Pablo Herrero | MIT License
*/
/* Fonts */
#font-face {
font-family: 'fira_coderegular';
src: url('fonts/firacode-regular-webfont.woff2') format('woff2'), url('fonts/firacode-regular-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: 'fira_codebold';
src: url('fonts/firacode-bold-webfont.woff2') format('woff2'), url('fonts/firacode-bold-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: 'fira_codemedium';
src: url('fonts/firacode-medium-webfont.woff2') format('woff2'), url('fonts/firacode-medium-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
/* General */
body {
position: relative;
font-family: 'fira_coderegular';
letter-spacing: normal;
overflow-y: scroll;
background-color: #ffffff;
}
body::-webkit-scrollbar {
display: none;
}
/* Navbar */
#navbar {
min-height: 56px;
background-color: transparent;
border-bottom: none;
}
#navbar .navbar-toggler {
color: #000000;
}
#navbar .navbar-toggler:focus {
outline: none;
}
#h {
font-size: 28px;
font-family: 'fira_codebold';
text-align: center;
color: #000000;
outline: none;
}
#navbar .nav-link {
font-size: 14px;
font-family: 'fira_codemedium';
padding: 1rem 1.5rem;
text-align: center;
color: #ffffff;
background-color: #000000;
outline: none;
}
#navbar .nav-link:hover {
color: #bd93f9;
outline: none;
}
#navbar .nav-link.active {
color: #50fa7b;
outline: none;
}
#navbar #h:hover {
color: #bd93f9;
outline: none;
}
#navbar #h:active {
color: #50fa7b;
outline: none;
}
#media (min-width: 992px) {
#h {
font-size: 32px;
}
#navbar .nav-link {
font-size: 16px;
padding: 0.5rem 0rem 0.5rem 3rem;
color: #000000;
background-color: transparent;
}
}
/* Header */
#header {
width: 100%;
height: 100vh;
}
#header .container {
min-height: 100%;
min-height: 100vh;
align-items: center;
}
#header .col-sm-12 {
text-align: center;
}
#header #headerPhoto {
text-align: center;
max-width: 100%;
}
#header h1 {
margin: 50px 0px 0px 0px;
width: 100%;
text-align: center;
text-transform: uppercase;
font-family: 'fira_codebold';
font-size: 64px;
line-height: 3.3rem;
letter-spacing: 0.05rem;
}
#header h2 {
margin: 15px 0px 0px 0px;
width: 100%;
text-align: center;
text-transform: uppercase;
font-family: 'fira_codemedium';
font-size: 32px;
letter-spacing: 0.05rem;
}
#media (min-width: 992px) {
#header #headerPhoto {
max-width: 35%;
}
#header h1 {
margin: 25px 0px 0px 0px;
font-size: 72px;
line-height: 3.3rem;
letter-spacing: 0.05rem;
}
#header h2 {
margin: 15px 0px 0px 0px;
font-size: 36px;
letter-spacing: 0.05rem;
}
}
/* About */
#about {
width: 100%;
height: 100vh;
}
#about .container {
min-height: 100%;
min-height: 100vh;
align-items: center;
}
#about .row {
background-color: #000000;
padding: 5vh 0vh 5vh 0vh;
margin: 1vh 0vh 1vh 0vh;
}
#about h2 {
width: 100%;
text-align: left;
margin-bottom: 30px;
font-family: 'fira_codemedium';
font-size: 32px;
color: #ffffff;
letter-spacing: 0.05rem;
}
#about p {
width: 100%;
text-align: left;
font-family: 'fira_coderegular';
font-size: 16px;
color: #ffffff;
}
#media (min-width: 992px) {
#about .row {
background-color: #000000;
padding: 15vh 10vh 15vh 10vh;
margin: 1vh 0vh 1vh 0vh;
}
#about h2 {
text-align: left;
margin-bottom: 30px;
font-size: 36px;
}
#about p {
text-align: left;
font-size: 18px;
}
}
/* Works */
#works {
width: 100%;
height: 100vh;
}
#works .container {
min-height: 100%;
min-height: 100vh;
align-items: center;
}
#works .col-sm-4 {
height: 35vh;
background-color: #000000;
border: 3vh solid white;
}
#works h2 {
width: 100%;
text-align: center;
margin-bottom: 30px;
font-family: 'fira_codemedium';
font-size: 32px;
color: #000000;
letter-spacing: 0.05rem;
}
#works h3 {
width: 100%;
padding-top: 10px;
text-align: left;
font-family: 'fira_codemedium';
font-size: 26px;
color: #ffffff;
letter-spacing: 0.05rem;
}
#works p {
text-align: left;
font-family: 'fira_coderegular';
font-size: 16px;
color: #ffffff;
}
#works .col-sm-4 i {
font-size: 16px;
color: #ffffff;
}
#works hr {
border-color: #ffffff;
}
#works a,
#works a i {
color: #000000;
text-decoration: unset;
}
#works h3:hover {
color: #bd93f9;
}
#works h3:active {
color: #50fa7b;
outline: none;
}
#works a:hover {
color: #bd93f9;
}
#works a:active {
color: #50fa7b;
outline: none;
}
#media (min-width: 992px) {
#works h2 {
text-align: center;
margin-bottom: 30px;
font-size: 36px;
}
#works h3 {
text-align: left;
font-size: 30px;
}
#works p {
text-align: left;
font-size: 18px;
}
#works i {
font-size: 18px;
}
}
/* Contact */
#contact {
width: 100%;
height: 100vh;
}
#contact .container {
min-height: 100%;
min-height: 100vh;
}
#contact h2 {
width: 100%;
text-align: center;
margin-bottom: 30px;
font-family: 'fira_codemedium';
font-size: 32px;
color: #000000;
letter-spacing: 0.05rem;
}
#contactForm input,
#contactForm textarea,
#contactForm button {
background-color: #000000;
border-radius: 0%;
}
#contactForm input::placeholder,
#contactForm textarea::placeholder,
#contactForm button {
color: white;
font-size: 16px;
}
#contactForm button:hover {
color: #bd93f9;
}
#contactForm button:active {
color: #50fa7b;
outline: none;
}
#media (min-width: 992px) {
#contact h2 {
font-size: 36px;
}
#contactForm input::placeholder,
#contactForm textarea::placeholder,
#contactForm button {
color: white;
font-size: 18px;
}
}
/* Footer */
#footer {
position: fixed;
bottom: 0;
width: 100%;
padding-bottom: 5px;
background-color: transparent;
color: #000000;
text-align: center;
}
#footer #social a {
font-size: 14px;
color: #000000;
}
#footer #social i:hover {
color: #bd93f9;
}
#footer #social i:active {
color: #50fa7b;
outline: none;
}
#footer small {
font-size: 14px;
}
#media (min-width: 992px) {
#footer #copy {
float: left;
}
#footer #social a {
font-size: 21px;
float: right;
padding: 0.5rem 0rem 0.5rem 2.5rem;
}
#footer small {
font-size: 16px;
}
}
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="I'm a developer. Here I show my evolution, my work and my passion.">
<meta name="author" content="Pablo Herrero">
<title>Pablo Herrero | Developer | pabloherrero.me</title>
<!-- Bootstrap style sheet -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.min.css">
<!-- Custom styles -->
<link rel="stylesheet" href="css/style.css">
<!-- Touch icons -->
</head>
<body id="top">
<!-- Navbar -->
<nav id="navbar" class="navbar navbar-expand-lg navbar-light fixed-top">
<a class="navbar-brand" href="#top">
<div id="h" class="align-self-center">H</div>
</a>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div id="navbarResponsive" class="collapse navbar-collapse">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="#about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#works">Works</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Contact</a>
</li>
</ul>
</div>
</nav>
<!-- Header -->
<header id="header">
<div class="container d-flex flex-column justify-content-center align-items-center">
<div class="row align-items-center">
<div class="col-sm-12">
<img src="img/pabloHerrero.jpg" alt="Pablo Herrero" id="headerPhoto">
</div>
<div class="col-sm-12">
<h1>Pablo Herrero</h1>
</div>
<div class="col-sm-12">
<h2>lore ipsum</h2>
</div>
</div>
</div>
</header>
<!-- About -->
<section id="about">
<div class="container d-flex flex-column justify-content-center align-items-center">
<div class="row">
<div class="col-sm-12 align-self-center">
<h2>Hi! I'm a developer.</h2>
</div>
<div class="col-sm-12 align-self-center">
<p>I learned to code in 2019 when I started my studies on development. I'm confortable using Java, SQL, HTML5, CSS3, Bootstrap 4 and GIT, although I'm always digging deep and learning new things. I'm currently working on JDBC, Swing, Android Studio,
JavaScript and Python, and will start soon with TypeScript, Node.js and Angular. Here you can take a look at my projects and drop me a line with the contact form if you wish.</p>
</div>
</div>
</div>
</section>
<!-- Works -->
<section id="works">
<div class="container d-flex flex-column justify-content-center">
<div>
<h2>Works</h2>
</div>
<div class="row">
<div class="col-sm-4 align-self-center">
<a href="http://" target="_blank">
<h3>Addicted Dev Bot</h3>
<hr>
<div>
<i class="fab fa-js"></i>
<i class="fab fa-node"></i>
</div>
<p>Node.js Twitter bot.</p>
</a>
</div>
<div class="col-sm-4 align-self-center">
<a href="http://" target="_blank">
<h3>Addicted Dev Bot</h3>
<hr>
<div>
<i class="fab fa-js"></i>
<i class="fab fa-node"></i>
</div>
<p>Node.js Twitter bot.</p>
</a>
</div>
<div class="col-sm-4 align-self-center">
<a href="http://" target="_blank">
<h3>Addicted Dev Bot</h3>
<hr>
<div>
<i class="fab fa-js"></i>
<i class="fab fa-node"></i>
</div>
<p>Node.js Twitter bot.</p>
</a>
</div>
</div>
<div class="row">
<div class="col-sm-4 align-self-center">
<a href="http://" target="_blank">
<h3>Addicted Dev Bot</h3>
<hr>
<div>
<i class="fab fa-js"></i>
<i class="fab fa-node"></i>
</div>
<p>Node.js Twitter bot.</p>
</a>
</div>
<div class="col-sm-4 align-self-center">
<a href="http://" target="_blank">
<h3>Addicted Dev Bot</h3>
<hr>
<div>
<i class="fab fa-js"></i>
<i class="fab fa-node"></i>
</div>
<p>Node.js Twitter bot.</p>
</a>
</div>
<div class="col-sm-4 align-self-center">
<a href="http://" target="_blank">
<h3>Addicted Dev Bot</h3>
<hr>
<div>
<i class="fab fa-js"></i>
<i class="fab fa-node"></i>
</div>
<p>Node.js Twitter bot.</p>
</a>
</div>
</div>
<div>
More on my GitHub <i class="fab fa-github"></i>
</div>
</div>
</section>
<!-- Contact -->
<section id="contact">
<div class="container d-flex flex-column justify-content-center">
<div>
<h2>Contact</h2>
</div>
<form id="contactForm" action="https://getsimpleform.com/messages?form_api_token=82ef8c01a157ab94e750cd5fa275f2ce" method="post" class="form" role="form" autocomplete="off">
<div class="form-group">
<input type="text" class="form-control" id="formName" aria-describedby="name" placeholder="Name" required="">
</div>
<div class="form-group">
<input type="email" class="form-control" id="formMail" aria-describedby="email" placeholder="Email" required="">
</div>
<div class="form-group">
<textarea class="form-control" id="formText" rows="10" placeholder="Your message" required=""></textarea>
</div>
<button type="submit" class="btn float-left">Submit</button>
</form>
</div>
</section>
<!-- Footer -->
<footer id="footer">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-6 align-self-center">
<small id="copy">© 2020 Pablo Herrero</small>
</div>
<div class="col-sm-12 col-md-6 col-lg-6 align-self-center">
<div id="social">
<i class="fab fa-twitter"></i>
<i class="fab fa-dev"></i>
<i class="fab fa-stack-overflow"></i>
<i class="fab fa-github"></i>
<i class="fab fa-linkedin"></i>
</div>
</div>
</div>
</div>
</footer>
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/121886ca53.js" crossorigin="anonymous"></script>
<!-- jQuery -->
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<!-- Popper.js -->
<script src="node_modules/#popperjs/core/dist/umd/popper.min.js"></script>
<!-- Bootstrap js -->
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<!-- Own script -->
<script src="js/app.js"></script>
</body>
</html>
Change the height of <section id="works"> from "height:100vh" to "min-height:100vh"
Reason:
Work section's height was fixed to 100vh while in mobile view all the boxes come in vertical direction and the height exceeds the 100vh. As a result it is occupying the space of next section also.
By adding the overflow-hidden class simply solve this problem, but you can also write in an external CSS file!
/*
* Pablo Herrero's portfolio | Made with love by Pablo Herrero | pabloherrero.me
* Copyright 2020 Pablo Herrero | MIT License
*/
/* Fonts */
#font-face {
font-family: 'fira_coderegular';
src: url('fonts/firacode-regular-webfont.woff2') format('woff2'), url('fonts/firacode-regular-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: 'fira_codebold';
src: url('fonts/firacode-bold-webfont.woff2') format('woff2'), url('fonts/firacode-bold-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: 'fira_codemedium';
src: url('fonts/firacode-medium-webfont.woff2') format('woff2'), url('fonts/firacode-medium-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
/* General */
body {
position: relative;
font-family: 'fira_coderegular';
letter-spacing: normal;
overflow-y: scroll;
background-color: #ffffff;
}
body::-webkit-scrollbar {
display: none;
}
/* Navbar */
#navbar {
min-height: 56px;
background-color: transparent;
border-bottom: none;
}
#navbar .navbar-toggler {
color: #000000;
}
#navbar .navbar-toggler:focus {
outline: none;
}
#h {
font-size: 28px;
font-family: 'fira_codebold';
text-align: center;
color: #000000;
outline: none;
}
#navbar .nav-link {
font-size: 14px;
font-family: 'fira_codemedium';
padding: 1rem 1.5rem;
text-align: center;
color: #ffffff;
background-color: #000000;
outline: none;
}
#navbar .nav-link:hover {
color: #bd93f9;
outline: none;
}
#navbar .nav-link.active {
color: #50fa7b;
outline: none;
}
#navbar #h:hover {
color: #bd93f9;
outline: none;
}
#navbar #h:active {
color: #50fa7b;
outline: none;
}
#media (min-width: 992px) {
#h {
font-size: 32px;
}
#navbar .nav-link {
font-size: 16px;
padding: 0.5rem 0rem 0.5rem 3rem;
color: #000000;
background-color: transparent;
}
}
/* Header */
#header {
width: 100%;
height: 100vh;
}
#header .container {
min-height: 100%;
min-height: 100vh;
align-items: center;
}
#header .col-sm-12 {
text-align: center;
}
#header #headerPhoto {
text-align: center;
max-width: 100%;
}
#header h1 {
margin: 50px 0px 0px 0px;
width: 100%;
text-align: center;
text-transform: uppercase;
font-family: 'fira_codebold';
font-size: 64px;
line-height: 3.3rem;
letter-spacing: 0.05rem;
}
#header h2 {
margin: 15px 0px 0px 0px;
width: 100%;
text-align: center;
text-transform: uppercase;
font-family: 'fira_codemedium';
font-size: 32px;
letter-spacing: 0.05rem;
}
#media (min-width: 992px) {
#header #headerPhoto {
max-width: 35%;
}
#header h1 {
margin: 25px 0px 0px 0px;
font-size: 72px;
line-height: 3.3rem;
letter-spacing: 0.05rem;
}
#header h2 {
margin: 15px 0px 0px 0px;
font-size: 36px;
letter-spacing: 0.05rem;
}
}
/* About */
#about {
width: 100%;
height: 100vh;
}
#about .container {
min-height: 100%;
min-height: 100vh;
align-items: center;
}
#about .row {
background-color: #000000;
padding: 5vh 0vh 5vh 0vh;
margin: 1vh 0vh 1vh 0vh;
}
#about h2 {
width: 100%;
text-align: left;
margin-bottom: 30px;
font-family: 'fira_codemedium';
font-size: 32px;
color: #ffffff;
letter-spacing: 0.05rem;
}
#about p {
width: 100%;
text-align: left;
font-family: 'fira_coderegular';
font-size: 16px;
color: #ffffff;
}
#media (min-width: 992px) {
#about .row {
background-color: #000000;
padding: 15vh 10vh 15vh 10vh;
margin: 1vh 0vh 1vh 0vh;
}
#about h2 {
text-align: left;
margin-bottom: 30px;
font-size: 36px;
}
#about p {
text-align: left;
font-size: 18px;
}
}
/* Works */
#works {
width: 100%;
height: 100vh;
}
#works .container {
min-height: 100%;
min-height: 100vh;
align-items: center;
}
#works .col-sm-4 {
height: 35vh;
background-color: #000000;
border: 3vh solid white;
}
#works h2 {
width: 100%;
text-align: center;
margin-bottom: 30px;
font-family: 'fira_codemedium';
font-size: 32px;
color: #000000;
letter-spacing: 0.05rem;
}
#works h3 {
width: 100%;
padding-top: 10px;
text-align: left;
font-family: 'fira_codemedium';
font-size: 26px;
color: #ffffff;
letter-spacing: 0.05rem;
}
#works p {
text-align: left;
font-family: 'fira_coderegular';
font-size: 16px;
color: #ffffff;
}
#works .col-sm-4 i {
font-size: 16px;
color: #ffffff;
}
#works hr {
border-color: #ffffff;
}
#works a,
#works a i {
color: #000000;
text-decoration: unset;
}
#works h3:hover {
color: #bd93f9;
}
#works h3:active {
color: #50fa7b;
outline: none;
}
#works a:hover {
color: #bd93f9;
}
#works a:active {
color: #50fa7b;
outline: none;
}
#media (min-width: 992px) {
#works h2 {
text-align: center;
margin-bottom: 30px;
font-size: 36px;
}
#works h3 {
text-align: left;
font-size: 30px;
}
#works p {
text-align: left;
font-size: 18px;
}
#works i {
font-size: 18px;
}
}
/* Contact */
#contact {
width: 100%;
height: 100vh;
}
#contact .container {
min-height: 100%;
min-height: 100vh;
}
#contact h2 {
width: 100%;
text-align: center;
margin-bottom: 30px;
font-family: 'fira_codemedium';
font-size: 32px;
color: #000000;
letter-spacing: 0.05rem;
}
#contactForm input,
#contactForm textarea,
#contactForm button {
background-color: #000000;
border-radius: 0%;
}
#contactForm input::placeholder,
#contactForm textarea::placeholder,
#contactForm button {
color: white;
font-size: 16px;
}
#contactForm button:hover {
color: #bd93f9;
}
#contactForm button:active {
color: #50fa7b;
outline: none;
}
#media (min-width: 992px) {
#contact h2 {
font-size: 36px;
}
#contactForm input::placeholder,
#contactForm textarea::placeholder,
#contactForm button {
color: white;
font-size: 18px;
}
}
/* Footer */
#footer {
position: fixed;
bottom: 0;
width: 100%;
padding-bottom: 5px;
background-color: transparent;
color: #000000;
text-align: center;
}
#footer #social a {
font-size: 14px;
color: #000000;
}
#footer #social i:hover {
color: #bd93f9;
}
#footer #social i:active {
color: #50fa7b;
outline: none;
}
#footer small {
font-size: 14px;
}
#media (min-width: 992px) {
#footer #copy {
float: left;
}
#footer #social a {
font-size: 21px;
float: right;
padding: 0.5rem 0rem 0.5rem 2.5rem;
}
#footer small {
font-size: 16px;
}
}
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="I'm a developer. Here I show my evolution, my work and my passion.">
<meta name="author" content="Pablo Herrero">
<title>Pablo Herrero | Developer | pabloherrero.me</title>
<!-- Bootstrap style sheet -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.min.css">
<!-- Custom styles -->
<link rel="stylesheet" href="css/style.css">
<!-- Touch icons -->
</head>
<body id="top">
<!-- Navbar -->
<nav id="navbar" class="navbar navbar-expand-lg navbar-light fixed-top">
<a class="navbar-brand" href="#top">
<div id="h" class="align-self-center">H</div>
</a>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div id="navbarResponsive" class="collapse navbar-collapse">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="#about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#works">Works</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Contact</a>
</li>
</ul>
</div>
</nav>
<!-- Header -->
<header id="header">
<div class="container d-flex flex-column justify-content-center align-items-center">
<div class="row align-items-center">
<div class="col-sm-12">
<img src="img/pabloHerrero.jpg" alt="Pablo Herrero" id="headerPhoto">
</div>
<div class="col-sm-12">
<h1>Pablo Herrero</h1>
</div>
<div class="col-sm-12">
<h2>lore ipsum</h2>
</div>
</div>
</div>
</header>
<!-- About -->
<section id="about">
<div class="container d-flex flex-column justify-content-center align-items-center">
<div class="row">
<div class="col-sm-12 align-self-center">
<h2>Hi! I'm a developer.</h2>
</div>
<div class="col-sm-12 align-self-center">
<p>I learned to code in 2019 when I started my studies on development. I'm confortable using Java, SQL, HTML5, CSS3, Bootstrap 4 and GIT, although I'm always digging deep and learning new things. I'm currently working on JDBC, Swing, Android Studio,
JavaScript and Python, and will start soon with TypeScript, Node.js and Angular. Here you can take a look at my projects and drop me a line with the contact form if you wish.</p>
</div>
</div>
</div>
</section>
<!-- Works -->
<section id="works" class="overflow-hidden">
<div class="container d-flex flex-column justify-content-center">
<div>
<h2>Works</h2>
</div>
<div class="row">
<div class="col-sm-4 align-self-center">
<a href="http://" target="_blank">
<h3>Addicted Dev Bot</h3>
<hr>
<div>
<i class="fab fa-js"></i>
<i class="fab fa-node"></i>
</div>
<p>Node.js Twitter bot.</p>
</a>
</div>
<div class="col-sm-4 align-self-center">
<a href="http://" target="_blank">
<h3>Addicted Dev Bot</h3>
<hr>
<div>
<i class="fab fa-js"></i>
<i class="fab fa-node"></i>
</div>
<p>Node.js Twitter bot.</p>
</a>
</div>
<div class="col-sm-4 align-self-center">
<a href="http://" target="_blank">
<h3>Addicted Dev Bot</h3>
<hr>
<div>
<i class="fab fa-js"></i>
<i class="fab fa-node"></i>
</div>
<p>Node.js Twitter bot.</p>
</a>
</div>
</div>
<div class="row">
<div class="col-sm-4 align-self-center">
<a href="http://" target="_blank">
<h3>Addicted Dev Bot</h3>
<hr>
<div>
<i class="fab fa-js"></i>
<i class="fab fa-node"></i>
</div>
<p>Node.js Twitter bot.</p>
</a>
</div>
<div class="col-sm-4 align-self-center">
<a href="http://" target="_blank">
<h3>Addicted Dev Bot</h3>
<hr>
<div>
<i class="fab fa-js"></i>
<i class="fab fa-node"></i>
</div>
<p>Node.js Twitter bot.</p>
</a>
</div>
<div class="col-sm-4 align-self-center">
<a href="http://" target="_blank">
<h3>Addicted Dev Bot</h3>
<hr>
<div>
<i class="fab fa-js"></i>
<i class="fab fa-node"></i>
</div>
<p>Node.js Twitter bot.</p>
</a>
</div>
</div>
<div>
More on my GitHub <i class="fab fa-github"></i>
</div>
</div>
</section>
<!-- Contact -->
<section id="contact" class="overflow-hidden">
<div class="container d-flex flex-column justify-content-center">
<div>
<h2>Contact</h2>
</div>
<form id="contactForm" action="https://getsimpleform.com/messages?form_api_token=82ef8c01a157ab94e750cd5fa275f2ce" method="post" class="form" role="form" autocomplete="off">
<div class="form-group">
<input type="text" class="form-control" id="formName" aria-describedby="name" placeholder="Name" required="">
</div>
<div class="form-group">
<input type="email" class="form-control" id="formMail" aria-describedby="email" placeholder="Email" required="">
</div>
<div class="form-group">
<textarea class="form-control" id="formText" rows="10" placeholder="Your message" required=""></textarea>
</div>
<button type="submit" class="btn float-left">Submit</button>
</form>
</div>
</section>
<!-- Footer -->
<footer id="footer">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-6 align-self-center">
<small id="copy">© 2020 Pablo Herrero</small>
</div>
<div class="col-sm-12 col-md-6 col-lg-6 align-self-center">
<div id="social">
<i class="fab fa-twitter"></i>
<i class="fab fa-dev"></i>
<i class="fab fa-stack-overflow"></i>
<i class="fab fa-github"></i>
<i class="fab fa-linkedin"></i>
</div>
</div>
</div>
</div>
</footer>
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/121886ca53.js" crossorigin="anonymous"></script>
<!-- jQuery -->
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<!-- Popper.js -->
<script src="node_modules/#popperjs/core/dist/umd/popper.min.js"></script>
<!-- Bootstrap js -->
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<!-- Own script -->
<script src="js/app.js"></script>
</body>
</html>
I have a button near the bottom of the page that is centered. Additionally, I have three images that I centered by making each image a col-lg-2 with 3 empty columns in between each one. I cannot figure out why these two items don't line up nicely, and which one is the one that is off center.
https://codepen.io/colesam/full/OgamyB/
SCSS:
a {
color: $blue;
font-size: 1.4vw;
font-weight: 500;
line-height: 1.7vw;
transition: all 0.2s;
&:hover {
color: $orange;
font-size: 1.7vw;
cursor: pointer;
text-decoration: none;
}
&:focus {
color: $blue;
text-decoration: none;
&:hover {
color: $orange;
cursor: pointer;
}
}
}
body {
background: white;
color: $black;
font-family: 'Roboto', sans-serif;
font-weight: 300;
text-shadow: $text-shadow-light;
}
h2 {
font-size: 5vh;
margin-top: 5vh;
}
p {
font-size: 3vh;
letter-spacing: 2px;
margin-top: 3vh;
text-shadow: none;
}
.btn-next {
bottom: 0;
padding-bottom: 5vh;
position: absolute;
text-align: center;
transition: all 0.3s;
a {
font-size: 5vw;
&:hover {
font-size: 5.5vw;
}
}
}
.center-text {
text-align: center;
}
.left-text {
text-align: left;
}
.no-margin {
margin: 0;
}
.right-text {
text-align: right;
}
.title {
padding-left: 4vw;
h3 {
font-size: 3vw;
text-shadow: $text-shadow;
}
}
#portfolio-page {
min-height: 100vh;
position: relative;
}
h4 {
font-size: 2vw;
}
.active-item {
box-shadow: $box-shadow-o;
-moz-box-shadow: $box-shadow-o;
-webkit-box-shadow: $box-shadow-o;
}
.btn-portfolio {
padding-top: 20vh;
text-align: center;
transition: all 0.3s;
a {
font-size: 5vw;
&:hover {
font-size: 5.5vw;
}
}
}
#featured-content {
background: rgba(0, 0, 0, 0.1);
height: 65vh;
margin-top: 2vh;
padding: 3vh 0;
}
#featured-img img {
box-shadow: $box-shadow-light;
-moz-box-shadow: $box-shadow-light;
-webkit-box-shadow: $box-shadow-light;
}
#primary-featured {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
height: 45.5vh;
top: 10%;
}
#secondary-featured {
margin-top: 3vh;
}
HTML(inside a div.container):
<div id="portfolio-page">
<div class="row">
<div class="col-lg-4 col-lg-offset-4">
<h2 class="center-text">My Portfolio</h2>
<hr>
</div>
</div>
<div class="row">
<div class="col-lg-12" id="featured-content">
<div class="row no-margin">
<div class="col-lg-1 btn-portfolio" id="left-button">
<a><i class="glyphicon glyphicon-chevron-left"></i></a>
</div>
<div class="col-lg-8 col-lg-offset-1" id="primary-featured">
<div class="row">
<div class="col-lg-5" id="featured-img">
<img src="includes/img/headers.jpg" alt="A cluster of header images." class="img-responsive">
</div>
<div class="col-lg-6 col-lg-offset-1" class="center-text">
<h4 id="featured-title">Placeholder</h4>
<hr>
<p id="featured-description">Placeholder text.</p>
</div>
</div>
</div>
<div class="col-lg-1 col-lg-offset-1 btn-portfolio" id="right-button">
<a><i class="glyphicon glyphicon-chevron-right"></i></a>
</div>
<div class="col-lg-6 col-lg-offset-3" id="secondary-featured">
<div class="row">
<div class="col-lg-2" id="secondary-feature1">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
<div class="col-lg-2 col-lg-offset-3" id="secondary-feature2">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
<div class="col-lg-2 col-lg-offset-3" id="secondary-feature3">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
</div>
Edit: Your problem is with position: absolute on .btn-next.
For absolutely positioned elements
This property specifies the distance between the left margin edge of
the element and the left edge of its containing block.
You have margin-left: -15px, so it aligns to center with the margin-left: -15px.
How to fix:
Add this to .btn-next:
right: 0;
left: 0;
...or you can remove position: absolute from .btn-next.
Alternative option:
The "down arrow" at the bottom isn't centered, because it's in the row class and that class has margin-left: 15px and margin-right: 15px.
If you give it margin: 0px, it'll be fine.
Rename div class="row" to something else or give it another class like div class="row down".
Examples:
<div class="down">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
or
<div class="row down">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
CSS (only if using second option):
.row.down {
margin: 0px;
}