Before I start, I understand that linear-gradients cannot be transitioned through the traditional transition in CSS. I know that gradients are treated as images. Here is my problem. I have a navbar in my website. I am working with materialize css as my framework. When a user visits my website, the navbar is a transparent white color, as the user scrolls, I would like my navbar to transition at a certain point, to the linear gradient. Would this be possible? Here is my markup:
$(document).ready(function(){
$('.sidenav').sidenav();
const parallax = () => {
let wScroll = $(window).scrollTop();
if (wScroll > 400) {
$("nav").addClass("bgchange");
} else {
$("nav").removeClass("bgchange");
}
};
parallax();
$(window).scroll(function() {
parallax();
});
});
.navlogo {
position: relative;
height: 55px !important;
width: 55px !important;
margin-top: 10px;
}
.bgchange {
z-index: 10;
background: linear-gradient(to right, #00BAA3, #1565c0) !important;
}
.navbar-fixed {position: absolute; z-index:10;}
.trans{
background-color: rgba(255,255,255,0.25) !important;
transition: all 0.7s ease-in-out;
}
input {
outline-style:none;
box-shadow:none;
border-color:transparent;
}
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 40px white inset !important;
}
.sidenav .user-view .background img {
width: 100%;
height: 100%;
position: relative;
}
.sidenav .user-view {
height: 240px;
background-color: rgba(0, 0, 0, 0.5);
}
.name {
display: inline-block;
line-height: 15px;
}
.sale {
text-transform: uppercase;
font-weight: 900;
margin: 0 0 1rem;
padding: 0;
line-height: 1;
font-family: Futura, Helvetica, sans-serif;
font-size: 26px;
}
.brand-logo .text {
display: inline-block;
position: absolute;
margin-top: 18px;
margin-left: 5px;
text-transform: uppercase;
font-weight: 900;
padding: 0;
line-height: 1;
font-family: Futura, Helvetica, sans-serif;
font-size: 26px;
}
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/js/materialize.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/css/materialize.min.css" rel="stylesheet"/>
<div class="navbar-fixed">
<nav class='trans'>
<div class="nav-wrapper">
<img class='navlogo' src="static/images/IMG_6970.png" alt=""><span class="text">Dog<span>House</span></span>
<i class="material-icons">menu</i>
<ul class="right hide-on-med-and-down">
<li>Login</li>
<li>Sign up</li>
<li>
<form>
<div class="input-field">
<input id="search" type="search" required>
<label class="label-icon" for="search"><i class="material-icons">search</i></label>
<i class="material-icons">close</i>
</div>
</form>
</li>
</ul>
</div>
</nav>
</div>
<ul class="sidenav " id="mobile-demo">
<li><div class="user-view">
<div class="background">
<img src="static/images/IMG_6971.png">
</div>
<div class="center center-align">
<span class="white-text sale">DogHouse</span>
<span class="white-text name">The only app you will need for when you are on your dream vacation.</span>
<span class="white-text email"><br>doghouse#gmail.com</span>
</div>
</div></li>
<li><i class="material-icons">supervisor_account</i> Login</li>
<li>
<form>
<div class="input-field">
<input id="search" type="search" required>
<label class="label-icon" for="search"><i class="material-icons">search</i></label>
<i class="material-icons">close</i>
</div>
</form>
</li>
</ul>
Rather than trying to animate the background gradient, I suggest you create a pseudo element on your navigation, absolutely positioned with a z-index of 0. Then just transition the opacity of the pseudo element.
Below is the updated code, it's worth noting I only changed the CSS:
$(document).ready(function() {
$('.sidenav').sidenav();
const parallax = () => {
let wScroll = $(window).scrollTop();
if (wScroll > 400) {
$("nav").addClass("bgchange");
} else {
$("nav").removeClass("bgchange");
}
};
parallax();
$(window).scroll(function() {
parallax();
});
});
.navlogo {
position: relative;
height: 55px !important;
width: 55px !important;
margin-top: 10px;
}
.bgchange {
z-index: 10;
/* this is now being applied to the pseudo element */
/* background: linear-gradient(to right, #00baa3, #1565c0) !important; */
}
.navbar-fixed {
position: absolute;
z-index: 10;
}
.trans {
background-color: rgba(255, 255, 255, 0.25) !important;
/* this is now being applied to the pseudo element */
transition: all 0.7s ease-in-out;
}
input {
outline-style: none;
box-shadow: none;
border-color: transparent;
}
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 40px white inset !important;
}
.sidenav .user-view .background img {
width: 100%;
height: 100%;
position: relative;
}
.sidenav .user-view {
height: 240px;
background-color: rgba(0, 0, 0, 0.5);
}
.name {
display: inline-block;
line-height: 15px;
}
.sale {
text-transform: uppercase;
font-weight: 900;
margin: 0 0 1rem;
padding: 0;
line-height: 1;
font-family: Futura, Helvetica, sans-serif;
font-size: 26px;
}
.brand-logo .text {
display: inline-block;
position: absolute;
margin-top: 18px;
margin-left: 5px;
text-transform: uppercase;
font-weight: 900;
padding: 0;
line-height: 1;
font-family: Futura, Helvetica, sans-serif;
font-size: 26px;
}
/* pseudo element */
.trans::before {
background: linear-gradient(to right, #00baa3, #1565c0);
bottom: 0;
content: '';
display: block;
left: 0;
opacity: 0;
position: absolute;
right: 0;
top: 0;
transition: all 0.7s ease-in-out;
z-index: 0;
}
.trans.bgchange::before {
opacity: 1;
}
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/js/materialize.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/css/materialize.min.css" rel="stylesheet" />
<div class="navbar-fixed">
<nav class='trans'>
<div class="nav-wrapper">
<a href="#!" class="brand-logo "><img class='navlogo' src="static/images/IMG_6970.png" alt=""><span class="text">Dog<span>House</span></span>
</a>
<i class="material-icons">menu</i>
<ul class="right hide-on-med-and-down">
<li>Login</li>
<li>Sign up</li>
<li>
<form>
<div class="input-field">
<input id="search" type="search" required>
<label class="label-icon" for="search"><i class="material-icons">search</i></label>
<i class="material-icons">close</i>
</div>
</form>
</li>
</ul>
</div>
</nav>
</div>
<ul class="sidenav " id="mobile-demo">
<li>
<div class="user-view">
<div class="background">
<img src="static/images/IMG_6971.png">
</div>
<div class="center center-align">
<span class="white-text sale">DogHouse</span>
<span class="white-text name">The only app you will need for when you are on your dream vacation.</span>
<span class="white-text email"><br>doghouse#gmail.com</span>
</div>
</div>
</li>
<li><i class="material-icons">supervisor_account</i> Login</li>
<li>
<form>
<div class="input-field">
<input id="search" type="search" required>
<label class="label-icon" for="search"><i class="material-icons">search</i></label>
<i class="material-icons">close</i>
</div>
</form>
</li>
</ul>
CodePen example: https://codepen.io/samwalker/pen/KeOXBa
Related
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>
The problem is on the "container main" div, which has the overflow-y. When the <form> height gets increased and the overflow starts to work on the "container div", it's not possible to see the whole form and the top part gets hidden
I don't think it's normal behavior, I've been some hours at this problem and just can't solve it the way I wanted (by leaving the form centered with "container main" flexbox)
.form-background {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: -999;
backdrop-filter: brightness(125%) hue-rotate(180deg) blur(10px);
background-color: rgba(0, 0, 0, .5)
}
body {
background-image: url(https://images.pexels.com/photos/1624600/pexels-photo-1624600.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260)
}
section {
height: 100vh;
display: flex;
flex-direction: column;
overflow: auto!important
}
.main.container {
flex-grow: 3;
height: auto;
padding: 0 50px;
overflow-y: scroll;
margin: 50px auto 50px auto;
display: flex;
align-items: center;
}
form {
width: 100%;
}
.edit {
width: 50%;
display: inline-block
}
.edit .input-file {
cursor: pointer
}
.edit.middle,
.edit.middle input {
width: 100%
}
.edit.custom-input {
width: 100%;
display: flex
}
.edit.right {
padding-left: 5px
}
.edit.left {
padding-right: 5px
}
.clickin {
margin: 15px 0
}
form>.box:nth-child(n+2) {
margin-top: 70px
}
.current-templates,
.mob {
display: none;
margin-top: 20px;
}
.current-templates .file {
padding: 10px;
font-size: 1.2rem
}
.current-templates .file:not(:first-child) {
margin-top: 20px
}
.current-templates .file,
.current-templates .options {
display: flex;
align-items: center
}
.current-templates .options {
width: 100%;
justify-content: space-around
}
.current-templates .file span {
white-space: nowrap
}
.current-templates .options {
margin-left: 30px;
list-style: none;
overflow: auto
}
.current-templates .options li {
padding: 4px 25px;
cursor: pointer;
white-space: nowrap;
text-align: center;
transition: background-color .2s var(--cubic-bezier)
}
.current-templates .options li:hover {
background-color: var(--hover-color)
}
.current-templates .options .opt[selected=true] {
background-color: rgba(18, 238, 102, .466)
}
.btn-wrapper {
width: 100%;
display: flex;
justify-content: center;
align-items: center
}
.btn-wrapper button {
padding: 10px;
font-size: 1.1rem;
cursor: pointer;
outline: 0;
border: solid #000 1px;
width: 200px;
margin-top: 30px
}
.btn-anim {
transition: background-color .2s var(--cubic-bezier), color .2s var(--cubic-bezier);
background-color: var(--input-color)
}
.btn-anim:hover {
background-color: var(--hover-color) !important;
color: #fff
}
.btn-anim-blocked:hover {
background-color: rgba(255, 110, 110, .363)!important;
color: #fff
}
.fas.fa-question {
font-size: .8rem;
margin-left: 15px;
cursor: pointer;
padding: 5px;
position: relative
}
.img {
position: absolute;
left: 100%;
top: 0;
visibility: hidden;
opacity: 0;
transform: translate(-50%, -150%);
transition: visibility .2s var(--cubic-bezier), opacity .2s var(--cubic-bezier), transform .2s var(--cubic-bezier)
}
button.refresh-options i {
background-color: transparent;
border: none;
border-radius: 100%;
padding: 5px 8px;
transition: transform 1s var(--cubic-bezier)
}
button.refresh-options {
background-color: transparent;
border: none;
padding: 8px;
font-size: 1rem;
cursor: pointer;
outline: 0;
display: none
}
.edit .input-file,
.edit input {
background-color: var(--input-color)
}
button.refresh-options:hover i {
transform: rotateZ(360deg)
}
.check-box {
margin: 15px 0 25px 1px;
display: flex;
align-items: center
}
.check-box .square {
position: relative;
width: 20px;
height: 20px;
background-color: transparent;
border: solid #fff 1px;
cursor: pointer
}
.check-box span {
margin-left: 20px
}
header {
position: fixed;
width: 100%;
background-color: transparent;
}
.container.nav-content {
padding: 0;
overflow: auto;
}
.container.nav-content {
grid-template-columns: auto 1fr;
justify-content: space-between;
}
ul.nav-opts {
justify-content: flex-end;
}
.fake-nav {
height: 74px;
margin-bottom: 30px;
}
<section>
<div class="fake-nav"></div>
<header>
<nav>
<div class="container nav-content">
<div class="brand">
<img src="" alt="clickin logo">
</div>
<ul class="nav-opts">
<li>Home</li>
<li>Posts</li>
<li>Imagens</li>
</ul>
</div>
</nav>
</header>
<div class="container main">
<div class="form-background"></div>
<form>
<div class="edit-wrapper box">
<div class="edit left"> <label>Id do board <i class="fas fa-question"> <img class="img" src="" alt="Board Id?"> </i></label> <input name="board_id" type="number" required> </div>
<div class="edit right"> <label>Nome do Grupo<i class="fas fa-question"> <img class="img" src="" alt="Nome do Grupo?"> </i></label> <input name="group_name" type="text" required> </div>
</div>
<div class="edit middle box"> <label>Diretório da pasta para construção da estrutura<i class="fas fa-question"> <img class="img" src="" alt="Diretório desejado?"> </i></label> <input name="desired_path" type="text" required> </div>
<div class="edit-wrapper box">
<div class="edit left"> <label>Diretório dos Templates<i class="fas fa-question"> <img class="img" src="" alt="Diretório dos templates?"> </i></label> <input name="templates_path" type="text" required> </div>
<div class="edit right"> <label>Selecione os templates<i class="fas fa-question"> <img class="img" src=""> </i></label> <label class="input-file btn-anim" for="templates">Templates</label> <input name="templates" disabled id="templates" type="file" accept=".psd" multiple
required> </div>
</div>
<div class="edit-wrapper">
<div class="check-box" data-selected="false">
<div class="square"></div>
<span>Templates estruturados em ordem</span>
</div>
</div>
<div class="edit-wrapper mob">
<button type="button" class="refresh-options btn-anim"> Recarregar temas por possíveis mudanças <i class="fas fa-redo-alt"></i> </button>
<center> <img width="100px" class="loader" src="" alt="loading"> </center>
</div>
<div class="current-templates" style="display: block;">
<div class="file" selected_topics="">
<span class="template-name">Template 1</span>
<ul class="options">
<li class="opt" selected="false">1 °</li>
<li class="opt" selected="false">2 °</li>
<li class="opt" selected="false">3 °</li>
</ul>
</div>
<div class="file" selected_topics="">
<span class="template-name">Template 2</span>
<ul class="options">
<li class="opt" selected="false">1 °</li>
<li class="opt" selected="false">2 °</li>
<li class="opt" selected="false">3 °</li>
</ul>
</div>
<div class="file" selected_topics="">
<span class="template-name">Template 3</span>
<ul class="options">
<li class="opt" selected="false">1 °</li>
<li class="opt" selected="false">2 °</li>
<li class="opt" selected="false">3 °</li>
</ul>
</div>
</div>
<div class="btn-wrapper"> <button class="btn-anim" type="submit">Gerar!</button> </div>
</form>
</div>
<footer>Copyright 2021 © João Webber</footer>
</section>
I think the offending part of your CSS code is this one:
.main.container {
flex-grow: 3;
height: auto;
padding: 0 50px;
overflow-y: scroll;
margin: 50px auto 50px auto;
display: flex;
align-items: center;
}
The margin: 50px auto 50px auto; forces your main.container to get squeezed in between your header and your footer, but the form is contains is not following his parent height.
Either:
you remove the overflow-y: scroll from .main.container to allow the <form> to increase the height of his parent, but no more scroll bar inside .main.container.
or you set <form> height: 100% to force him to take its parent height, which will still cause the scroll bar to appear in .main.container (because the form content can't be squeezed) but the top of your <form> will be aligned to the top of .main.container.
It's about 'display: flex;' a flexbox is not just one single property, it's a whole module. If your interested in reading a article about flexbox: guide to use flex-box.
When you delete the display: flex; in your main container it will solve your problem.
.form-background {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: -999;
backdrop-filter: brightness(125%) hue-rotate(180deg) blur(10px);
background-color: rgba(0, 0, 0, .5)
}
/*
body {
background-image: url(https://images.pexels.com/photos/1624600/pexels-photo-1624600.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260)
}*/
section {
height: 100vh;
display: flex;
flex-direction: column;
overflow: auto!important
}
.container.main {
flex-grow: 3;
height: auto;
padding: 0 50px;
overflow-y: scroll;
margin: 50px auto 50px auto;
}
form {
width: 100%;
}
.edit {
width: 50%;
display: inline-block
}
.edit .input-file {
cursor: pointer
}
.edit.middle,
.edit.middle input {
width: 100%
}
.edit.custom-input {
width: 100%;
display: flex
}
.edit.right {
padding-left: 5px
}
.edit.left {
padding-right: 5px
}
.clickin {
margin: 15px 0
}
form>.box:nth-child(n+2) {
margin-top: 70px
}
.current-templates,
.mob {
display: none;
margin-top: 20px;
}
.current-templates .file {
padding: 10px;
font-size: 1.2rem
}
.current-templates .file:not(:first-child) {
margin-top: 20px
}
.current-templates .file,
.current-templates .options {
display: flex;
align-items: center
}
.current-templates .options {
width: 100%;
justify-content: space-around
}
.current-templates .file span {
white-space: nowrap
}
.current-templates .options {
margin-left: 30px;
list-style: none;
overflow: auto
}
.current-templates .options li {
padding: 4px 25px;
cursor: pointer;
white-space: nowrap;
text-align: center;
transition: background-color .2s var(--cubic-bezier)
}
.current-templates .options li:hover {
background-color: var(--hover-color)
}
.current-templates .options .opt[selected=true] {
background-color: rgba(18, 238, 102, .466)
}
.btn-wrapper {
width: 100%;
display: flex;
justify-content: center;
align-items: center
}
.btn-wrapper button {
padding: 10px;
font-size: 1.1rem;
cursor: pointer;
outline: 0;
border: solid #000 1px;
width: 200px;
margin-top: 30px
}
.btn-anim {
transition: background-color .2s var(--cubic-bezier), color .2s var(--cubic-bezier);
background-color: var(--input-color)
}
.btn-anim:hover {
background-color: var(--hover-color) !important;
color: #fff
}
.btn-anim-blocked:hover {
background-color: rgba(255, 110, 110, .363)!important;
color: #fff
}
.fas.fa-question {
font-size: .8rem;
margin-left: 15px;
cursor: pointer;
padding: 5px;
position: relative
}
.img {
position: absolute;
left: 100%;
top: 0;
visibility: hidden;
opacity: 0;
transform: translate(-50%, -150%);
transition: visibility .2s var(--cubic-bezier), opacity .2s var(--cubic-bezier), transform .2s var(--cubic-bezier)
}
button.refresh-options i {
background-color: transparent;
border: none;
border-radius: 100%;
padding: 5px 8px;
transition: transform 1s var(--cubic-bezier)
}
button.refresh-options {
background-color: transparent;
border: none;
padding: 8px;
font-size: 1rem;
cursor: pointer;
outline: 0;
display: none
}
.edit .input-file,
.edit input {
background-color: var(--input-color)
}
button.refresh-options:hover i {
transform: rotateZ(360deg)
}
.check-box {
margin: 15px 0 25px 1px;
display: flex;
align-items: center
}
.check-box .square {
position: relative;
width: 20px;
height: 20px;
background-color: transparent;
border: solid #fff 1px;
cursor: pointer
}
.check-box span {
margin-left: 20px
}
header {
position: fixed;
width: 100%;
background-color: transparent;
}
.container.nav-content {
padding: 0;
overflow: auto;
}
.container.nav-content {
grid-template-columns: auto 1fr;
justify-content: space-between;
}
ul.nav-opts {
justify-content: flex-end;
}
.fake-nav {
height: 74px;
margin-bottom: 30px;
}
<section>
<div class="fake-nav"></div>
<header>
<nav>
<div class="container nav-content">
<div class="brand">
<img src="" alt="clickin logo">
</div>
<ul class="nav-opts">
<li>Home</li>
<li>Posts</li>
<li>Imagens</li>
</ul>
</div>
</nav>
</header>
<div class="container main">
<div class="form-background"></div>
<form>
<div class="edit-wrapper box">
<div class="edit left"> <label>Id do board <i class="fas fa-question"> <img class="img" src="" alt="Board Id?"> </i></label> <input name="board_id" type="number" required> </div>
<div class="edit right"> <label>Nome do Grupo<i class="fas fa-question"> <img class="img" src="" alt="Nome do Grupo?"> </i></label> <input name="group_name" type="text" required> </div>
</div>
<div class="edit middle box"> <label>Diretório da pasta para construção da estrutura<i class="fas fa-question"> <img class="img" src="" alt="Diretório desejado?"> </i></label> <input name="desired_path" type="text" required> </div>
<div class="edit-wrapper box">
<div class="edit left"> <label>Diretório dos Templates<i class="fas fa-question"> <img class="img" src="" alt="Diretório dos templates?"> </i></label> <input name="templates_path" type="text" required> </div>
<div class="edit right"> <label>Selecione os templates<i class="fas fa-question"> <img class="img" src=""> </i></label> <label class="input-file btn-anim" for="templates">Templates</label> <input name="templates" disabled id="templates" type="file" accept=".psd" multiple
required> </div>
</div>
<div class="edit-wrapper">
<div class="check-box" data-selected="false">
<div class="square"></div>
<span>Templates estruturados em ordem</span>
</div>
</div>
<div class="edit-wrapper mob">
<button type="button" class="refresh-options btn-anim"> Recarregar temas por possíveis mudanças <i class="fas fa-redo-alt"></i> </button>
<center> <img width="100px" class="loader" src="" alt="loading"> </center>
</div>
<div class="current-templates" style="display: block;">
<div class="file" selected_topics="">
<span class="template-name">Template 1</span>
<ul class="options">
<li class="opt" selected="false">1 °</li>
<li class="opt" selected="false">2 °</li>
<li class="opt" selected="false">3 °</li>
</ul>
</div>
<div class="file" selected_topics="">
<span class="template-name">Template 2</span>
<ul class="options">
<li class="opt" selected="false">1 °</li>
<li class="opt" selected="false">2 °</li>
<li class="opt" selected="false">3 °</li>
</ul>
</div>
<div class="file" selected_topics="">
<span class="template-name">Template 3</span>
<ul class="options">
<li class="opt" selected="false">1 °</li>
<li class="opt" selected="false">2 °</li>
<li class="opt" selected="false">3 °</li>
</ul>
</div>
</div>
<div class="btn-wrapper"> <button class="btn-anim" type="submit">Gerar!</button> </div>
</form>
</div>
<footer>Copyright 2021 © João Webber</footer>
</section>
I am editing a template and I am having trouble getting the navigation menu button to align next to my logo when viewed on mobile devices. It also slightly covers the header image on mobile as well.
Mobile view
Desktop view
Any help is greatly appreciated! Here is my code:
#import url(http://fonts.googleapis.com/css?family=Dosis:400,200,300,500,600,700,800);
#import url(http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:400,300,200,700);
/*************************
*******Typography******
**************************/
body {
font-family: 'Dosis', sans-serif;
font-size: 17px;
color: #fff
}
.btn {
border-radius: 0;
font-family: 'Yanone Kaffeesatz','sans-serif';
font-size: 20px;
padding: 9px 23px;
}
a {
-webkit-transition: 300ms;
-moz-transition: 300ms;
-o-transition: 300ms;
transition: 300ms;
}
a:focus,
a:hover {
text-decoration: none;
outline: none
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Yanone Kaffeesatz', 'sans-serif';
font-weight: 300;
text-transform: uppercase;
}
h2 {
font-size: 36px
}
.navbar-toggle {
margin-top: 12px
}
.navbar-toggle .icon-bar {
background-color: #fff;
}
.navbar-toggle,
.navbar-toggle:focus {
border:1px solid #fff;
outline: none;
}
/*************************
*******Header CSS******
**************************/
.header-top {
display: block;
overflow: hidden;
padding: 25px;
}
.main-nav {
position: absolute;
width: 100%;
z-index: 999;
}
.main-nav
.container {
width: 100%
}
.social-icons a {
font-size: 18px;
color: #fff;
padding-left:20px;
}
.social-icons .fa-facebook:hover {
color: #3B5997
}
.social-icons .fa-twitter:hover {
color:#29C5F6
}
.social-icons .fa-google-plus:hover {
color:#D13D2F
}
.social-icons .fa-youtube:hover{
color: #ec5538
}
.navbar-brand {
background-color: #ff0080;
height: 90px;
margin-bottom: 20px;
position: relative;
width: 435px;
}
.navbar-brand img {
position: absolute;
top: -35px;
}
.navbar-right {
background-color: #ff0080;
padding:0 95px 0 0;
opacity: .9
}
.navbar-right li a {
padding: 35px 21px;
font-size: 22px;
color: #fff;
text-transform: uppercase;
font-family: 'Yanone Kaffeesatz', 'sans-serif';
font-weight: 300;
}
.navbar-right li a:hover,
.navbar-right li a:focus,
.navbar-right .active a {
background-color: #fff;
color: #16728f
}
.fixed-menu {
background-color: #ff0080;
position: fixed;
top: 0;
}
.fixed-menu .navbar-right {
padding: 0;
}
.fixed-menu .navbar-right li a {
font-size: 18px;
padding: 20px 25px;
text-shadow:inherit;
}
.fixed-menu .navbar-brand {
height: 60px;
margin-top: 0;
padding: 0;
margin-bottom: 0;
width: 435px;
}
.fixed-menu .navbar-brand img {
height:60px;
top: 0;
}
.fixed-menu .header-top {
display: none;
}
/*************************
*******Home CSS******
**************************/
#home {
position: relative;
overflow: hidden;
}
#main-slider img {
width: 100%
}
#main-slider
.carousel-caption {
background: none repeat scroll 0 0 #000000;
bottom: 14%;
float: left;
left: 0;
opacity: 0.8;
padding:10px 60px 35px;
right: inherit;
text-transform: uppercase;
color: #fff;
text-align: left;
}
#main-slider
.carousel-caption h2 {
font-size: 38px;
}
#main-slider
.carousel-caption h4 {
font-size: 24px;
}
#main-slider
.carousel-caption a {
font-size: 22px;
color: #2da1c5
}
#main-slider
.carousel-caption a:hover {
color: #2588a6
}
#main-slider
.carousel-caption a:hover i {
margin-left: 35px
}
#main-slider
.carousel-caption a i {
margin-left: 15px;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
#main-slider
.carousel-indicators li {
background-color:#ff0080;
border: 1px solid #ff0080;
}
#main-slider
.carousel-indicators li.active {
background-color:#fff;
border: 1px solid #fff;
}
/*************************
*******Explore CSS******
**************************/
#explore {
background-color: #C34C39;
background-image: url("../images/event-bg.jpg");
background-position: center bottom;
background-size: contain;
background-repeat:no-repeat;
position: relative;
overflow: hidden;
padding: 130px 0 100px;
}
.watch {
position: absolute;
left: 0;
top: 7%;
}
#explore h2 {
font-size: 42px;
text-transform: uppercase;
text-align: center;
}
#countdown {
display: block;
overflow: hidden;
text-align: center;
padding: 0
}
#countdown li {
list-style: none;
display:inline-block;
margin-right: 40px;
text-align: center;
text-transform: uppercase;
font-size: 18px;
position: relative;
}
#countdown li:last-child {
margin-right: 0
}
#countdown li span {
display: block;
font-size: 40px;
font-weight: 700;
height: 82px;
line-height: 79px;
width: 75px;
border-radius: 10px;
border-right: 1px solid #c34c39;
border-bottom: 1px solid #c34c39;
}
#countdown li .days {
background-color: #45b29d;
border-top: 1px solid #c34c39;
border-left: 1px solid #c34c39;
}
#countdown li .hours {
background-color: #efc94c;
border-top: 1px solid #c34c39;
border-left: 1px solid #c34c39;
}
#countdown li .minutes {
background-color: #e27a3f;
border-top: 1px solid #c34c39;
border-left: 1px solid #c34c39;
}
#countdown li .seconds {
background-color: #df5a49;
border-top: 1px solid #c34c39;
border-left: 1px solid #c34c39;
}
#countdown li:before {
background-color: #c34c39;
content: "";
height: 11px;
left: 0;
position: absolute;
top: 36px;
width: 1px;
}
#countdown li:after {
background-color: #c34c39;
content: "";
height: 11px;
right:0;
position: absolute;
top: 36px;
width: 1px;
}
.cart {
background-color: #b34534;
position: absolute;
right:-200px;
top: 37%;
width:252px;
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.7s ease-in-out;
-ms-transition: all 0.7s ease-in-out;
-o-transition: all 0.7s ease-in-out;
transition: all 0.7s ease-in-out;
}
.cart:hover {
right:0;
}
.cart a {
color: #FFFFFF;
display: block;
font-size: 24px;
text-transform: uppercase;
}
.cart a i {
font-size: 30px;
padding: 20px 12px;
background-color: #A64030;
margin-right: 3px;
}
/*************************
*******Event CSS******
**************************/
#event {
background-color: #33888F;
background-image: url("../images/performar-bg.jpg");
background-position: 50% 0;
background-size: contain;
position: relative;
background-repeat: no-repeat;
}
.guitar {
position: absolute;
right:0;
top: 0
}
#event h2 {
color: #FFFFFF;
font-size: 36px;
font-weight: 300;
margin-bottom: 40px;
margin-top: 70px;
text-transform: uppercase;
}
.single-event {
margin-bottom: 70px;
}
.single-event h4 {
color: #FFFFFF;
font-size: 24px;
font-weight: 300;
line-height: 26px;
margin-top: 25px;
text-transform: uppercase;
}
.single-event h5 {
font-size: 18px;
font-weight: 100;
display: block;
}
#event-carousel {
position: relative;
}
.even-control-left,
.even-control-right {
position: absolute;
font-size: 24px;
color: #fff;
top: 0;
}
.even-control-left {
right: 3%
}
.even-control-right {
right: 0;
}
/*************************
*******About CSS**********
**************************/
#about {
background-color: #75B46E;
position: relative;
width: 100%;
display: flex;
}
.guitar2 {
top: 0;
width: 50%;
}
.guitar2 img {
padding-top: 3%;
}
.about-content {
width: 50%;
background-image: url("../images/about-bg.jpg");
background-position: left bottom;
background-repeat: no-repeat;
background-size: cover;
padding: 70px 70px 110px;
}
#about h2 {
margin-bottom: 23px;
}
.about-content p {
font-size: 17px;
font-family: 'Dosis',sans-serif;
}
#about .btn-primary {
background-color: #137c61;
color: #fff;
text-transform: capitalize;
border: none;
margin-top: 28px;
}
#about .btn-primary:hover {
background-color: #126d55
}
/*************************
******Twitter CSS****
**************************/
#twitter {
background-color: #ecedef;
background-image: url("../images/twitter-bg.jpg");
background-position: center bottom;
background-size: cover;
background-repeat:no-repeat;
position: relative;
padding: 95px 0 90px;
overflow: hidden;
}
.twit {
position: absolute;
left: 0;
top:-42%;
}
#twitter-feed .item {
text-align: center;
}
#twitter-feed .item img {
display: inline-block;
width: 78px;
height: 78px;
border-radius: 50%;
background-color: #c5c8ce;
padding: 5px;
margin-bottom: 30px;
}
#twitter-feed .item a,
#twitter-feed .item p {
font-size: 24px;
font-weight: 300;
font-family: 'Yanone Kaffeesatz','sans-serif';
}
#twitter-feed .item p {
color: #3D3D3D;
}
#twitter-feed .item a {
color:#00c3ff;
}
.twitter-control-left,
.twitter-control-right {
position: absolute;
color: #00c3ff;
top: 59%;
font-size: 24px
}
.twitter-control-left {
left: 0;
}
.twitter-control-right {
right:0;
}
/*************************
******Sponsor CSS****
**************************/
#sponsor {
background-color: #1881a2;
background-image: url("../images/sponsor-bg.jpg");
background-position:50% 0;
background-size: cover;
background-repeat:no-repeat;
position: relative;
}
.light {
position: absolute;
right: 0;
bottom: 0;
}
#sponsor .col-sm-10 {
z-index: 10;
}
#sponsor h2 {
margin-top: 90px;
margin-bottom: 40px;
}
#sponsor .item ul {
font-size: 0;
padding: 0;
}
#sponsor .item ul li {
display: inline-block;
list-style: none;
width: 33.33%;
margin-bottom: 75px;
}
#sponsor .item ul li:last-child {
margin-right: 0
}
.sponsor-control-left,
.sponsor-control-right {
color: #FFFFFF;
font-size: 24px;
position: absolute;
top: 20%;
}
.sponsor-control-left {
right: 12%
}
.sponsor-control-right {
right: 10%
}
/*************************
******Map CSS****
**************************/
#map {
position: relative;
}
#gmap {
height:450px;
}
/*************************
******Contact CSS****
**************************/
.contact-section {
background-color: #f7ab24;
background-image: url("../images/contact-bg.jpg");
background-position:60% 0;
background-size:contain;
background-repeat:no-repeat;
position: relative;
}
.ear-piece {
position: absolute;
left: 0;
top: 0;
}
#contact .container {
padding-top:47px;
}
#contact h3 {
text-transform:inherit;
color: #373737;
}
#contact-section h3 {
margin-bottom: 25px
}
#contact address {
font-size: 18px;
color: #373737;
}
.contact-text {
margin-bottom: 35px;
display: block;
}
#contact-section .form-control {
border-color: #ae750d;
box-shadow:none;
outline: 0 none;
border-radius: 0;
color: #797979;
font-size: 18px;
}
#contact-section .form-control:focus {
border-color: #ae750d;
}
#contact-section input {
height: 44px;
}
#contact-section textarea {
height: 90px;
resize:none;
}
#contact-section .btn-primary {
background-color: #373737;
color: #f7ab24;
border: none;
font-size: 24px;
padding: 6px 42px;
margin-bottom: 110px;
margin-top: 10px
}
#contact-section .btn-primary:hover {
background-color: #212020;
color: #fff
}
/*************************
******Footer CSS****
**************************/
#footer {
background-color: #212121;
background-image: url("../images/footer-bg.jpg");
background-position: center bottom;
background-repeat: no-repeat;
background-size: cover;
color: #FFFFFF;
font-size: 20px;
padding: 35px 0;
}
#footer a {
color:#f7ab24
}
#footer a:hover {
color:#ff0080
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Melodie Rooker Music</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">
<link href="css/responsive.css" rel="stylesheet">
<script src="https://use.fontawesome.com/6740b2e08a.js"></script>
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
<link rel="shortcut icon" href="images/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="images/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="images/ico/apple-touch-icon-57-precomposed.png">
</head><!--/head-->
<body>
<header id="header" role="banner">
<div class="main-nav">
<div class="container">
<div class="header-top">
<div class="pull-right social-icons">
<i class="fa fa-facebook"></i>
<i class="fa fa-youtube"></i>
<i class="fa fa-apple"></i>
<i class="fa fa-spotify"></i>
</div>
</div>
<div class="row">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
<img class="img-responsive" src="images/logo.png" alt="logo">
</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="scroll active">Home</li>
<li class="scroll">Explore</li>
<li class="scroll">Biography</li>
<li class="no-scroll">Sample</li>
<li class="scroll">Contact</li>
</ul>
</div>
</div>
</div>
</div>
</header>
<!--/#header-->
<section id="home">
<div id="main-slider" class="carousel slide" data-ride="carousel">
<!-- <ol class="carousel-indicators">
<li data-target="#main-slider" data-slide-to="0" class="active"></li>
<li data-target="#main-slider" data-slide-to="1"></li>
<li data-target="#main-slider" data-slide-to="2"></li>
</ol> -->
<div class="carousel-inner">
<div class="item active">
<img class="img-responsive" src="images/slider/bg1.jpg" alt="slider">
<!-- <div class="carousel-caption">
<h2>register for our next event </h2>
<h4>full event package only #$199</h4>
GRAB YOUR TICKETS <i class="fa fa-angle-right"></i>
</div> -->
</div>
<!--<div class="item">
<img class="img-responsive" src="images/slider/bg2.jpg" alt="slider">
<div class="carousel-caption">
<h2>register for our next event </h2>
<h4>full event package only #$199</h4>
GRAB YOUR TICKETS <i class="fa fa-angle-right"></i>
</div>
</div>
<div class="item">
<img class="img-responsive" src="images/slider/bg3.jpg" alt="slider">
<div class="carousel-caption">
<h2>register for our next event </h2>
<h4>full event package only #$199</h4>
</i>
</div>
</div>
</div>
</div> -->
</section>
<!--/#home-->
<section id="explore">
<div class="container">
<div class="row">
<div class="watch">
<img class="img-responsive" src="images/watch.png" alt="">
</div>
<div class="col-md-4 col-md-offset-2 col-sm-5">
<h2>Upcoming Show<br>McLeod's Publick House</h2>
</div>
<div class="col-sm-7 col-md-6">
<ul id="countdown">
<li>
<span class="days time-font">00</span>
<p>days </p>
</li>
<li>
<span class="hours time-font">00</span>
<p class="">hours </p>
</li>
<li>
<span class="minutes time-font">00</span>
<p class="">minutes</p>
</li>
<li>
<span class="seconds time-font">00</span>
<p class="">seconds</p>
</li>
</ul>
</div>
</div>
<div class="cart">
<i class="fa fa-map-o"></i> <span>Get Directions</span>
</div>
</div>
</section><!--/#explore-->
<section id="event">
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-9">
<div id="event-carousel" class="carousel slide" data-interval="false">
<h2 class="heading">Explore</h2>
<a class="even-control-left" href="#event-carousel" data-slide="prev"><i class="fa fa-angle-left"></i></a>
<a class="even-control-right" href="#event-carousel" data-slide="next"><i class="fa fa-angle-right"></i></a>
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="col-sm-4">
<div class="single-event">
<img class="img-responsive" src="images/melodie-ricky.jpg" alt="Melodie and Ricky Rooker">
<h4>Melodie and Ricky Rooker</h4>
<h5>vocals, lead guitar</h5>
</div>
</div>
<div class="col-sm-4">
<div class="single-event">
<img class="img-responsive" src="images/loudboyz.jpg" alt="Melodie Rooker and the Loud Boyz">
<h4>Melodie Rooker</h4>
<h5>and the Loud Boyz</h5>
</div>
</div>
<div class="col-sm-4">
<div class="single-event">
<img class="img-responsive" src="images/mcleods-family.jpg" alt="We had such a blast playing at McLeod's Publick House in Dothan, AL last night! We got invited to be part of the family, which means our poster got autographed and put up on the wall!">
<h4>McLeod's Publick House</h4>
<h5>We became a part of the "family"</h5>
</div>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-sm-4">
<div class="single-event">
<img class="img-responsive" src="images/studio.jpg" alt="Melodie at FAME Studios in Muscle Shoals, Alabama">
<h4>FAME Studios</h4>
<h5>Muscle Shoals, AL</h5>
</div>
</div>
<div class="col-sm-4">
<div class="single-event">
<img class="img-responsive" src="images/ricky.jpg" alt="Ricky Rooker at FAME Studios in Muscle Shoals, Alabama">
<h4>FAME Studios</h4>
<h5>Muscle Shoals, AL</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="guitar">
<img class="img-responsive" src="images/guitar.png" alt="guitar">
</div>
</div>
</div>
</section><!--/#event-->
<section id="about">
<div class="guitar2">
<img class="img-responsive" src="images/guitar2.jpg" alt="guitar">
</div>
<div class="about-content">
<h2>Biography</h2>
<p><stron>Melodie Rooker is a singer/songwriter based out of Nashville, TN. She has been singing since the day she was old enough to hold a microphone, and has fronted bands in Missouri, Mississippi, and Tennessee. Her current band, the Loud Boyz, consists of a rhythm/lead guitar (Ricky Rooker), bass (Colton Everhart), and drums (Justin Parker). Melodie Rooker & the Loud Boyz play Country, Blues, & Rock 'n Roll (all the good stuff)! Their shows are extremely high energy and interactive. All in all, this 4-piece band packs a powerful punch!<br><br>Melodie & the Loud Boyz are signed with Old Dog's Records based out of Nashville, TN. They have been interviewed on KTXR FM 101.3 (The Outlaw), and Browne Hill Radio (Africa).<br><br>Melodie Rooker & the Loud Boyz can play up to a 5 hour show, and can tweak their set list to play what the particular crowd wants to hear. They are open to traveling anywhere, and are available now for booking.</strong></p>
</div>
</section><!--/#about-->
<section id="twitter">
<div class="container">
<div class="row">
<div class="col-md-12">
<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/293251580&color=ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false"></iframe>
</div>
</div>
</div>
</section><!--/#twitter-feed-->
<section id="contact">
<!-- <div id="map">
<div id="gmap-wrap">
<div id="gmap">
</div>
</div>
</div><!--/#map-->
<div class="contact-section">
<div class="ear-piece">
<img class="img-responsive" src="images/ear-piece.png" alt="">
</div>
<div class="container">
<div class="row">
<div class="col-sm-3 col-sm-offset-4">
<div class="contact-text">
<h3>Contact</h3>
<address>
E-mail: melodie#melodierookermusic.com<br>
Phone: (417) 771-9817<br>
</address>
</div>
<div class="contact-address">
<h3>Find me in</h3>
<address>
Nashville, TN
</address>
</div>
</div>
<div class="col-sm-5">
<div id="contact-section">
<h3>Send a message</h3>
<div class="status alert alert-success" style="display: none"></div>
<form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="sendemail.php">
<div class="form-group">
<input type="text" name="name" class="form-control" required="required" placeholder="Name">
</div>
<div class="form-group">
<input type="email" name="email" class="form-control" required="required" placeholder="Email">
</div>
<div class="form-group">
<textarea name="message" id="message" required="required" class="form-control" rows="4" placeholder="Enter your message"></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary pull-right">Send</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
<!--/#contact-->
<footer id="footer">
<div class="container">
<div class="text-center">
<p> Copyright ©2017 Melodie Rooker All Rights Reserved</p>
</div>
</div>
</footer>
<!--/#footer-->
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="js/gmaps.js"></script>
<script type="text/javascript" src="js/smoothscroll.js"></script>
<script type="text/javascript" src="js/jquery.parallax.js"></script>
<script type="text/javascript" src="js/coundown-timer.js"></script>
<script type="text/javascript" src="js/jquery.scrollTo.js"></script>
<script type="text/javascript" src="js/jquery.nav.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>
You are using Bootstrap, but you're not taking full advantage of Bootstrap's Grid System and positioning.
You can also check out Bootstrap Examples to find existing HTML structures that you can look at, copy and use.
In your case, the issue is that your .navbar-brand is using a fixed width instead of a responsive width set in percentages. This means that when you scale down the client window to Mobile size, your CSS still say that your .navbar-brand is suppose to be width: 435px;, which gives too little space for the button to appear on the same row.
If you don't want to use the Bootstrap Exampels that I linked to above, or the Bootstrap Grid System taht I also linked to above, you can solve this issue with a CSS Media Query.
For example:
#media(max-width: 767px) {
.navbar-brand {
width: 300px;
}
}
That would change the width of your .navbar-brand to 300px whenever the device has a smaller width than 768px (Usually considered mobile devices). However I suggest that you look at the two first links if you're already using Bootstrap.
Here is what I am trying to achieve
This is in my div's open state so normally you do not see any filters but instead just a full circle. What I am having trouble with is I dont know how to prevent a border on a small section.
Here is what I have below as well as a Codepen
.bold {
font-weight: bold;
}
.bp-purple {
color: #9696ff;
}
.bp-nyan {
color: #67cfd6;
}
.bp-pink {
color: #e49092;
}
.bp-green {
color: #96cf6b;
}
.filter-options {
text-align: center;
margin: 15px 0 0 0;
}
.filter-options__intro {
text-transform: uppercase;
display: inline-block;
border: 1px solid #222;
border-radius: 50%;
height: 80px;
width: 80px;
padding: 30px 0;
color: #222;
}
.filter-options__intro i {
margin: -5px 0 0 0;
display: block;
}
.filter-options__intro:hover {
color: #f93;
}
.filter-options__selections {
border: 1px solid #222;
position: relative;
bottom: 30px;
background: #FFF;
text-align: left;
padding: 15px;
margin: 0 0 -25px 0;
}
.filter-options__selections .list-inline, .filter-options__selections .checkbox {
font-weight: bold;
text-transform: uppercase;
}
.filter-options__selections input {
margin: 0;
}
.filter-options__selections .first {
font-size: 1.2em;
}
.filter-options__selections .dotted-line {
margin: 0 0 10px 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="filter-options">
<a href="" class="filter-options__intro">
<b class="center-block">Filters</b>
<i class="fa fa-caret-down" aria-hidden="true"></i>
</a>
<div class="filter-options__selections clearfix">
<div class="clearfix">
<ul class="list-inline pull-left">
<li class="first bp-purple">Categories:</li>
<li>Category 1</li>
<li>Category 2</li>
<li>Category 3</li>
<li>Category 4</li>
</ul>
<a class="pull-right bold" href="">View All <i class="fa fa-caret-right" aria-hidden="true"></i></a>
</div>
<div class="dotted-line"></div>
<div class="clearfix">
<ul class="list-inline pull-left">
<li class="first bp-nyan">Location:</li>
<li>Shanghai</li>
<li>Beijing</li>
<li>Hangzhou</li>
<li>Chengdu</li>
<li>Guangzhou</li>
<li>Shenzhen</li>
<li>Suzhou</li>
<li>Nanjing</li>
</ul>
<a class="pull-right bold" href="">View All <i class="fa fa-caret-right" aria-hidden="true"></i></a>
</div>
<div class="dotted-line"></div>
<div class="clearfix">
<ul class="list-inline pull-left">
<li class="first bp-pink">Brand:</li>
<li>Belle</li>
<li>St&Sat</li>
<li>Charles & Keith</li>
<li>Aldo</li>
<li>Daphne</li>
<li>Zara</li>
<li>Camel</li>
<li>Le Saunda</li>
<li>Tata</li>
</ul>
<a class="pull-right bold" href="">View All <i class="fa fa-caret-right" aria-hidden="true"></i></a>
</div>
<div class="dotted-line"></div>
<div class="clearfix">
<ul class="list-inline pull-left">
<li class="first bp-green">Price Range:</li>
<li>100 - 200</li>
<li>200 - 500</li>
<li>500 - 1000</li>
<li>1000 - 3000</li>
</ul>
</div>
<div class="dotted-line"></div>
<div class="checkbox">
<label>
<input type="checkbox" /> Show only free shipping products
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" /> Do not show international products
</label>
</div>
<div class="dotted-line"></div>
</div>
</div>
</div>
Edit
Added sass tag as my codepen is in sass but not sure if stack lets me use it in snippets
First you need to make <a> position relatively.
.filter-options__intro {
position: relative;
}
Then add an css after selector, to cover up the black line
a.filter-options__intro:after {
content: '';
display: block;
background: white;
z-index: 1111;
position: absolute;
width: 75px;
height: 1px;
bottom: 0px;
left: 0;
right: 0;
margin: auto;
top: 20px;
}
Working example:
Overlap element using CSS :after
Tried something that might help you:
Position the whole DOM of the link relative.
I had to use three DOM Elements to make it look like your output.
Positioned the content at z-index: 1.
Positioned others in higher z-index.
Gave a faux background.
* {
margin: 0;
padding: 0;
list-style: none;
line-height: 1;
text-decoration: none;
}
body {
background-color: #fff;
}
.center {
text-align: center;
position: relative;
z-index: 5;
}
.faux-cutter {
text-align: center;
display: inline-block;
overflow: hidden;
height: 30px;
border-bottom: 1px solid #fff;
position: relative;
z-index: 3;
background-color: #fff;
bottom: -2px;
}
.border {
padding: 10px 20px 30px;
display: inline-block;
border: 1px solid #666;
border-radius: 100%;
position: relative;
z-index: 4;
}
.content {
border: 1px solid #666;
padding: 25px;
text-align: center;
top: -2px;
position: relative;
z-index: 1;
}
<div class="center">
<div class="faux-cutter">
Hi
</div>
</div>
<div class="content">
Content here.
</div>
Preview
I would layer the semi-circle over the rectangle, and then I would add an inner absolutely positioned div to hide the bottom of the filters circle. You could do something like this:
.bold {
font-weight: bold;
}
.bp-purple {
color: #9696ff;
}
.bp-nyan {
color: #67cfd6;
}
.bp-pink {
color: #e49092;
}
.bp-green {
color: #96cf6b;
}
.filter-options {
text-align: center;
margin: 15px 0 0 0;
}
.filter-options__intro {
text-transform: uppercase;
display: inline-block;
border: 1px solid #222;
border-radius: 50%;
height: 80px;
width: 80px;
background: white;
padding: 30px 0;
margin-bottom: -25px;
color: #222;
}
.filter-options__intro i {
margin: -5px 0 0 0;
display: block;
}
.filter-options__intro:hover {
color: #f93;
}
.filter-options__selections {
border-top: 1px solid #222;
background: #FFF;
text-align: left;
}
.filter-options__selections-inner {
position:absolute;
border-left: 1px solid black;
border-right: 1px solid black;
border-bottom: 1px solid black;
left: 15px;
right: 15px;
background: white;
padding: 15px;
}
.filter-options__selections .list-inline,
.filter-options__selections .checkbox {
font-weight: bold;
text-transform: uppercase;
}
.filter-options__selections input {
margin: 0;
}
.filter-options__selections .first {
font-size: 1.2em;
}
.filter-options__selections .dotted-line {
margin: 0 0 10px 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="filter-options">
<a href="" class="filter-options__intro">
<b class="center-block">Filters</b>
<i class="fa fa-caret-down" aria-hidden="true"></i>
</a>
<div class="filter-options__selections clearfix">
<div class="filter-options__selections-inner">
<div class="clearfix">
<ul class="list-inline pull-left">
<li class="first bp-purple">Categories:</li>
<li>Category 1</li>
<li>Category 2</li>
<li>Category 3</li>
<li>Category 4</li>
</ul>
<a class="pull-right bold" href="">View All <i class="fa fa-caret-right" aria-hidden="true"></i></a>
</div>
<div class="dotted-line"></div>
<div class="clearfix">
<ul class="list-inline pull-left">
<li class="first bp-nyan">Location:</li>
<li>Shanghai</li>
<li>Beijing</li>
<li>Hangzhou</li>
<li>Chengdu</li>
<li>Guangzhou</li>
<li>Shenzhen</li>
<li>Suzhou</li>
<li>Nanjing</li>
</ul>
<a class="pull-right bold" href="">View All <i class="fa fa-caret-right" aria-hidden="true"></i></a>
</div>
<div class="dotted-line"></div>
<div class="clearfix">
<ul class="list-inline pull-left">
<li class="first bp-pink">Brand:</li>
<li>Belle</li>
<li>St&Sat</li>
<li>Charles & Keith</li>
<li>Aldo</li>
<li>Daphne</li>
<li>Zara</li>
<li>Camel</li>
<li>Le Saunda</li>
<li>Tata</li>
</ul>
<a class="pull-right bold" href="">View All <i class="fa fa-caret-right" aria-hidden="true"></i></a>
</div>
<div class="dotted-line"></div>
<div class="clearfix">
<ul class="list-inline pull-left">
<li class="first bp-green">Price Range:</li>
<li>100 - 200</li>
<li>200 - 500</li>
<li>500 - 1000</li>
<li>1000 - 3000</li>
</ul>
</div>
<div class="dotted-line"></div>
<div class="checkbox">
<label>
<input type="checkbox" />Show only free shipping products
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" />Do not show international products
</label>
</div>
<div class="dotted-line"></div>
</div>
</div>
</div>
</div>
You can't disable a portion of the border. I'd suggest adding a span to mask that particular part of the border with a small rectangular shape and z-index. Here is a forked pen with my changes.
I added a span with the class of 'mask' directly within your .filter-options div. <span class="mask"></span>.
Adding some CSS allowed me to build the shape of the mask using a solid white block. It will work as long as the background color remains white.
.mask {
background-color: white;
position: relative;
top: 4px;
z-index: 2;
width: 77px;
height: 3px;
display: block;
}
I'm trying to show a description when hovering over an image. I've already done it in a less than desirable way, using image sprites and hovers here: I want it to look exactly like how I have it, but using real text instead of an image.
I've tried a few different things but I can't seem to figure out how to do it. I'm trying to do it using HTML and CSS only, but I'm not sure if that's possible.
Feel free to poke around in my code, I'll paste what I think is relavent here.
HTML
div#projectlist {
width: 770px;
margin: 0 auto;
margin-top: 20px;
margin-bottom: 40px;
}
div#buzzbutton {
display: block;
float: left;
margin: 2px;
background: url(content/assets/thumbnails/design/buzz_sprite.jpg) 0 0px no-repeat;
width: 150px;
height: 150px;
}
div#buzzbutton:hover {
background: url(content/assets/thumbnails/design/buzz_sprite.jpg);
width: 150px;
height: 150px;
background-position: 0 -150px;
}
div#slinksterbutton {
display: block;
float: left;
background: url(content/assets/thumbnails/design/slinkster_sprite.jpg) 0 0px no-repeat;
width: 150px;
height: 150px;
margin: 2px;
}
div#slinksterbutton:hover {
background: url(content/assets/thumbnails/design/slinkster_sprite.jpg);
width: 150px;
height: 150px;
background-position: 0 -150px;
}
<div id="projectlist">
<div id="buzzbutton">
<img src="content/assets/thumbnails/transparent_150x150.png" alt="" />
</div>
<div id="slinksterbutton">
<img src="content/assets/thumbnails/transparent_150x150.png" alt="" />
</div>
</div>
It's simple. Wrap the image and the "appear on hover" description in a div with the same dimensions of the image. Then, with some CSS, order the description to appear while hovering that div.
/* quick reset */
* {
margin: 0;
padding: 0;
border: 0;
}
/* relevant styles */
.img__wrap {
position: relative;
height: 200px;
width: 257px;
}
.img__description {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(29, 106, 154, 0.72);
color: #fff;
visibility: hidden;
opacity: 0;
/* transition effect. not necessary */
transition: opacity .2s, visibility .2s;
}
.img__wrap:hover .img__description {
visibility: visible;
opacity: 1;
}
<div class="img__wrap">
<img class="img__img" src="http://placehold.it/257x200.jpg" />
<p class="img__description">This image looks super neat.</p>
</div>
A nice fiddle: https://jsfiddle.net/govdqd8y/
EDIT:
There's another option if you don't want to explicitly set the height of the <img> on the wrapping <div>, and that is simply setting the <div>'s display to inline-block. (Keep in mind, though, that it won't look good if the image fails to load.)
If you choose this option, you'll notice that there'll be a slight spacing between the <img> and the bottom of the wrapping <div>. That's because of the <img>'s default vertical-align value of baseline. If you set it to bottom it will disappear.
Here's a fiddle using this option: https://jsfiddle.net/joplomacedo/5cL31o0g/
In your HTML, try and put the text that you want to come up in the title part of the code:
<a href="buzz.html" title="buzz hover text">
You can also do the same for the alt text of your image.
You can also use the title attribute in your image tag
<img src="content/assets/thumbnails/transparent_150x150.png" alt="" title="hover text" />
This is what I use to make the text appear on hover:
* {
box-sizing: border-box
}
div {
position: relative;
top: 0px;
left: 0px;
width: 400px;
height: 400px;
border-radius: 50%;
overflow: hidden;
text-align: center
}
img {
width: 400px;
height: 400px;
position: absolute;
border-radius: 50%
}
img:hover {
opacity: 0;
transition:opacity 2s;
}
heading {
line-height: 40px;
font-weight: bold;
font-family: "Trebuchet MS";
text-align: center;
position: absolute;
display: block
}
div p {
z-index: -1;
width: 420px;
line-height: 20px;
display: inline-block;
padding: 200px 0px;
vertical-align: middle;
font-family: "Trebuchet MS";
height: 450px
}
<div>
<img src="https://68.media.tumblr.com/20b34e8d12d4230f9b362d7feb148c57/tumblr_oiwytz4dh41tf8vylo1_1280.png">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing <br>elit. Reiciendis temporibus iure dolores aspernatur excepturi <br> corporis nihil in suscipit, repudiandae. Totam.
</p>
</div>
.container {
position: relative;
width: 50%;
}
.image {
display: block;
width: 100%;
height: auto;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .5s ease;
background-color: #008CBA;
}
.container:hover .overlay {
opacity: 1;
}
.text {
color: white;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
<!DOCTYPE html>
<html>
<head></head>
<body>
<div class="container">
<img src="http://lorempixel.com/500/500/" alt="Avatar" class="image">
<div class="overlay">
<div class="text">Hello World</div>
</div>
</div>
</body>
</html>
Reference Link W3schools with multiple styles
HTML
<img id="close" className="fa fa-close" src="" alt="" title="Close Me" />
CSS
#close[title]:hover:after {
color: red;
content: attr(title);
position: absolute;
left: 50px;
}
I saw a lot of people use an image tag. I prefer to use a background image because I can manipulate it. For example, I can:
Add smoother transitions
save time not having to crop images by using the "background-size: cover;" property.
The HTML/CSS:
.overlay-box {
background-color: #f5f5f5;
height: 100%;
background-repeat: no-repeat;
background-size: cover;
}
.overlay-box:hover .desc,
.overlay-box:focus .desc {
opacity: 1;
}
/* opacity 0.01 for accessibility */
/* adjust the styles like height,padding to match your design*/
.overlay-box .desc {
opacity: 0.01;
min-height: 355px;
font-size: 1rem;
height: 100%;
padding: 30px 25px 20px;
transition: all 0.3s ease;
background: rgba(0, 0, 0, 0.7);
color: #fff;
}
<div class="overlay-box" style="background-image: url('https://via.placeholder.com/768x768');">
<div class="desc">
<p>Place your text here</p>
<ul>
<li>lorem ipsum dolor</li>
<li>lorem lipsum</li>
<li>lorem</li>
</ul>
</div>
</div>
<!DOCTYPE html><html lang='en' class=''>
<head><script src='//production-assets.codepen.io/assets/editor/live/console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/events_runner-73716630c22bbc8cff4bd0f07b135f00a0bdc5d14629260c3ec49e5606f98fdd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-2c0dc5167d60a5af3ee189d570b1835129687ea2a61bee3513dee3a50c115a77.js'></script><meta charset='UTF-8'><meta name="robots" content="noindex"><link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" /><link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" /><link rel="canonical" href="https://codepen.io/nelsonleite/pen/RaGwba?depth=everything&order=popularity&page=4&q=product&show_forks=false" />
<link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
<link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>
<style class="cp-pen-styles">.product-description {
transform: translate3d(0, 0, 0);
transform-style: preserve-3d;
perspective: 1000;
backface-visibility: hidden;
}
body {
color: #212121;
}
.container {
padding-top: 25px;
padding-bottom: 25px;
}
img {
max-width: 100%;
}
hr {
border-color: #e5e5e5;
margin: 15px 0;
}
.secondary-text {
color: #b6b6b6;
}
.list-inline {
margin: 0;
}
.list-inline li {
padding: 0;
}
.card-wrapper {
position: relative;
width: 100%;
height: 390px;
border: 1px solid #e5e5e5;
border-bottom-width: 2px;
overflow: hidden;
margin-bottom: 30px;
}
.card-wrapper:after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
transition: opacity 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.card-wrapper:hover:after {
opacity: 1;
}
.card-wrapper:hover .image-holder:before {
opacity: .75;
}
.card-wrapper:hover .image-holder:after {
opacity: 1;
transform: translate(-50%, -50%);
}
.card-wrapper:hover .image-holder--original {
transform: translateY(-15px);
}
.card-wrapper:hover .product-description {
height: 205px;
}
#media (min-width: 768px) {
.card-wrapper:hover .product-description {
height: 185px;
}
}
.image-holder {
display: block;
position: relative;
width: 100%;
height: 310px;
background-color: #ffffff;
z-index: 1;
}
#media (min-width: 768px) {
.image-holder {
height: 325px;
}
}
.image-holder:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #4CAF50;
opacity: 0;
z-index: 5;
transition: opacity 0.6s;
}
.image-holder:after {
content: '+';
font-family: 'Raleway', sans-serif;
font-size: 70px;
color: #4CAF50;
text-align: center;
position: absolute;
top: 92.5px;
left: 50%;
width: 75px;
height: 75px;
line-height: 75px;
background-color: #ffffff;
opacity: 0;
border-radius: 50%;
z-index: 10;
transform: translate(-50%, 100%);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
transition: all 0.4s ease-out;
}
#media (min-width: 768px) {
.image-holder:after {
top: 107.5px;
}
}
.image-holder .image-holder__link {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 15;
}
.image-holder .image-holder--original {
transition: transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.image-liquid {
width: 100%;
height: 325px;
background-size: cover;
background-position: center center;
}
.product-description {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 80px;
padding: 10px 15px;
overflow: hidden;
background-color: #fafafa;
border-top: 1px solid #e5e5e5;
transition: height 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
z-index: 2;
}
#media (min-width: 768px) {
.product-description {
height: 65px;
}
}
.product-description p {
margin: 0 0 5px;
}
.product-description .product-description__title {
font-family: 'Raleway', sans-serif;
position: relative;
white-space: nowrap;
overflow: hidden;
margin: 0;
font-size: 18px;
line-height: 1.25;
}
.product-description .product-description__title:after {
content: '';
width: 60px;
height: 100%;
position: absolute;
top: 0;
right: 0;
background: linear-gradient(to right, rgba(255, 255, 255, 0), #fafafa);
}
.product-description .product-description__title a {
text-decoration: none;
color: inherit;
}
.product-description .product-description__category {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.product-description .product-description__price {
color: #4CAF50;
text-align: left;
font-weight: bold;
letter-spacing: 0.06em;
}
#media (min-width: 768px) {
.product-description .product-description__price {
text-align: right;
}
}
.product-description .sizes-wrapper {
margin-bottom: 15px;
}
.product-description .color-list {
font-size: 0;
}
.product-description .color-list__item {
width: 25px;
height: 10px;
position: relative;
z-index: 1;
transition: all .2s;
}
.product-description .color-list__item:hover {
width: 40px;
}
.product-description .color-list__item--red {
background-color: #F44336;
}
.product-description .color-list__item--blue {
background-color: #448AFF;
}
.product-description .color-list__item--green {
background-color: #CDDC39;
}
.product-description .color-list__item--orange {
background-color: #FF9800;
}
.product-description .color-list__item--purple {
background-color: #673AB7;
}
</style></head><body>
<!--
Inspired in this dribbble
https://dribbble.com/shots/986548-Product-Catalog
-->
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-4">
<article class="card-wrapper">
<div class="image-holder">
<div class="image-liquid image-holder--original" style="background-image: url('https://upload.wikimedia.org/wikipedia/commons/2/24/Blue_Tshirt.jpg')">
</div>
</div>
<div class="product-description">
<!-- title -->
<h1 class="product-description__title">
<a href="#">
Adidas Originals
</a>
</h1>
<!-- category and price -->
<div class="row">
<div class="col-xs-12 col-sm-8 product-description__category secondary-text">
Men's running shirt
</div>
<div class="col-xs-12 col-sm-4 product-description__price">
€ 499
</div>
</div>
<!-- divider -->
<hr />
<!-- sizes -->
<div class="sizes-wrapper">
<b>Sizes</b>
<br />
<span class="secondary-text text-uppercase">
<ul class="list-inline">
<li>xs,</li>
<li>s,</li>
<li>sm,</li>
<li>m,</li>
<li>l,</li>
<li>xl,</li>
<li>xxl</li>
</ul>
</span>
</div>
<!-- colors -->
<div class="color-wrapper">
<b>Colors</b>
<br />
<ul class="list-inline color-list">
<li class="color-list__item color-list__item--red"></li>
<li class="color-list__item color-list__item--blue"></li>
<li class="color-list__item color-list__item--green"></li>
<li class="color-list__item color-list__item--orange"></li>
<li class="color-list__item color-list__item--purple"></li>
</ul>
</div>
</div>
</article>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<article class="card-wrapper">
<div class="image-holder">
<div class="image-liquid image-holder--original" style="background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/7/75/Jeans_BW_2_(3213391837).jpg/543px-Jeans_BW_2_(3213391837).jpg')">
</div>
</div>
<div class="product-description">
<!-- title -->
<h1 class="product-description__title">
<a href="#">
Adidas Originals
</a>
</h1>
<!-- category and price -->
<div class="row">
<div class="col-sm-8 product-description__category secondary-text">
Men's running shirt
</div>
<div class="col-sm-4 product-description__price text-right">
€ 499
</div>
</div>
<!-- divider -->
<hr />
<!-- sizes -->
<div class="sizes-wrapper">
<b>Sizes</b>
<br />
<span class="secondary-text text-uppercase">
<ul class="list-inline">
<li>xs,</li>
<li>s,</li>
<li>sm,</li>
<li>m,</li>
<li>l,</li>
<li>xl,</li>
<li>xxl</li>
</ul>
</span>
</div>
<!-- colors -->
<div class="color-wrapper">
<b>Colors</b>
<br />
<ul class="list-inline color-list">
<li class="color-list__item color-list__item--red"></li>
<li class="color-list__item color-list__item--blue"></li>
<li class="color-list__item color-list__item--green"></li>
<li class="color-list__item color-list__item--orange"></li>
<li class="color-list__item color-list__item--purple"></li>
</ul>
</div>
</div>
</article>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<article class="card-wrapper">
<div class="image-holder">
<div class="image-liquid image-holder--original" style="background-image: url('https://upload.wikimedia.org/wikipedia/commons/b/b8/Columbia_Sportswear_Jacket.jpg')">
</div>
</div>
<div class="product-description">
<!-- title -->
<h1 class="product-description__title">
<a href="#">
Adidas Originals
</a>
</h1>
<!-- category and price -->
<div class="row">
<div class="col-sm-8 product-description__category secondary-text">
Men's running shirt
</div>
<div class="col-sm-4 product-description__price text-right">
€ 499
</div>
</div>
<!-- divider -->
<hr />
<!-- sizes -->
<div class="sizes-wrapper">
<b>Sizes</b>
<br />
<span class="secondary-text text-uppercase">
<ul class="list-inline">
<li>xs,</li>
<li>s,</li>
<li>sm,</li>
<li>m,</li>
<li>l,</li>
<li>xl,</li>
<li>xxl</li>
</ul>
</span>
</div>
<!-- colors -->
<div class="color-wrapper">
<b>Colors</b>
<br />
<ul class="list-inline color-list">
<li class="color-list__item color-list__item--red"></li>
<li class="color-list__item color-list__item--blue"></li>
<li class="color-list__item color-list__item--green"></li>
<li class="color-list__item color-list__item--orange"></li>
<li class="color-list__item color-list__item--purple"></li>
</ul>
</div>
</div>
</article>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<article class="card-wrapper">
<div class="image-holder">
<div class="image-liquid image-holder--original" style="background-image: url('http://www.publicdomainpictures.net/pictures/20000/nahled/red-shoes-isolated.jpg')">
</div>
</div>
<div class="product-description">
<!-- title -->
<h1 class="product-description__title">
<a href="#">
Adidas Originals
</a>
</h1>
<!-- category and price -->
<div class="row">
<div class="col-sm-8 product-description__category secondary-text">
Men's running shirt
</div>
<div class="col-sm-4 product-description__price text-right">
€ 499
</div>
</div>
<!-- divider -->
<hr />
<!-- sizes -->
<div class="sizes-wrapper">
<b>Sizes</b>
<br />
<span class="secondary-text text-uppercase">
<ul class="list-inline">
<li>xs,</li>
<li>s,</li>
<li>sm,</li>
<li>m,</li>
<li>l,</li>
<li>xl,</li>
<li>xxl</li>
</ul>
</span>
</div>
<!-- colors -->
<div class="color-wrapper">
<b>Colors</b>
<br />
<ul class="list-inline color-list">
<li class="color-list__item color-list__item--red"></li>
<li class="color-list__item color-list__item--blue"></li>
<li class="color-list__item color-list__item--green"></li>
<li class="color-list__item color-list__item--orange"></li>
<li class="color-list__item color-list__item--purple"></li>
</ul>
</div>
</div>
</article>
</div>
</div>
</div>
</body></html>
The sample is made
<html>
<head>
<style>
.hide {
display: none;
}
.myDIV:hover + .hide {
display: block;
color: red;
}
</style>
</head>
<body>
<h2>Display an Element on Hover</h2>
<div class="myDIV">Hover over me.</div>
<div class="hide">I am shown when someone hovers over the div above.</div>
</body>
</html>
For accessibility reasons, you should use the correct semantic tags. Use a figure as a container and include the text to the image as figcaption.
Apply position: absolute to the container and then position: absolute to the figcaption.
Simply hide the figcaption with display: block and make it visible again by using :hover on the wrapping figure element.
figure {
position: relative;
}
figcaption {
position: absolute;
inset: 2px;
display: none;
}
figure:hover figcaption {
display: flex;
}
/* for visualization only */
figure {
display: inline-block;
}
figcaption {
padding: 1em;
justify-content: center;
align-items: center;
background-color: rgba(255, 255, 255, 0.7);
}
img {
border: 2px dashed red;
}
<figure>
<img src="https://via.placeholder.com/200.jpg" alt="placeholder image used for demonstration">
<figcaption>placeholder image used for demonstration</figcaption>
</figure>