My search suggestion box is not flowing all the way into the section below rather it is resizing the whole navbar. The search input is in the navigation bar. I want the search suggestions to just flow in the divs below. I have tried all the overflow property values but it is not giving me what I want.
.search-box {
position: relative;
}
.nav-search {
width: 260px;
}
.autocom-box {
background-color: white;
color: black;
width: 260px;
/* padding: 10px 8px; */
max-height: 280px;
overflow-y: auto;
border-radius: 5px;
/* opacity: 0; */
/* pointer-events: none; */
}
.search-box li {
list-style: none;
padding: 8px 12px;
cursor: default;
border-radius: 3px;
width: 100%;
/* display: none; */
overflow: auto;
}
.search-box li:hover {
background: #efefef;
}
.search-btn {
height: 38px;
width: 38px;
line-height: 38px;
position: absolute;
top: 0;
right: 0;
text-align: center;
cursor: pointer;
color: black;
margin-right: 10px;
border: none;
background: none;
}
<form class="d-flex ms-auto" action="/" method="post">
<div class="search-box">
<input
class="form-control me-2 nav-search"
autocomplete="off"
name="search"
placeholder="Type to Search..."
/>
<div class="autocom-box">
<li>Avengers</li>
<li>Avengers</li>
<li>Avengers</li>
<li>Avengers</li>
</div>
<button class="search-btn" type="submit">
<i class="fas fa-search"></i>
</button>
</div>
</form>
I've tried giving the full navbar max-height but then it tries to keep everything inside of it so it just pushes the search-box so high up it disappears.
And I've also tried position: absolute; but even that doesn't work it just messes everything up.
Adding position: absolute; to the pop-out window (.autocom-box) should just about do the trick:
.search-box {
position: relative;
border: 2px solid black;
}
.nav-search {
width: 260px;
}
.autocom-box {
position: absolute; /* This is the change */
background-color: white;
border: 2px solid red;
color: black;
width: 260px;
/* padding: 10px 8px; */
max-height: 280px;
overflow-y: auto;
border-radius: 5px;
/* opacity: 0; */
/* pointer-events: none; */
}
.search-box li {
list-style: none;
padding: 8px 12px;
cursor: default;
border-radius: 3px;
width: 100%;
/* display: none; */
overflow: auto;
}
.search-box li:hover {
background: #efefef;
}
.search-btn {
height: 38px;
width: 38px;
line-height: 38px;
position: absolute;
top: 0;
right: 0;
text-align: center;
cursor: pointer;
color: black;
margin-right: 10px;
border: none;
background: none;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.2/css/all.min.css">
<form class="d-flex ms-auto" action="/" method="post">
<div class="search-box">
<input
class="form-control me-2 nav-search"
autocomplete="off"
name="search"
placeholder="Type to Search..."
/>
<div class="autocom-box">
<li>Avengers</li>
<li>Avengers</li>
<li>Avengers</li>
<li>Avengers</li>
</div>
<button class="search-btn" type="submit">
<i class="fas fa-search"></i>
</button>
</div>
</form>
(The black border is the nav bar itself, the red border is the search window)
Related
I am trying to fix the custom dropdown arrow size but when i zoom in or zoom out webpage size of custom dropdown also changed.. Is there any solution for that??
This is current web page
When I zoom in or zoom out custom arrow size will be changed..
Here is my code :-
.container select {
border-radius: 20px;
padding: 5px 38px 7px 23px;
border: 2px solid orange;
appearance: none;
position: relative;
}
.container i.fa-angle-down {
position: absolute;
right: 69%;
top: 92.5%;
border-radius: 20px;
color: white;
background-color: orange;
padding: 8px;
padding-left: 10px;
font-size: 20px;
pointer-events: none;
}
<div class="container">
<h6>Current open positions</h6>
<div class="form-group">
<label class="search">Search by Location</label>
<select>
<option>Canada</option>
<option>USA</option>
</select><i class="fas fa-angle-down"></i>
</div>
</div>
Supply a relative container to act as a boundary for the absolute positioned child. Something like below, cheers;
.container select {
border-radius: 20px;
padding: 5px 38px 7px 23px;
border: 2px solid orange;
appearance: none;
position: relative;
}
.container i.fa-angle-down {
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 1rem;
border-radius: 20px;
color: white;
background-color: orange;
padding: 8px;
padding-left: 10px;
font-size: 20px;
pointer-events: none;
}
.custom-dd {
display: inline-block;
position: relative;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.1/css/all.min.css" rel="stylesheet"/>
<div class="container">
<h6>Current open positions</h6>
<div class="form-group">
<label class="search">Search by Location</label>
<div class="custom-dd">
<select>
<option>Canada</option>
<option>USA</option>
</select>
<i class="fas fa-angle-down"></i>
</div>
</div>
</div>
I'm trying to create a responsive log in page for a college, but when I resize the window vertically the logo and basically the top part disappears.
Currently I'm designing for an iPhone 7 using the dev tools in Google Chrome to help me with the view. When I open the website on my Huawei phone and tap the password field the keyboard pushes the page up and the logo partially disappears. This does not happen on my iPhone.
I think the problem is somewhere in my div elements. Sorry if its a dumb question, I'm a beginner.
Website: https://borislav1333.000webhostapp.com/
body
{
margin: 0;
}
img
{
max-width: 300px;
position: absolute;
top: 60px;
left: 37px;
z-index: 1;
}
.container
{
width: 375px;
height: 667px;
background-color: white;
margin: auto;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font-family: Georgia;
}
.form-back
{
width: 200px;
background-color: white;
z-index: 1;
margin: 0 auto;
padding: 45px;
position: absolute;
top: 80%;
left: 50%;
transform: translate(-50%, -80%);
text-align: center;
font-size: 18px;
}
input[type=text], input[type=password]
{
width: 100%;
padding: 10px;
margin: 8px 0px 8px;
border: solid 1px #aaa;
border-radius: 4px;
}
button
{
width: 100%;
height: 50px;
border: none;
border-radius: 30px;
border-color: white;
background-color: #e52791;
font-family: Georgia;
transition: background-color 0.7s ease-out;
}
button:hover
{
background-color: #02356a;
color: white;
transition: background-color 0.7s ease;
}
.submit
{
position: relative;
top: 30px;
}
::placeholder
{
font-family: georgia;
}
<div class="container">
<div class="img"><img src="logo.jpg"></div>
<div class="form-back">
<form action="message.html" onsubmit="return validation()">
<div>
<label for="accountNum">Metric Number</label><br>
<input type="text" id="accountNum" name="accountNum" placeholder="Metric Number..."><br>
</div>
<div>
<label for="surname">Password:</label><br>
<input type="password" id="surname" name="surname" placeholder="Password..."><br>
</div>
<div class="submit">
<button type="submit">Log In</button>
</div>
</div>
</div>
As per your code you have used position absolute value in many elements. I think this problem which you are facing is happening due to this absolute. I have updated your CSS code and added snippet below. Replace it and check, I wish you problem will be resolved :
body
{
margin: 0;
}
img
{
width: 100%;
max-width: 300px;
z-index: 1;
margin: 0 auto;
}
.container
{
margin: 0 auto;
font-family: Georgia;
text-align: center;
}
.form-back
{
width: 100%;
background:transparent;
margin: 0 auto;
padding: 45px;
text-align: center;
font-size: 18px;
}
input[type=text], input[type=password]
{
width: 100%;
padding: 10px;
margin: 8px 0px 8px;
border: solid 1px #aaa;
border-radius: 4px;
}
button
{
width: 100%;
height: 50px;
border: none;
border-radius: 30px;
border-color: white;
background-color: #e52791;
font-family: Georgia;
transition: background-color 0.7s ease-out;
}
button:hover
{
background-color: #02356a;
color: white;
transition: background-color 0.7s ease;
}
.submit
{
position: relative;
top: 30px;
}
::placeholder
{
font-family: georgia;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<div class="container">
<div class="img"><img src="https://borislav1333.000webhostapp.com/logo.jpg"></div>
<div class="form-back">
<form action="message.html" onsubmit="return validation()">
<div>
<label for="accountNum">Metric Number</label><br>
<input type="text" id="accountNum" name="accountNum" placeholder="Metric Number..."><br>
</div>
<div>
<label for="surname">Password:</label><br>
<input type="password" id="surname" name="surname" placeholder="Password..."><br>
</div>
<div class="submit">
<button type="submit">Log In</button>
</div>
</form>
</div>
</div>
There seems to be a gap between the footer and main body. i want the body to touch the footer, as seen i want it to completely fill up the space in the middle.
https://ibb.co/dUpFJF
#charset "utf-8";
/* CSS Document */
body {
font-family: 'Droid Sans', sans-serif;
margin-top: 0px;
margin-left: 0px;
margin-right: 0px;
margin-bottom: 0px;
min-height: 100%;
}
.div_top1 {
height: 30px;
margin: 0 auto;
width: 100%;
border-bottom: 1px solid #FFF;
background-color: #2d2d2d;
}
.div_top2 {
height: 150px;
width: 100%;
background-color: #072135;
}
.main_container {
width: 100%;
margin: 0 auto;
background-color: #FFF;
overflow: auto;
min-height: 100%;
display: inline-block;
}
.container_right {
height: 100%;
padding-left: 20px;
margin: 0 auto;
}
.container_left {
float: left;
text-align: left;
border-right: 2px solid #5a5c5d;
border-bottom: 1px solid #5a5c5d;
height: 100%;
overflow: hidden;
}
.bk {
border-top: 4px solid #da6161;
display: table;
height: 200px;
margin: 0 auto;
margin-top: 30px;
padding: 8px;
}
.icon {
float: left;
display: block;
}
.icon-bar {
width: 70px;
/* Set a specific width */
background-color: #FFF;
/* Dark-grey background */
height: 100%;
}
.icon-bar a {
display: block;
/* Make the links appear below each other instead of side-by-side */
text-align: center;
/* Center-align text */
padding: 16px;
/* Add some padding */
transition: all 0.3s ease;
/* Add transition for hover effects */
color: black;
/* White text color */
font-size: 27px;
/* Increased font-size */
height: 100%;
}
.icon-bar a:hover {
background-color: #5a5c5d;
/* Add a hover color */
}
.active {
background-color: #818384;
/* Add an active/current color */
}
<style>
/* Tooltip container */
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
/* If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
width: auto;
background-color: #da6161;
color: #fff;
text-align: center;
padding: 5px;
border-radius: 6px;
font-size: 20px;
/* Position the tooltip text - see examples below! */
position: absolute;
z-index: 1;
margin-left: 36px;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
}
.foot {
background-color: #2d2d2d;
position: absolute;
color: #FFF;
text-align: center;
left: 0;
bottom: 0;
height: 35px;
width: 100%;
border-top: 3px solid #9c9d9e;
padding-top: 3px;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<body>
<div class="div_top2"> </div>
<div class="main_container">
<div class="container_left">
<div class="icon_menu">
<div class="icon-bar">
<a class="active tooltip" href="#">
<span class="tooltiptext">Home</span>
<i class="fa fa-home"></i>
</a>
<a class="tooltip" href="#">
<span class="tooltiptext">My Story</span>
<i class="fa fa-black-tie"></i>
</a>
<a href="#" class="tooltip">
<span class="tooltiptext">Companies</span>
<i class="fa fa-building"></i>
</a>
<a href="#" class="tooltip">
<span class="tooltiptext">Blog</span>
<i class="fa fa-paper-plane"></i>
</a>
<a href="#" class="tooltip">
<span class="tooltiptext">Ask Me Anything</span>
<i class="fa fa-quora"></i>
</a>
<a href="#" class="tooltip">
<span class="tooltiptext">Contact</span>
<i class="fa fa-address-card"></i>
</a>
</div>
</div>
</div>
<div class="container_right">
<div class="bk"></div>
</div>
</div>
<div class="foot">
Copyright 2017
</div>
When using floats you disturb the normal document flow. Change the definition of .foot as follows:
#charset "utf-8";
/* CSS Document */
body {
font-family: 'Droid Sans', sans-serif;
margin-top: 0px;
margin-left: 0px;
margin-right: 0px;
margin-bottom: 0px;
min-height: 100%;
}
.div_top1 {
height: 30px;
margin: 0 auto;
width: 100%;
border-bottom: 1px solid #FFF;
background-color: #2d2d2d;
}
.div_top2 {
height: 150px;
width: 100%;
background-color: #072135;
}
.main_container {
width: 100%;
margin: 0 auto;
background-color: #FFF;
overflow: auto;
min-height: 100%;
display: inline-block;
}
.container_right {
height: 100%;
padding-left: 20px;
margin: 0 auto;
}
.container_left {
float: left;
text-align: left;
border-right: 2px solid #5a5c5d;
border-bottom: 1px solid #5a5c5d;
height: 100%;
overflow: hidden;
}
.bk {
border-top: 4px solid #da6161;
display: table;
height: 200px;
margin: 0 auto;
margin-top: 30px;
padding: 8px;
}
.icon {
float: left;
display: block;
}
.icon-bar {
width: 70px;
/* Set a specific width */
background-color: #FFF;
/* Dark-grey background */
height: 100%;
}
.icon-bar a {
display: block;
/* Make the links appear below each other instead of side-by-side */
text-align: center;
/* Center-align text */
padding: 16px;
/* Add some padding */
transition: all 0.3s ease;
/* Add transition for hover effects */
color: black;
/* White text color */
font-size: 27px;
/* Increased font-size */
height: 100%;
}
.icon-bar a:hover {
background-color: #5a5c5d;
/* Add a hover color */
}
.active {
background-color: #818384;
/* Add an active/current color */
}
<style>
/* Tooltip container */
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
/* If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
width: auto;
background-color: #da6161;
color: #fff;
text-align: center;
padding: 5px;
border-radius: 6px;
font-size: 20px;
/* Position the tooltip text - see examples below! */
position: absolute;
z-index: 1;
margin-left: 36px;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
}
.foot {
background-color: #2d2d2d;
color: #FFF;
text-align: center;
float: left;
height: 35px;
width: 100%;
border-top: 3px solid #9c9d9e;
padding-top: 3px;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<body>
<div class="div_top2"> </div>
<div class="main_container">
<div class="container_left">
<div class="icon_menu">
<div class="icon-bar">
<a class="active tooltip" href="#">
<span class="tooltiptext">Home</span>
<i class="fa fa-home"></i>
</a>
<a class="tooltip" href="#">
<span class="tooltiptext">My Story</span>
<i class="fa fa-black-tie"></i>
</a>
<a href="#" class="tooltip">
<span class="tooltiptext">Companies</span>
<i class="fa fa-building"></i>
</a>
<a href="#" class="tooltip">
<span class="tooltiptext">Blog</span>
<i class="fa fa-paper-plane"></i>
</a>
<a href="#" class="tooltip">
<span class="tooltiptext">Ask Me Anything</span>
<i class="fa fa-quora"></i>
</a>
<a href="#" class="tooltip">
<span class="tooltiptext">Contact</span>
<i class="fa fa-address-card"></i>
</a>
</div>
</div>
</div>
<div class="container_right">
<div class="bk"></div>
</div>
</div>
<div class="foot">
Copyright 2017
</div>
you made the footer element absolutely positioned relative to parent(body tag).
try wrapping your code in a after element
html
<body>
<div class="wrapper">
<!-- your code here -->
</div>
</body>
css
.wrapper
{
position:relative;
}
hope this works...
I have a textbox and a validation message assigned to it. I am trying to put the validation message inline to the textbox, but it comes just under it. I have tried different options but none of them is working. Below is the code for the same:
HTML
<div class="col-lg-3 wrap">
<span>
<input class="mandatoryText vtooltips form-control textbox validationInput" style="width: 100%; vertical-align: top; border-radius: 4px;" maxlength="100" name="tradeName" type="text">
<span class="vspan" style="display: inline-block;">Please enter Name</span>
</span>
</div>
CSS
input[type=text].vtooltips {
position: relative;
display: inline;
}
input[type=text].vtooltips + span.vspan {
/*position: absolute;*/
display:none;
font-size:12px;
font-family: Arial;
color:white;
border-radius:3px;
background: #DC000C;
width:50%;
border: 1px solid #6D6D6D;
line-height: 0px;
text-align: center;
/*visibility: hidden;*/
border-radius: 4px;
box-shadow: 2px 2px 0px #AFB1B1;
margin-left:5px;
line-height:15px;
}
.validationInput,
.validationInput:focus,
.validationInput:hover {
background-color: #FFFFE0!important;
border: 1px solid red!important;
height: 20px
}
.wrap span:first-child {
display: inline-block;
position: relative;
overflow: hidden;
width: 100%
}
.wrap span:first-child:after {
content: '';
position: absolute;
top: -5px;
right: -5px;
width: 0;
height: 0;
border-width: 5px;
border-color: red;
border-style: solid;
transform: rotate(45deg);
box-shadow: 0 0 0 1px #FFFFE0
}
Here is a Demo for the same.
The desired output is:
Any help will be appreciated. Thanks.
The easiest way is to use CSS Flexbox. Make your <span> a flex container instead of inline-block, just like this:
span {
display: flex;
}
Have a look at the snippet below:
/* CSS used here will be applied after bootstrap.css */
input[type=text].vtooltips {
position: relative;
display: inline;
height: 20px;
}
.vspan {
/*position: absolute;*/
display:none;
font-size:12px;
font-family: Arial;
color:white;
border-radius:3px;
background: #DC000C;
width:50%;
height: 20px;
border: 1px solid #6D6D6D;
line-height: 0px;
text-align: center;
/*visibility: hidden;*/
border-radius: 4px;
box-shadow: 2px 2px 0px #AFB1B1;
margin-left:5px;
line-height:15px;
}
.validationInput,
.validationInput:focus,
.validationInput:hover {
background-color: #FFFFE0!important;
border: 1px solid red!important;
height: 20px
}
.wrap span:first-child {
display: flex;
position: relative;
overflow: hidden;
width: 100%
}
.wrap span:first-child .input-holder:after {
content: '';
position: absolute;
top: -5px;
right: -5px;
width: 0;
height: 0;
border-width: 5px;
border-color: red;
border-style: solid;
transform: rotate(45deg);
box-shadow: 0 0 0 1px #FFFFE0
}
body {
margin: 30px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-lg-3 wrap">
<span>
<span class="input-holder">
<input type="text" class="mandatoryText vtooltips form-control textbox validationInput" style="width: 100%; vertical-align: top; border-radius: 4px;" maxlength="100" name="tradeName"></span>
<span class="vspan" style="display: inline-block;">Please enter Name</span>
</span>
</div>
Hope this helps!
Please do below changes :
<div class="col-lg-3 wrap">
<span>
<input class="mandatoryText vtooltips form-control textbox validationInput" style="width: 70%; vertical-align: top; border-radius: 4px;" maxlength="100" name="tradeName" type="text">
<span class="vspan" style="display: inline;">Please enter Name</span>
</span>
</div>
please refer Demo from here :
Just add below css..
span.vspan{
margin-top: 5px;
display: flex;
}
.wrap span:first-child {
display: flex;
}
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;
}