Search results gets cut off by navbar (parent div) - css

I've been trying to solve this for two straight days and didn't get it right yet. I basically have a search input inside a nav with results coming from a json file and even though it has a z-index greater than the nav it still gets cut off.
<nav class="navbar">
<ul class="navul">
<li>
<a href="index.html" style="margin: 0; margin-top: 0;">
<img src="logo.png" width="40" height="40">
</a>
</li>
<li>Link1</li>
<li><a style="position: relative;" class="active" href="#">Link</a></li>
<li>Link</li>
<li><div class="search-container">
<form action="" autocomplete="off">
<input autocomplete="off" type="text" name="search" id="search" class="form-control">
<ul class="list-group" id="result"></ul> <- this is the result box
</form>
</div>
</li>
</ul>
</nav>
Here is the CSS with the navbar, the content which goes under it and the search result box
.navbar {
margin: 0;
padding: 0;
overflow: hidden;
width: 100%;
backdrop-filter: blur(20px);
background: rgba(255, 255, 255, 0.1);
position: fixed;
z-index: 1;
}
.navul {
list-style-type: none;
margin: 0;
padding: 0;
padding-left: 2%;
padding-right: 2%;
position: relative;
overflow: hidden;
}
.navul li {
float: left;
padding: 3px;
}
.navul a {
display: block;
color: rgba(255, 255, 255, 0.5);
text-align: center;
padding: 18px 20px;
margin: .4em;
text-decoration: none;
transition: all 0.12s ease-in-out 0s;
}
.content {
float: left;
width: 96%;
color: black;
margin-top: 8%;
margin-bottom: 8%;
margin-left: 2%;
margin-right: 2%;
position: relative;
}
#result {
position: absolute;
width: 40%;
max-width:870px;
cursor: pointer;
overflow-y: auto;
max-height: 400px;
box-sizing: border-box;
z-index: 1001;
}

Related

CSS Animation for a Vertical Line Going Upwards

i am trying to create a CSS Animation for a vertical line going upwards - the line should be within a specific div
I have used gsap - i have used as well ypercent field, however the line starts from below the FirstScene div while i need it to be contained within the FirstScene div
gsap.fromTo(".vertical-line",{ yPercent:10 }, {yPercent:0,duration: 5});
* {
margin: 0;
padding: 0
}
.topnav {
position: sticky;
top: 0;
font-size: x-large;
background-color: black;
position: -webkit-sticky;
overflow: hidden;
z-index: 1;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: black;
}
li {
float: right;
padding: 8px;
color: white;
display: inline;
}
linkStyle {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li i {
color: white;
text-decoration: none;
}
li a {
color: white;
text-decoration: none;
}
#li-left {
float: left;
}
body {
margin: 0px;
height: 100%;
}
.FirstScene {
background-color: black;
position: absolute;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
}
.line {
left: 50%;
top: 50%;
width=10px;
height: 50%;
position: absolute;
}
.vertical-line {
border-left: 6px solid blue;
height: 100%;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.3/gsap.min.js"></script>
<div class="topnav">
<ul>
<li id="li-left">
<Link to="/" class="linkStyle"> MINA IBRAHIM
</Link>
</li>
<li>
<a href="https://github.com/ibrahimmina">
<i class="fa-brands fa-github"></i>
</a>
</li>
<li>
<a href="https://www.linkedin.com/in/minasamyibrahim/">
<i class="fa-brands fa-linkedin"></i>
</a>
</li>
<li>
.email()
</li>
<li>
<Link to="/about" class="linkStyle"> .about()
</Link>
</li>
</ul>
</div>
<body>
<section class="FirstScene">
<div class="line">
<div class="vertical-line">
</div>
</div>
</section>
</body>
Please use the bellow css for the Vertical Line Going Upwards animations
.FirstScene{
background-color: black;
position:absolute;
top:0px;
right:0px;
bottom:0px;
left:0px;
}
.vertical-line{
border-left: 6px solid blue;
animation-name: line;
animation-duration: 5s;
animation-iteration-count: 1;
left: 0;
height: 50%;
width: 10px;
position: absolute;
bottom: 0;
right: 0;
margin: 0 auto;
}
#keyframes line{
0%{
height: 0px;
}
100%{
height: 50%;
}
}

