I've been having a hard time getting the hamburger menu to work onnce the screen size decreases to anything below 1200px. How can I get my list items to show up below my top nav bar?
This is what I have so far:
.mainBackground {
background-image: url('https://res.cloudinary.com/knaguibimages/image/upload/o_65/v1474765365/Background_p3qqpv.jpg');
background-repeat: no-repeat;
background-size: cover;
position: relative;
}
#media screen and (min-width: 1200px) {
.body-wrapper {
padding-left: 80px;
}
}
#media screen and (min-width: 1200px) {
.navbar {
width: 80px;
max-width: 80px;
position: fixed;
top: 0;
left: 0;
height: 100%;
border: 0;
border-radius: 0;
text-align: center;
}
}
.navbar {
z-index: 10000;
background: rgba(30, 30, 31, 0.85);
}
#media screen and (max-width: 1200px) {
.navbar-header {
float: left;
padding: 0 40px;
}
}
.navbar-brand {
padding: 50px 0 50px 25px;
float: left;
height: auto;
}
#media screen and (min-width: 1200px) {
.navbar-brand {
position: relative;
box-shadow: none;
margin: 12px 0;
}
}
ul li a span {
display: inline-block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
transition: 0.3s;
font-size: 17px;
}
.btn.responsive-menu {
display: none;
}
#media screen and (max-width: 1200px) {
.btn.responsive-menu {
margin: 45px 50px 0 0;
display: inline-block;
float: right;
}
}
.btn {
color: #0067b5;
background: none;
border: 2px solid;
-webkit-transition: all 200ms ease-in;
}
.current {
color: white;
}
section {
padding-top: 50px;
padding-left: 50px;
padding-right: 70px;
margin-bottom: 106px;
}
section .box {
padding: 50px;
background-color: rgba(0, 0, 0, 0.75);
}
.section-title {
margin-bottom: 20px;
font-size: 22px;
line-height: 28px;
color: white;
}
#aboutMe-responsive {
display: none;
}
#myPortfolio-responsive {
display: none;
}
#contactMe-responsive {
display: none;
}
#aboutMe {
padding: 0 50px 20px 0;
}
#myPortfolio {
padding: 0 50px 20px 0;
}
#contactMe {
padding: 0 50px 20px 0;
}
#media screen and (max-width: 1200px) {
#aboutMe {
display: none;
}
#myPortfolio {
display: none;
}
#contactMe {
display: none;
}
#aboutMe-responsive {
display: inline;
}
#myPortfolio-responsive {
display: inline;
}
#contactMe-responsive {
display: inline;
}
}
.frame {
position: relative;
border: 4px solid;
border-color: rgba(0, 0, 0, 0.5);
overflow: hidden;
margin: 0 0 15px 0;
}
p {
font-size: 15px;
line-height: 30px;
letter-spacing: 0.3px;
color: white;
}
<!--Navigation- Bar-->
<nav class="navbar navbar-default" role="navigation">
<!--Navbar header-->
<div class="navbar-header">
<!-- Logo -->
<div class="navbar-brand text-center">
<!-- <a href="#"> -->
<i id="home" class="fa fa-home fa-2x"></i>
<!-- </a> -->
</div>
</div>
<!--Hamburger menu-->
<a class="btn responsive-menu" data-toggle="collapse" data-target=".navbar-collapse">
<i id="hamburger-menu" class="fa fa-bars fa-2x"></i>
</a>
<!--Navbar Icon Section Navigation-->
<!-- Add "in" when you want to collapse nav bar -->
<div id="nav-section-selection" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<!--About Me-->
<li>
<a href="#about">
<i id="aboutMe" class="fa fa-user fa-2x current"></i>
<span id="aboutMe-responsive">ABOUT ME</span>
</a>
</li>
<!--Portfolio-->
<li>
<a href="#portfolio">
<i id="myPortfolio" class="fa fa-briefcase fa-2x"></i>
<span id="myPortfolio-responsive">MY WORK</span>
</a>
</li>
<!--Contact-->
<li>
<a href="#contact">
<i id="contactMe" class="fa fa-envelope-o fa-2x"></i>
<span id="contactMe-responsive">CONTACT ME</span>
</a>
</li>
</ul>
</div>
</nav>
<!--Page Content Starts Here-->
<div id="pageContent">
<!-- About Me Section -->
<section id="about" class="about-section">
<div class="box">
<h2 class="section-title">A Little About Myself</h2>
<div class="row">
<div class="col-md-5 col-md-push-7">
<figure class="frame">
<img class="img-responsive about-me-img" src="https://res.cloudinary.com/knaguibimages/image/upload/v1474765942/ProfilePic_bvn1gs.jpg" alt="Karim Naguib Profile Picture">
</figure>
</div>
<div class="col-md-7 col-md-pull-5">
<p>Hello! My name's Karim Naguib, and this page was developed to showcase my coding talent.</p>
<p>I graduated from the University of Waterloo in 2015, with a degree in Management Engineering.</p>
</div>
</div>
</div>
</section>
<!-- Portfolio Section -->
<section id="portfolio" class="portfolio-section">
<div class="box">
<h2 class="section-title">My Work</h2>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="contact-section">
<div class="box">
<h2 class="section-title">Get In Touch With Me</h2>
</div>
</section>
</div>
</div>
<!-- Footer -->
</body>
</html>
you should try this inside your navbar-header class:
<button type="button" class="navbar-toggle"
data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
Related
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'm building a dupe of the Twitter profile page but I noticed that every time I resize my browser all the text and images get jumbled together which makes the page look really messy. How do I get all the text and image to stay in the same place, relative to each other, and shrink proportionally when I resize my browser. I tried using percentages for widths and heights of divs but when I resized the browser the text line broke and some of the text spilled out of the divs and containers. I tried using vh instead of px but the containers became a lot thinner when I made the page smaller and I didn't like that. Does anyone have any solutions? I am using Bootstrap 4.0 by the way.
This is my html:
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>StanCafe - Hello!</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="profile.css">
<link href="https://fonts.googleapis.com/css2?family=Montserrat+Subrayada:wght#700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="https://kit.fontawesome.com/3b733e1950.js" crossorigin="anonymous"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light fixed-top">
<div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#"><i class="fas fa-home"></i> Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fas fa-star"></i> Snippets</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fas fa-bell"></i> Notifications</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fas fa-envelope"></i> Messages</a>
</li>
</ul>
<a class="navbar-brand" href="#"><i class="fas fa-coffee"></i></a>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search StanCafe" aria-label="Search" id="search">
</form>
<a class="btn btn-primary" href="#" id="publish-button">Publish</a>
</div>
</div>
</nav>
<header>
<div id="cover-photo-wrapper">
<img src="background-image-cropped.png" alt="background-image">
</div>
<div id="profile-photo-wrapper">
<div class="container">
<div class="row">
<div class="col-4">
<img src="profile-picture-cropped.png" id="profile-photo" alt="profile-picture">
</div>
<div class="col-6">
Posts<span>320</span>
Following<span>600</span>
Followers<span>900</span>
Cafes<span>8</span>
</div>
<div class="col-2">
<button type="button" class="btn btn-outline-primary" id="follow-button">Follow</button>
</div>
</div>
</div>
</div>
</header>
<div class="container">
<div class="row">
<div class="col-4" id="profile">
<hgroup>
<h1>Alya Tsarina</h1>
<h2>#allina</h2>
</hgroup>
<p>Jennie stan but go off lol</p>
<span id="location"><i class="fa fa-map-marker"></i> Moscow, Russia</span>
<span id="website"><i class="fa fa-link"></i> allina.com</span>
<span id="birthday"><i class="fas fa-birthday-cake"></i> Jan. 2020</span>
<a class="btn btn-primary" href="#" id="message-button">Message</a>
<a class="btn btn-primary" href="#" id="message-button">Edit Room</a>
<span><i class="fas fa-coffee"></i> Cafes you follow<span>
<div id="cafe-profile-photos">
<img src="https://via.placeholder.com/50x50" alt="cafe image">
<img src="https://via.placeholder.com/50x50" alt="cafe image">
<img src="https://via.placeholder.com/50x50" alt="cafe image">
<img src="https://via.placeholder.com/50x50" alt="cafe image">
<br />
<img src="https://via.placeholder.com/50x50" alt="cafe image">
<img src="https://via.placeholder.com/50x50" alt="cafe image">
<img src="https://via.placeholder.com/50x50" alt="cafe image">
<img src="https://via.placeholder.com/50x50" alt="cafe image">
</div>
</div>
<div class="col-8" id="posts">
<nav class="nav">
<a class="nav-link active" href="#">Posts</a>
<a class="nav-link" href="#">Room Gallery</a>
<a class="nav-link" href="#">Hearted</a>
</nav>
<article class="container">
<div class="row no-gutters">
<div class="col-1">
<img src="profile-picture-cropped.png" alt="profile-picture" class="profile-thumbnail">
</div>
<div class="col-11 post-body">
<span class="username-name">Alya Tsarina</span> <span class="username-handle">#allina</span>
<p>Ya'll BlackPink's album is gonna pop off so baaaad! The queens of kpop are rly coming.</p>
<nav>
<i class="fa fa-comment-o"></i> 217
<i class="fa fa-retweet"></i> 38
<i class="fa fa-heart-o"></i> 1, 278
</nav>
</div>
</div>
</article>
</div>
</div>
</div>
</body>
</html>
This is my CSS:
a, a:hover {
color: rgb(29,161,242);
}
body {
background-color: #E6ECF0;
}
.navbar {
background-color: white;
border-bottom: 1px solid #999;
}
.navbar-brand {
margin-left: 50%;
margin: 0px auto;
}
.navbar-brand i {
color:rgb(29,161,242);
}
#search {
background-color: #F5F8FA;
border-radius: 20px;
border: 1px solid #E6ECF0;
}
#search:focus {
background-color: white;
border: 2px solid rgb(29,161,242);
}
#publish-button {
background-color: rgb(29,161,242);
color: white;
border-radius: 20px;
border: none;
}
#publish-button:hover {
background-color: #329CC3
}
#cover-photo-wrapper {
height: 40vh;
overflow: hidden;
}
#cover-photo-wrapper img {
width: 100%;
}
#profile-photo-wrapper {
background-color: white;
border-bottom: 2px solid #CCC;
height: 60px;
position: relative;
}
#profile-photo {
width: 200px;
height: 200px;
border-radius: 100px;
border: 5px solid white;
position: absolute;
top: -110px;
}
.profile-stats {
float: left;
text-align: center;
width: 80px;
margin-top: 10px;
margin-left: 4px;
margin-right: 4px;
text-decoration: none;
color:#666;
font-size: 0.8em;
}
.profile-stats:hover {
text-decoration: none;
border-bottom: 2px solid rgb(29,161,242)
}
.profile-stats:hover span {
color: rgb(29,161,242);
}
.profile-stats span {
display: block;
margin: 0px auto;
font-size: 1.4em;
color: #444;
position: relative;
top: -4px;
}
#follow-button {
border-color: rgb(29,161,242);
color: rgb(29,161,242);
border-radius: 20px;
margin-top: 10px;
width: 100px;
font-weight: bold;
font-size: 0.8em;
}
#follow-button:hover {
background-color: #329CC3;
color: white;
}
#profile {
margin-top: 35px;
}
#profile h1 {
color: black;
font-size: 1.2em;
font-weight: bold;
}
#profile h2 {
font-size: 1em;
color: #333;
font-weight: normal;
position: relative;
top: -6px;
}
#profile p {
margin-top: 6px;
font-size: 0.9em;
}
#profile span {
display: block;
color: #333;
font-size: 0.9em;
margin-bottom: 4px;
}
#profile span .fa {
width: 15px;
}
#message-button {
background-color: rgb(29,161,242);
color: white;
border-radius: 20px;
border: none;
margin-top: 12px;
width: 100%;
margin-bottom: 12px;
}
#message-button:hover {
background-color: #329CC3
}
#cafe-profile-photos img {
border-radius: 25px;
margin-bottom: 4px;
}
#posts > nav {
margin-top: 10px;
background-color: white;
padding: 10px 0px;
border-bottom: 1px solid #E6ECF0;
}
#posts > nav a {
font-size: 1.2em;
font-weight: bold;
}
#posts > nav a.active {
color: #222;
}
#posts > nav a:hover {
text-decoration: underline;
}
#posts article {
background-color: #FFF;
border-bottom: 1px solid #E6ECF0;
padding: 15px;
}
#posts article:hover {
background-color: #F5F8FA;
}
#posts .profile-thumbnail {
height: 50px;
width: 50px;
border-radius: 25px;
}
#posts .post-body {
padding-left: 10px;
font-size: 0.9em;
}
#posts .post-username .username-name {
color: #333;
font-weight: bold;
}
#posts .post-username:hover {
text-decoration: none;
}
#posts .post-username:hover .username-name {
text-decoration: underline;
color: rgb(29,161,242);
}
#posts .post-username .username-handle {
color: #333;
font-weight: normal;
}
#posts .post-body nav a {
color: #657786;
padding: 0px 6px;
}
#posts .post-body nav a .fa {
margin-right: 5px;
}
#posts .post-body nav a:hover {
text-decoration: none;
color: rgb(29,161,242);
}
Fullscreen website
Resized website
Bootstrap4 came with many classes for viewport specific styling. You should also learn more about media query, which will help you to give styles to specific device width.
note :I havent gone through entire code thoroughlly
inorder to make it responsive try giving values in %.also try to use media query
eg:
#media only screen and (max-width: 600px) {
body {
background-color: lightblue;
}
}
or
/* For desktop: */
.col-1 {width: 8.33%;}
.col-2 {width: 16.66%;}
.col-3 {width: 25%;}
.col-4 {width: 33.33%;}
.col-5 {width: 41.66%;}
.col-6 {width: 50%;}
.col-7 {width: 58.33%;}
.col-8 {width: 66.66%;}
.col-9 {width: 75%;}
.col-10 {width: 83.33%;}
.col-11 {width: 91.66%;}
.col-12 {width: 100%;}
#media only screen and (max-width: 768px) {
/* For mobile phones: */
[class*="col-"] {
width: 100%;
}
}
I'm trying to remove the white space at the bottom and right side of the website. On the right side it seems that it's caused by the black navbar but I don't have a clue how to fix it.
/* Navbar */
.navbar-default {
background-color: transparent;
border-color: transparent;
}
.navbar-fixed-top .navbar-brand,
.navbar-fixed-top .navbar-nav>li>a {
color: #fff;
}
.navbar-default .navbar-toggle {
border-color: #000;
}
.navbar-default .navbar-toggle:focus,
.navbar-default .navbar-toggle:hover {
background-color: #fff;
}
.navbar-default .navbar-toggle,
.navbar-default .navbar-toggle {
background-color: transparent;
}
.navbar-fixed-top.scrolled {
background: black;
}
.navbar-toggle {
position: relative;
float: right;
padding: 9px 10px;
margin-top: 8px;
margin-right: 15px;
margin-bottom: 8px;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
.non-underline {
text-decoration: none;
}
.navbar-fixed-top .navbar-brand,
.navbar-fixed-top .navbar-nav>li>a {
color: #fff!important;
}
.navbar-fixed-top .navbar-brand,
.navbar-fixed-top .navbar-nav>li>a:hover {
text-decoration: underline;
background-color: transparent;
color: #fff!important;
}
.navbar-nav>li>a:focus,
.navbar-nav>li>a:active,
.navbar-nav>li>a.active {
background-color: transparent;
color: #fff!important;
}
#logo-img {
width: 70%;
}
/* End Navbar */
/* Jumbotron */
#first {
padding: 0;
}
.jumbotron-image {
max-width: 100%;
height: auto;
}
h2>a {
color: #565656;
}
a:hover {
text-decoration: none;
}
#h1first {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #FFF;
font-family: 'Philosopher', sans-serif;
}
/* End Jumbotron */
/* About */
#abouth2 {
visibility: hidden;
}
#about-section {
padding-top: 8%;
padding-bottom: 10%;
}
.fadeInBlock {
opacity: 0;
}
#p-about {
font-size: 180%;
font-family: 'Raleway', sans-serif;
}
#img-about {
padding: 0;
}
/*End About*/
/*Portfolio*/
#portfolio-section {
background-color: ;
background: #B5927E;
background: -webkit-linear-gradient(left top, #B5927E, #6C5461);
background: -o-linear-gradient(bottom right, #B5927E, #6C5461);
background: -moz-linear-gradient(bottom right, #B5927E, #6C5461);
background: linear-gradient(to bottom right, #B5927E, #6C5461);
padding-top: 2%;
padding-bottom: 10%;
}
.headline {
font-family: 'Merriweather', serif;
color: #484A4A;
}
.headline.fadeInBlock>a {
color: #484A4A;
}
.headline.fadeInBlock>a:hover {
color: #484A4A;
}
#portfolio-id {
margin-bottom: 2%;
}
/*End Portfolio*/
/*Contact*/
#contact-section {
background-color: #4D3C4F;
padding-top: 2%;
padding-bottom: 5%;
}
.social-icons {
color: #b7b7b7;
}
.fa {
font-size: 40px;
padding: 20px;
transition: 0.5s;
}
.fa-facebook-official {
vertical-align: middle;
margin: auto;
}
.fa-twitter {
vertical-align: middle;
margin: auto;
}
.fa-free-code-camp {
vertical-align: middle;
margin: auto;
}
.fa-envelope {
vertical-align: middle;
margin: auto;
}
#facebook:hover {
color: #3b5998;
}
#twitter:hover {
color: #00aced;
}
#fcc:hover {
color: #006401;
}
#email:hover {
color: #92b8f4;
}
ul {
list-style: none;
}
/*End Contact*/
/*Footer*/
footer {
background-color: #382F4A;
}
#copy {
color: #FFFFFF;
}
/*End Footer*/
<!--Navbar-->
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand"><img src="http://i64.tinypic.com/27wy82r.png" id="logo-img"></a>
<a class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav pull-right">
<li>Home</li>
<li>About</li>
<li>Portfolio</li>
<li>Contact</li>
</ul>
</div>
</div>
</div>
<!--End Navbar-->
<!--Jumbotron-->
<div class="row">
<div class="col-md-12">
<div class="jumbotron" id="first" href="#home">
<img class="jumbotron-image" src="http://netdna.webdesignerdepot.com/uploads/2014/07/featured36.jpg">
<h1 class="text-center fadeInPage" id="h1first">
Welcome to Cosmos<br> web design
</h1>
</div>
</div>
</div>
<!--End Jumbotron-->
<!--About-->
<div class="container" id="about-section">
<div class="row">
<div class="col-md-6">
<h2 class="text-center" id="abouth2"><a name="about">About</a></h2>
<p class="fadeInBlock" id="p-about">Cosmos Web Design was created by George Kech. I provide web solutions that require HTML, CSS, JavaScript and JQuery. I focus on serving the needs of each customer individually with complete satisfaction as my goal.</p>
</div>
<div class="col-md-6">
<img src="https://www.topechelon.com/wp-content/uploads/2016/07/devices-web-design.png" alt="web design" class="img-responsive">
</div>
</div>
</div>
<!--End About-->
<!--Portfolio-->
<div class="container-inner" id="portfolio-section">
<h2 class="text-center headline fadeInBlock" id="portfolio-id"><a name="portfolio">Portfolio</a> is coming soon...</h2>
<div class="container">
<div class="row text-center">
<div class="col-md-4">
<img src="https://lh4.googleusercontent.com/-fj6pace2cv0/U9Jt75Kq8PI/AAAAAAAARtE/ttg-4YuCOfQ/s250/exe_empty_thumbnail.jpg">
</div>
<div class="col-md-4">
<img src="https://lh4.googleusercontent.com/-fj6pace2cv0/U9Jt75Kq8PI/AAAAAAAARtE/ttg-4YuCOfQ/s250/exe_empty_thumbnail.jpg">
</div>
<div class="col-md-4">
<img src="https://lh4.googleusercontent.com/-fj6pace2cv0/U9Jt75Kq8PI/AAAAAAAARtE/ttg-4YuCOfQ/s250/exe_empty_thumbnail.jpg">
</div>
</div>
</div>
</div>
<!--End Portfolio-->
<!--Contact-->
<div class="container-fluid">
<div class="row" id="contact-section">
<div class="col-md-12">
<div class="text-center">
<i class="social-icons fa fa-facebook-official" id="facebook"></i>
<i class="social-icons fa fa-twitter" id="twitter"></i>
<i class="social-icons fa fa-free-code-camp" id="fcc"></i>
<i class="social-icons fa fa-envelope" id="email"></i>
<h3 id="contactMe">
<a name="contact"></a>
</h3>
</div>
</div>
</div>
</div>
<!--End Contact-->
<!--Footer-->
<footer>
<p class="text-center" id="copy">George Kech © 2017</p>
</footer>
And here's the link to the codepen: Codepen
I think it's your top level nesting. You need to wrap the jumbotron into a container div as well. You can make it fluid if you need full width:
<div class="container-fluid">
<div class="row">
...
</div>
Generally speaking, if you look at basic templates provided by boostrap's documentation, they place all body content into a container div.
This is due to the fact that each row has a -15px margin.
It's caused by your Bootstrap:
Every .row has a negative margin left and right, while every .col-* has a padding left and right by the same amount.
We have to get rid of that. But we need it back inside .container classes.
Look here: https://codepen.io/anon/pen/QpOyyo
I added this CSS:
/* Don't add padding to all elements that have classes like "col-md-*" */
[class^="col-md-"],
[class*=" col-md-"] {
padding-right: 0;
padding-left: 0;
}
/* Add back the Bootstrap padding, if inside .container */
.container [class^="col-md-"],
.container [class*=" col-md-"] {
padding-right: 15px;
padding-left: 15px;
}
/* Don't add negative margin for all rows */
.row {
margin-left: 0;
margin-right: 0;
}
/* Add back the Bootstrap margin, if inside .container */
.container .row {
margin-left: -15px;
margin-right: -15px;
}
Update: Add this as well to address the footer issue.
.container-fluid {
padding-right:0px;
padding-left:0px;
}
footer p{
margin:0;
}
its caused by the padding-right on the div .col-md-12. Set it to 0 and its fine.
The white space at the bottom is caused by the #copy in the footer, add margin-bottom: 0 to it.
I have a navbar dropdown with the 'bell' icon that will hopefully show some notifications.
When for example, I add more text lines to any list item, the sentence extends horizontally and does not break on a new line, thus the dropdown box just keeps exceeding in width.
I have added this image to show what I mean:
How do I stop this? I dont want to give it a fixed width because the list item just breaks free out of the dropdown box and goes on extending.
here is my code:
body {
padding-top: 102px;
background-color: #4d4d4d;
font-family: 'Lato', verdana, sans-serif;
}
.container {
width: 1530px;
margin-top: 0;
}
.navbar-fixed-top {
background-color: #fff;
}
.navbar-header {
min-height: 80px;
}
.hamburger-icon {
margin-top: 20px;
}
.navbar-default .navbar-brand {
line-height: 45px;
font-size: 45px;
color: #010101;
text-transform: uppercase;
}
.navbar-default .navbar-brand span {
font-style: normal;
color: #ff5500;
}
.search .input-group {
padding-top: 15px;
font-family: 'Lato', sans-serif;
}
.search .input-group input.search-field {
border-radius: 0;
border: 0;
box-shadow: none;
background-color: #fff;
font-size: 18px;
font-weight: 100;
}
.search .input-group input.search-field:hover {
background-color: transparent;
}
.search .input-group-btn button {
padding: 2px;
border: 0;
box-shadow: none;
background-color: transparent;
border-radius: 0;
}
.search .input-group-btn button:hover {
background-color: #f8f8f8;
color: #ff5500;
}
.search .input-group-btn .glyphicon-search {
font-size: 22px;
}
.dropdown-toggle.inbox {
padding-top: 15px;
margin-bottom: 5px;
}
.dropdown-menu li {
width: 400px;
}
.dropdown-menu.bell {
background-color: #f8f8f8;
border-radius: 0;
box-shadow: 0;
}
.dropdown-menu.bell h4 {
padding: 10px 0;
color: #010101;
text-align: center;
display: block;
}
.dropdown-menu.bell li a {
padding-top: 5px;
padding-bottom: 5px;
}
.nav>li.dropdown.bell>a:hover,
.nav>li.dropdown.bell>a:focus {
background-color: transparent;
}
.dropdown-menu.bell li.divider {
padding: 0;
margin: 0 20px;
}
.dropdown-menu.bell .label {
background-color: transparent;
color: #ff5500;
font-weight: 100;
}
.badge-notify {
background: #ff5500;
margin-top: -24px;
margin-left: -20px;
height: 1.7em;
}
/* caret for notification dropdown */
.dropdown-menu.bell:before {
position: absolute;
top: -10px;
right: 10%;
display: inline-block;
border-right: 10px solid transparent;
border-bottom: 10px solid #ccc;
border-left: 10px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.dropdown-menu.bell:after {
position: absolute;
top: -9px;
right: 10%;
display: inline-block;
border-right: 9px solid transparent;
border-bottom: 9px solid #f8f8f8;
border-left: 9px solid transparent;
content: '';
}
.user span.fullname {
font-size: 14px;
color: #010101;
font-weight: 400;
}
.user span:last-child {
padding-right: 10px;
}
.user span:first-child {
padding-right: 30px;
padding-left: 10px;
}
.user .dropdown-menu.user-list {
width: 100%;
border-radius: 0;
border: 0;
background-color: #f8f8f8
}
.user .dropdown-menu.user-list li a {
margin: 5px 0px;
color: #010101;
}
.user .dropdown-menu.user-list li a:hover {
background-color: transparent;
color: #ff5500;
}
.user .dropdown-menu.user-list li.divider {
padding: 0;
margin: 0 20px;
}
/* Large desktop */
#media (max-width: 1590px) {
.container {
width: auto;
}
}
/* Portrait tablet to landscape and desktop */
#media (max-width: 979px) {}
/* Landscape phone to portrait tablet */
#media (max-width: 768px) {
.container {
width: auto;
}
.navbar-default .navbar-brand {
font-size: 40px;
}
.dropdown.bell .inbox {
width: 100% !important;
}
.dropdown-menu.bell h4 {
margin: 0 0;
}
.dropdown-menu.bell:before,
.dropdown-menu.bell:after {
display: none;
}
.bell,
.user {
text-align: center;
}
}
/* Landscape phones and down */
#media (max-width: 480px) {
.navbar-default .navbar-brand {
font-size: 30px;
}
}
<link href='https://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/js/bootstrap.min.js"></script>
<div class="container">
<div class="navbar navbar-default navbar-fixed-top navbar-md" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle hamburger-icon" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
BRAND<span>LOGO</span>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<!-- search bar -->
<li class="dropdown search">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control search-field" placeholder="Search name or keyword" name="q">
<div class="input-group-btn">
<button class="btn btn-default" type="submit">
<img src="https://cdn2.iconfinder.com/data/icons/ios-7-icons/50/search-128.png" height="30" width="30" class=" avatar-img img-square">
</button>
</div>
</div>
</form>
</li>
<!-- notification bell -->
<li class="dropdown bell">
<a href="#" class="dropdown-toggle inbox" data-toggle="dropdown">
<img src="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-bell-outline-128.png" height="45" width="45" class=" avatar-img img-square">
<span class="badge badge-notify">1</span>
</a>
<ul class="dropdown-menu bell" role="menu">
<li>
<h4 class="menu-title">Notifications</h4>
</li>
<li><span class="label label-default">4:00 AM</span>Favourites Snippet
</li>
<li class="divider"></li>
<li><span class="label label-warning">4:30 AM</span>Email marketing
</li>
<li class="divider"></li>
<li><a href="#"><span class="label label-warning">5:00 AM</span>Subscriber focused email blaaaa
blaaaddddddddddddddddddddddddddddddddddddddddddddddddblaaadddddddddddddddddddddddddddddddddddddddddddddddd
design</a>
</li>
<li class="divider"></li>
<li>View All
</li>
</ul>
</li>
<!-- user login information -->
<li class="dropdown user">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span><img src="https://cdn2.iconfinder.com/data/icons/ios-7-icons/50/user_male2-128.png" height="50" width="50" ></span>
<span class="fullname">Jacky Smith</span>
<span><img src="https://cdn0.iconfinder.com/data/icons/slim-square-icons-basics/100/basics-08-128.png" height="20" width="20" ></span>
</a>
<ul class="dropdown-menu user-list" role="menu">
<li>Action
</li>
<li class="divider"></li>
<li>Another action
</li>
<li class="divider"></li>
<li>Something else here
</li>
<li class="divider"></li>
<li>Separated link
</li>
<li class="divider"></li>
<li>One more separated link
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<p>dfsjfhskfs</p>
<!-- <div class="chevron right">
</div>
<div style="height: 1em;">
</div> -->
</div>
</div>
</div>
</div>
If you don't want to give a fixed width, then you may use max-width.
It will not set any fixed width but when the text will exceed the given max-width, it will automatically break down to a new line.
This works. You have to stick a DIV to all content and occupying 12 cells text, and do not overflow. In the text I have also gotten a span, texts can not go empty label, everything should always be labeled
<li>
<div class="col-xs-12">
<a href="#">
<span class="label label-warning">5:00 AM</span>
<span>iber focused email bla Subscriber focused email bla Subscriber focused email bla Subscriber focused email bla Subscriber focused email bla Subscriber focused email bla Subscriber focused email bla Subscriber focused email bla Subscriber focused email bla Subscriber focused email bla</span>
</a>
</div>
</li>
you should use a (max-width) for your div.
Property white-space: normal helps to wrap words on new line, when it necessary, but if you have too long words, property word-break: break-word helps you to break word on new line
.dropdown-menu.bell li a {
...
white-space: normal;
word-break: break-word;
}
JSFiddle-example
I finally got my solution working, with the help from the stackoverflow community!.
I included the following on my .dropdown-menu.bell > li > a:
white-space: normal;
width: 350px;
I am trying to divide row into 2 (span4 & span8) but couldn't manage so far. The second div (span8) slides down. What I am missing?
Here is my related markup:
<section id="products" data-direction="from-left">
<div class="container">
<h1>
<span lang="tr">ÜRÜNLERİMİZ</span>
</h1>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="carousel slide" id="myCarousel">
<div class="carousel-inner">
<div class="row-fluid item active">
<div class="bannerImage">
<img src="images/waspmote_pro_t.png" alt="">
<img src="images/waspmote_exp_radio_board_2-375_t.png" alt="">
<img src="images/u13_gw_t.png" alt="">
</div>
<div class="caption row-fluid">
<div class="span12">
<h3>Waspmote</h3>
</div>
<div class="row-fluid">
<div class="span4">
<ul style="list-style-type: none;">
<li><i class="fa fa-share-alt"></i> Connect any sensor</li>
<li><i class="fa fa-rss"></i> Using any wireless technology</li>
<li><i class="fa fa-cloud"></i> To any Cloud Platform</li>
</ul>
</div>
<div class="span8">
<ul style="list-style-type: none;">
<li><i class="fa fa-share-alt"></i> Connect any sensor</li>
<li><i class="fa fa-rss"></i> Using any wireless technology</li>
<li><i class="fa fa-cloud"></i> To any Cloud Platform</li>
</ul>
</div>
</div>
</div>
</div><!-- /Slide1 -->
</div>
<div class="control-box">
<a data-slide="prev" href="#myCarousel" class="carousel-control left">‹</a>
<a data-slide="next" href="#myCarousel" class="carousel-control right">›</a>
</div><!-- /.control-box -->
</div><!-- /#myCarousel -->
</div><!-- /.span12 -->
</div><!-- /.row -->
</div><!-- /.container -->
</div>
</section>
Here is the sample screenshot:
sample
Here is the FF debug:
sample
edit 1: It is Bootstrap v3.2.0
Here is my relevant custom CSS:
div {
word-break: break-all;
}
img {
max-width: 100%;
}
a {
-webkit-transition: all 150ms ease;
-moz-transition: all 150ms ease;
-ms-transition: all 150ms ease;
-o-transition: all 150ms ease;
transition: all 150ms ease;
}
a:hover {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
/* IE 8 */
filter: alpha(opacity=50);
/* IE7 */
opacity: 0.6;
text-decoration: none;
}
/* Container */
.container-fluid {
background: #fbf4e0;
margin: 40px auto 10px;
padding: 20px 0px;
max-width: 960px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
/* Page Header */
.page-header {
background: #fbf4e0;
margin: -30px 0px 0px;
padding: 20px 40px;
border-top: 4px solid #ccc;
color: #a83b3b;
text-transform: uppercase;
}
.page-header h3 {
line-height: 0.88rem;
color: #a83b3b;
}
/* Thumbnail Box */
.caption {
height: 140px;
width: 100%;
margin: 10px 0px;
padding: 20px;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.caption .span4,
.caption .span8 {
padding: 0px 20px;
}
.caption .span4 {
border-right: 1px dotted #CCCCCC;
}
.caption h3 {
color: #a83b3b;
line-height: 2rem;
margin: 0 0 20px;
text-transform: uppercase;
}
.caption p {
font-size: 1rem;
line-height: 1.6rem;
color: #a83b3b;
}
.caption ul{
color: #a83b3b;
}
.btn.btn-mini {
background: #a83b3b;
border-radius: 0 0 0 0;
color: #fbf4e0;
font-size: 0.63rem;
text-shadow: none !important;
}
.carousel-control {
top: 33%;
}
/* Footer */
.footer {
margin: auto;
width: 100%;
max-width: 960px;
display: block;
font-size: 0.69rem;
}
.footer,
.footer a {
color: #fff;
}
p.right {
float: right;
}
::selection {
background: #ff5e99;
color: #FFFFFF;
text-shadow: 0;
}
::-moz-selection {
background: #ff5e99;
color: #FFFFFF;
}
a,
a:focus,
a:active,
a:hover,
object,
embed {
outline: none;
}
:-moz-any-link:focus {
outline: none;
}
input::-moz-focus-inner {
border: 0;
}
.bannerImage img {
margin-left: 10%;
/*margin-right: 10%;*/
}
edit 2: Here is the other CSS files.
<!-- ==============================================
CSS
=============================================== -->
<link href='http://fonts.googleapis.com/css?family=Raleway:700,400,500' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
Thanks in advance & Best Regards.
So the classes you are using for scaffolding (row-fluid and span*) are from an older version of bootstrap.
You need to use the scaffolding classes of Bootstrap 3 for example: container-fluid, row, col-md-*. Check the full documentation on the Bootstrap 3 grid system here.
Example:
Instead of:
<div class="container-fluid">
<div class="row-fluid">
<div class="span12"></div>
</div>
<div class="row-fluid">
<div class="span8"></div>
<div class="span4"></div>
</div>
</div>
Use:
<div class="container-fluid">
<div class="row">
<div class="col-md-12"></div>
</div>
<div class="row">
<div class="col-md-8"></div>
<div class="col-md-4"></div>
</div>
</div>