How do I get the menu to have a scroll

My menu box has more content to show but i cannot scroll down to see that content , it just disappears. I have tried doing overflow-y: auto; but does not work.
Here is my code
<div class="nav-cont d-flex align-items-center justify-content-end">
<div class="col-md-3">
<div class="hamburger-menu">
<input id="menu__toggle" type="checkbox" />
<label class="menu__btn" for="menu__toggle">
<span></span>
</label>
<ul class="menu__box d-flex flex-column ">
<div class="menu-title-container d-flex align-items-center justify-content-center">
<p class="menu-title">Most Popular</p>
</div>
<div class="menu-line-break"></div>
<li><a class="menu__item" href="#">Batteries</a></li>
<li><a class="menu__item" href="#">Engine Oil</a></li>
<li><a class="menu__item" href="#">Spark Plugs</a></li>
<li><a class="menu__item" href="#">Tyres</a></li>
<li class="menu-btn-expand"><a class="menu__item" href="#">Show More</a></li>
<div class="menu-line-break"></div>
<div class="menu-title-container d-flex align-items-center justify-content-center">
<p class="menu-title">Shop Deals</p>
</div>
<div class="menu-line-break"></div>
<li><a class="menu__item" href="#">Top Deals</a></li>
<div class="menu-line-break"></div>
<div class="menu-title-container d-flex align-items-center justify-content-center">
<p class="menu-title">Shop By</p>
</div>
<div class="menu-line-break"></div>
<li><a class="menu__item" href="#">By Make</a></li>
<li><a class="menu__item" href="#">By Model</a></li>
<div class="menu-line-break"></div>
<div class="menu-title-container d-flex align-items-center justify-content-center">
<p class="menu-title">Trustworthy Advice</p>
</div>
</ul>
</div>
</div>
Here is the CSS
/*Hamburger Menu*/
#menu__toggle {
opacity: 0;
}
#menu__toggle:checked ~ .menu__btn > span {
transform: rotate(45deg);
}
#menu__toggle:checked ~ .menu__btn > span::before {
top: 0;
transform: rotate(0);
}
#menu__toggle:checked ~ .menu__btn > span::after {
top: 0;
transform: rotate(90deg);
}
#menu__toggle:checked ~ .menu__box {
visibility: visible;
left: 0;
}
.menu__btn {
display: flex;
align-items: center;
position: relative;
top: -1rem;
left: 3rem;
width: 26px;
height: 26px;
cursor: pointer;
z-index: 1;
}
.menu__btn > span,
.menu__btn > span::before,
.menu__btn > span::after {
display: block;
position: absolute;
width: 100%;
height: 5px;
background-color: #616161;
transition-duration: 0.25s;
}
.menu__btn > span::before {
content: "";
top: -8px;
}
.menu__btn > span::after {
content: "";
top: 8px;
}
.menu__box {
display: block;
position: fixed;
visibility: hidden;
left: -100%;
width: 300px;
height: 100%;
margin: 0;
padding: 1rem 0;
list-style: none;
background-color: #fff;
box-shadow: 1px 0px 6px rgba(0, 0, 0, 0.2);
border-right: 1px solid black;
border-top: 1px solid black;
overflow-y: auto;
transition-duration: 0.25s;
}
.menu__box li a {
font-size: 0.8rem;
font-family: "Poppins";
}
.menu__item {
display: block;
padding: 12px 24px;
color: #333;
font-family: "Roboto", sans-serif;
font-size: 20px;
font-weight: 600;
text-decoration: none;
border-top: none;
transition-duration: 0.25s;
}
.menu__item:hover {
background-color: #f5f5f5;
}
.menu-line-break {
background-color: #f5f5f5;
width: 80%;
height: 0.2rem;
margin: 0.5rem auto;
}
.menu-btn-expand {
text-decoration: underline;
}
.menu-title-container {
width: 100%;
}
I appreciate the help in advance. Thank you. I do not know where the problem is from , I am a bit new to this .
I removed the overflow-y: auto; and added overflow: auto; removing the hidden part from either side.
.menu__box {
display: block;
position: fixed;
visibility: hidden;
left: -100%;
width: 300px;
height: calc(100% - 100px);
margin: 0;
padding: 1rem 0;
list-style: none;
background-color: #fff;
box-shadow: 1px 0px 6px rgba(0, 0, 0, 0.2);
border-right: 1px solid black;
border-top: 1px solid black;
overflow: auto;
transition-duration: 0.25s;
}

CSS-only push nav won't hide

I'm using a css-only push nav. It works great, however I can't figure out how to make the menu hide away when a nav link is clicked. You have to manually click the menu icon for the menu to go back into hiding. However, when a link is clicked and the site jumps to a section, I want the menu to slide into hiding automatically.
Here's a fiddle of it:
http://jsfiddle.net/ex7jthnn/28/
html:
<input type="checkbox" id="menu" name="menu" class="menu-checkbox">
<div class="menu">
<label class="menu-toggle" for="menu"><span>Toggle</span></label>
<ul class="mainnav">
<li><a class="text-right" href="#about">ABOUT</a></li>
<li><a class="text-right" href="#process">PROCESS</a></li>
<li><a class="text-right" href="#work">WORK</a></li>
<li><a class="text-right" href="#contact">CONTACT</a></li>
</ul>
</div>
CSS:
label{
cursor: pointer;
&:focus;
outline: none;
}
.menu{
position: fixed;
top: 0;
left: 0;
background-color: rgba(111, 206, 204, 0.7);
width: 240px;
height: 100%;
z-index: 10;
}
label.menu-toggle{
position: absolute;
right: -60px;
width: 75px;
height: 90px;
line-height: 0px;
display: block;
margin-top: 30px;
margin-right: -50px;
padding: 0px 0px 0px 20px;
text-indent: -9999px;
background: 50% 50% / 45px 32px no-repeat;
background-image:url(../images/menu.png);
}
a, label{
display: block;
text-align: center;
line-height: 50px;
text-decoration: none;
}
.menu-checkbox{
display: none;
}
.menu .menu label.menu-toggle{
background: none;
}
.menu-checkbox:checked + .menu{
transform: translate3d(0, 0, 0);
-webkit-transition: translate3d(0, 0, 0);
}enter code here
Try to add this piece of code into your website, it should make the job done.
$('ul.mainnav > li > a').on('click', function(e){
$('#menu').prop('checked', false);
});

Getting overflow auto to work on a list of buttons

I've been trying to get this list of buttons to have a scroll bar and scroll on table and smaller screens. I've add two divs for inner and outter to add overflow: hidden on outter and overflow: auto on inner. I can't seem to get this to work. Can anyone tell me what I'm missing?
Created a JSFiddle as asked and it works here. Maybe it is an issue with my SASS
http://jsfiddle.net/tuckerjoenz/p9afq4y9/
HTML
<div class="circle-outer">
<div class="circle-button-menu-container">
<ul class="field field-name-field-link-button field-type-entityreference field-label-hidden">
<li class="link-button">
<span property="dc:title" class="rdf-meta element-hidden"></span>
<a class="circle-button" href="#parents">
<div class="circle-image">
<img class="active" src="../images/Parent_2_0.jpg">
</div>
<div class="button-title">Parents</div>
</a>
</li>
<li class="link-button">
<span property="dc:title" class="rdf-meta element-hidden"></span>
<a class="circle-button" href="#kids">
<div class="circle-image">
<img class="active" src="../images/kids_JPEG_0.jpg">
</div>
<div class="button-title">Kids</div>
</a>
</li>
<li class="link-button">
<span property="dc:title" class="rdf-meta element-hidden"></span>
<a class="circle-button" href="#educators">
<div class="circle-image">
<img class="active" src="../images/Educator_JPEG_0.jpg">
</div>
<div class="button-title">Educators</div>
</a>
</li>
<li class="link-button">
<span property="dc:title" class="rdf-meta element-hidden"></span>
<a class="circle-button" href="#volunteer">
<div class="circle-image">
<img class="active" src="../images/volunteer_JPEG_0.jpg">
</div>
<div class="button-title">Volunteer</div>
</a>
</li>
</ul>
</div>
</div>
SASS
.circle-outer {
height: 350px;
display: block;
margin: 0 auto;
width: 100%;
margin-top: -200px;
padding: 100px 0px 0px;
overflow: hidden;
.circle-button-menu-container {
overflow: auto;
.field-name-field-link-button {
text-align: center;
display: block;
width: 1000%;
z-index: 100;
list-style-type: none;
position: absolute;
-webkit-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
transform-style: preserve-3d;
.link-button {
margin: 0px 46px 10px;
float: left;
text-decoration: none;
list-style: none;
position: relative;
display: block;
width: 170px;
a.circle-button {
display: block;
text-decoration: none;
.circle-image {
border: 10px solid white;
border-radius: 50%;
box-shadow: 0 4px 2px -2px gray;
overflow: hidden;
width: 170px;
height: 170px;
img {
display: block;
min-width: 100%;
min-height: 100%;
width: 100%;
}
&:hover, &:active {
border: 10px solid #b6b6b6;
box-shadow: none;
}
}
.button-title {
text-transform: uppercase;
color: #40749e;
font-weight: bold;
font-size: 1.3em;
margin-top: 10px;
}
&:before, &:after {
content: "";
position: absolute;
width: 0;
height: 0;
border-style: solid;
border-color: transparent;
border-bottom: 0;
}
&:before {
bottom: -33px;
left: 39%;
border-top-color: #b6b6b6;
border-width: 17px;
}
&:after {
bottom: -28px;
left: 40%;
border-top-color: #fff;
border-width: 15px;
}
}
}
}
}
}
Ok I figured this out. I had to remove the position: absolue on the .circle-button-menu-container class and it works! Thanks!
You could try overflow:scroll

why the input dislocation in IE?it's ok in firefox and chrome

why the input dislocated in IE? It's ok in Firefox and Chrome. The input does not appear to the right under the image. Since I can't post images here, I'll put "xxx" instead of the image url in the code and css and a screenshot url in the comment. Thanks a lot
<li class="img">
<div class="pic">
<img width="117px" height="70px" src="attachment/201202/21/1_1329785854VWAO.jpg.thumb.jpg">
<div class="remove" style="display: none;">
</div>
</div>
<input type="text" placeholder="say something" value="" class="txt">
</li>
li.img {
background: none repeat scroll 0 0 #FFFFFF;
height: 102px;
overflow: visible;
padding: 0 4px;
position: relative;
width: 117px;
}
li {
float: left;
margin-left: 10px;
}
li {
list-style: none outside none;
}
.pic {
margin-bottom: 5px;
overflow: hidden;
}
.txt {
border: 1px solid #DEDEDE;
color: #999999;
float: left;
height: 20px;
line-height: 20px;
margin-left: 0;
padding-left: 6px;
width: 108px;
}
Put the text input box in its own div and float the div to the left:
<li class="img">
<div class="pic">
<img width="117px" height="70px" src="attachment/201202/21/1_1329785854VWAO.jpg.thumb.jpg">
<div class="remove" style="display: none;">
</div>
</div>
<div class="txt">
<input type="text" placeholder="say something" value="" class="txt" >
</div>
</li>
li.img {
background: none repeat scroll 0 0 #FFFFFF;
height: 102px;
overflow: visible;
padding: 0 4px;
position: relative;
width: 117px;
}
li {
float: left;
margin-left: 10px;
}
li {
list-style: none outside none;
}
.pic {
margin-bottom: 5px;
overflow: hidden;
}
div.txt {
float: left;
}
input.txt {
border: 1px solid #DEDEDE;
color: #999999;
height: 20px;
line-height: 20px;
margin-left: 0;
padding-left: 6px;
width: 108px;
}

Resources