Demo site here.
When it is in large screen, apply button has too much space. I want to make it flex: space-around
When it starts to shrink, each div is not aligned evenly. (Again, flex: space-round will be nice)
full sass:
body {
font-family: 'Lato', sans-serif;
}
.errors {
color: red;
font-size: 70%;
}
.mainContainer {
background-color: #EAEDF1;
}
.banner {
position: relative;
color: white;
}
.banner .topLeft {
position: absolute;
top: 8px;
left: 16px;
font-size: 1.5vw;
}
.banner .centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 4.5vw;
}
.banner img {
width: 100%;
height: 400px;
object-fit: cover;
}
.banner i {
border: solid white;
border-width: 0 3px 3px 0;
display: inline-block;
padding: 3px;
position: absolute;
bottom: 10%;
left: 50%;
cursor: pointer;
}
.banner .arrowDown {
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
}
.bodyContainer {
padding: 20px 10px 10px 10px;
}
.bodySelf {
background-color: white;
}
.filter {
display: flex;
flex-wrap: wrap;
background-color: #f9fafa;
padding: 20px;
}
.filter .inputComponent {
min-width: 150px;
max-width: 200px;
}
.filter .inputComponent input {
width: 100%;
height: 27px;
}
.filter .dorpdownComponent {
min-width: 110px;
max-width: 200px;
}
.filter .applyButtonContainer {
width: 100px;
}
.filter .keywordMain {
flex-grow: 3;
padding-right: 20px;
padding-bottom: 10px;
}
.filter .launchpadMain {
flex-grow: 4;
padding-right: 20px;
padding-bottom: 10px;
}
.filter .minYearMain {
flex-grow: 2;
padding-right: 20px;
padding-bottom: 10px;
}
.filter .maxYearMain {
flex-grow: 2;
padding-right: 20px;
}
.filter .applyButtonMain {
flex-grow: 1;
padding-right: 20px;
}
.filter select {
-moz-appearance:none; /* Firefox */
-webkit-appearance:none; /* Safari and Chrome */
-webkit-border-radius: 0;
border-radius: 0;
appearance:none;
background-image: url("data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
background-repeat: no-repeat;
background-position-x: 100%;
background-position-y: 3px;
border: 1px solid #ccc;
padding: 8px;
width: 100%;
}
.filter select option {
background-color: white;
color: white;
}
.filter .applyButton {
height: 30px;
width: 100px;
font-weight: 600;
color: white;
background-color: #2dbaba;
}
In your css
.filter{
justify-content: space-around;
}
.filter .applyButtonMain {
//flex-grow: 1; //remove it
padding-right: 20px;
}
.filter .applyButtonContainer {
//width: 100px; //remove this too
}
Not final answer, may need edit base on OP reply
.filter > div {
flex-basis: 0;
flex-grow: 1;
}
Demo (run and check in full page mode):
.filter select {
-moz-appearance: none;
/* Firefox */
-webkit-appearance: none;
/* Safari and Chrome */
-webkit-border-radius: 0;
border-radius: 0;
appearance: none;
background-image: url("data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
background-repeat: no-repeat;
background-position-x: 100%;
background-position-y: 3px;
border: 1px solid #ccc;
padding: 8px;
width: 100%;
}
.filter select option {
background-color: white;
color: white;
}
.filter {
display: flex;
flex-wrap: wrap;
background-color: #f9fafa;
padding: 20px 10px;
/* one */
}
.filter > div {
flex-basis: 0;
flex-grow: 1;
padding: 0 10px 10px 10px;
min-width: 110px;
}
.filter .inputComponent input {
width: 100%;
height: 27px;
}
.filter .applyButton {
height: 30px;
width: 100%;
font-weight: 600;
color: white;
background-color: #2dbaba;
}
<div class="filter">
<div class="inputComponent keywordMain">
<div class="labelText">Keywords</div>
<input placeholder="eg Falcon">
</div>
<div class="dorpdownComponent launchpadMain">
<div class="labelText">Launch Pad</div>
<select>
<option value="">Any</option>
<option value="kwajalein_atoll">Kwajalein Atoll</option>
<option value="ccafs_slc_40">Cape Canaveral Air Force Station Space Launch Complex 40</option>
<option value="stls">SpaceX South Texas Launch Site</option>
</select>
</div>
<div class="dorpdownComponent minYearMain">
<div class="labelText">Min Year</div>
<select>
<option value="">Any</option>
<option value="2017">2017</option>
</select>
</div>
<div class="dorpdownComponent maxYearMain">
<div class="labelText">Max Year</div>
<select>
<option value="">Any</option>
<option value="2006">2006</option>
</select>
</div>
<div class="applyButtonContainer applyButtonMain">
<div> </div>
<button class="applyButton">Apply</button>
</div>
</div>
Related
I have a popup window (within the same page) which I'm attempting to put a container which scrolls horizontally into, yet it distorts the popup window and does not display anything other than the scrollbar. I'm honestly at a loss, can anyone help me here? I've looked around for solutions but I can't find anything that I can see applies to my problem.
If anyone can help, or point me in the right direction, I'd be really grateful. The scrollbar works perfectly fine when isolated, but inside the window shows like this:
Standalone:
My HTML (popup window with scrollbar inside)
<div id="formula-popup" class="popup-window">
<div>
<a onclick="closeFormulaWindow()" title="Close" class="close">X</a>
<span id="ftitle" class="title1"></span>
<form method="post" id="formulaform" name="edit">
<span>Current Formula</span>
<p id="current-formula" class="formula">Existing formula</p>
<input id="id-passer" type="hidden" name="formula-id" value="">
<!--sort out horizontal scrollbar from bookmarks here later-->
<input onclick="refreshWindow()" name="edit-formula" type="submit" value="Confirm">
</form>
<div class="h-scrollbar">
<section class="h-scrollbar-container">
<div class="outer-wrapper">
<div class="inner-wrapper">
<div class="pseudo-item"></div>
<div class="pseudo-item"></div>
<div class="pseudo-item"></div>
<div class="pseudo-item"></div>
<div class="pseudo-item"></div>
<div class="pseudo-item"></div>
</div>
</div>
<div class="pseudo-track"></div>
</section>
</div>
</div>
My CSS:
.scrollbar-container {
display: flex;
flex-direction: row;
}
.h-scrollbar {
display: flex;
max-width: 30vw;
padding: 0px 10px;
height: 20vh;
align-items: center;
justify-content: center;
overflow: hidden;
flex-shrink: 0;
}
.h-scrollbar-container {
width: 100%;
}
.outer-wrapper {
max-width: 100vw;
overflow-x: scroll;
position: relative;
scrollbar-color: #d5ac68 #f1db9d;
scrollbar-width: thin;
-ms-overflow-style: none;
}
.pseudo-track {
background-color: #f1db9d;
height: 2px;
width: 100%;
position: relative;
top: -3px;
z-index: -10;
}
.outer-wrapper::-webkit-scrollbar {
height: 5px;
}
.outer-wrapper::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 0px rgba(0, 0, 0, 0);
}
.outer-wrapper::-webkit-scrollbar-thumb {
height: 5px;
background-color: #d5ac68;
}
.outer-wrapper::-webkit-scrollbar-thumb:hover {
background-color: #f1db9d;
}
.outer-wrapper::-webkit-scrollbar:vertical {
display: none;
}
.inner-wrapper {
display: flex;
padding-bottom: 10px;
}
.pseudo-item {
height: 30px;
width: 80px;
margin-right: 15px;
flex-shrink: 0;
background-color: gray;
}
.pseudo-item:nth-of-type(2n) {
background-color: lightgray;
}
.popup-window {
position: fixed;
font-family: Arial, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.8);
z-index: 9999;
display: none;
}
.popup-window div {
width: 40vw;
height: 30vw;
position: relative;
margin: 10% auto 30%;
border-radius: 10px;
background: #213B54;
padding-top: 2vh;
padding-left: 1vw;
padding-right: 1vw;
padding-bottom: 2vh;
display: flex;
flex-direction: column;
}
.close {
font: Arial, sans-serif;
background: #067A9F;
color: #B5E5E7;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
border-radius: 12px;
box-shadow: 1px 1px 3px #000;
cursor: pointer;
}
.popup-window div .title1 {
font-family: Arial, sans-serif;
font-weight: normal;
font-size: 36px;
color: #EE6802;
align-self: center;
}
.popup-window form input[type=submit]:hover {
opacity: 0.8;
}
.popup-window form span {
color: #EE6802;
font-size: 22px;
}
.popup-window form {
display: flex;
flex-direction: column;
font-family: Arial, sans-serif;
}
.popup-window form span, input {
width: 100%;
}
.popup-window form input[type=submit] {
width: 20%;
background-color: #067A9F;
color: #213B54;
padding: 14px 0;
cursor: pointer;
border: none;
}
I found the solution, it was that I forgot to select an element inside the window properly and instead it was selecting all divs and so overriding the CSS properties.
Can someone help me figure out why there's a single pixel space between the border of the input range and the top and right edge of the thumb slider? I don't recall this being here before and I can't figure out what is causing it.
#media screen and (min-width:720px) {
.financecalc {
margin-bottom: 0;
width: 300px;
}
.financetext {
width: calc(100% - 330px);
}
}
#media screen and (min-width:960px) {
.financecalc {
width: 400px;
}
.financetext {
width: calc(100% - 430px);
}
}
.paycalc {
background-color: white;
border: 2px solid #b2221b;
border-radius: 8px;
box-shadow: 0 3px 5px 1px black;
padding: 10px;
text-align: center;
width: calc(100% - 24px);
}
.paycalc label {
display: block;
margin-bottom: 4px;
}
.paycalc input[type=range] {
-webkit-appearance: none;
background: #f0f0f0;
border: 2px solid #b2221b;
border-radius: 4px;
display: block;
height: 16px;
opacity: 0.9;
outline: none;
padding: 0;
width: calc(100% - 4px);
}
.paycalc input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 20px;
height: 16px;
background: #b2221b;
cursor: pointer;
}
.paycalc input[type=range]::-moz-range-thumb {
width: 20px;
height: 16px;
background: #b2221b;
cursor: pointer;
}
.calcSlider {
margin-bottom: 0;
width: calc(100% - 100px);
}
#interestSlider {
direction: rtl;
}
.calcBox,
.interestBox,
.paymentBox {
background-color: #555;
border: 3px inset #909090;
border-radius: 2px;
color: white;
padding: 6px;
}
.calcBox {
margin-bottom: 0;
width: 62px;
}
.interestBox {
width: 100%;
}
.paymentBox {
width: calc(100% - 18px);
}
.calcBox div,
.paymentBox div {
color: inherit;
margin: 0;
}
.calcBox div:first-of-type,
.paymentBox div:first-of-type {
font-size: 12px;
width: 12px;
}
.calcBox div:last-of-type,
.paymentBox div:last-of-type {
font-size: 18px;
width: calc(100% - 14px);
}
<div id="calculator" class="financecalc">
<form id="myForm" class="paycalc">
<div class="calcSlider">
<label for="downPaymentSlider">Down Payment</label>
<input id="downPaymentSlider" name="downPaymentSlider" type="range" value="500" min="250" max="5000" step="50">
</div>
</form>
</div>
The white line can appear at various zoom levels depending on how the system is mapping CSS pixels to screen pixels (there being several screen pixels to a CSS pixel on many higher def screens nowadays).
It's a bit like a rounding error, a screen pixel can get 'left behind' in the calculations.
As your thumb and your border are the same color here's a slightly unpleasant hack, but it overcomes the problem visually.
This snippet makes the height of the thumb equal to the height of the input element plus its top and bottom borders - this gives the system lots of wiggle room when it's dropping or including a screen pixel and the user won't see bits of white.
#media screen and (min-width:720px) {
.financecalc {
margin-bottom: 0;
width: 300px;
}
.financetext {
width: calc(100% - 330px);
}
}
#media screen and (min-width:960px) {
.financecalc {
width: 400px;
}
.financetext {
width: calc(100% - 430px);
}
}
.paycalc {
background-color: white;
border: 2px solid #b2221b;
border-radius: 8px;
box-shadow: 0 3px 5px 1px black;
padding: 10px;
text-align: center;
width: calc(100% - 24px);
}
.paycalc label {
display: block;
margin-bottom: 4px;
}
.paycalc input[type=range] {
-webkit-appearance: none;
background: #f0f0f0;
border: 2px solid #b2221b;
border-radius: 4px;
display: block;
height: 16px;
opacity: 0.9;
outline: none;
padding: 0;
width: calc(100% - 4px);
}
.paycalc input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 20px;
height: 16px;
height: 20px;
/* 16px + 2x2px */
background: #b2221b;
cursor: pointer;
}
.paycalc input[type=range]::-moz-range-thumb {
width: 20px;
height: 20px;
background: #b2221b;
cursor: pointer;
}
.calcSlider {
margin-bottom: 0;
width: calc(100% - 100px);
}
#interestSlider {
direction: rtl;
}
.calcBox,
.interestBox,
.paymentBox {
background-color: #555;
border: 3px inset #909090;
border-radius: 2px;
color: white;
padding: 6px;
}
.calcBox {
margin-bottom: 0;
width: 62px;
}
.interestBox {
width: 100%;
}
.paymentBox {
width: calc(100% - 18px);
}
.calcBox div,
.paymentBox div {
color: inherit;
margin: 0;
}
.calcBox div:first-of-type,
.paymentBox div:first-of-type {
font-size: 12px;
width: 12px;
}
.calcBox div:last-of-type,
.paymentBox div:last-of-type {
font-size: 18px;
width: calc(100% - 14px);
}
<div id="calculator" class="financecalc">
<form id="myForm" class="paycalc">
<div class="calcSlider">
<label for="downPaymentSlider">Down Payment</label>
<input id="downPaymentSlider" name="downPaymentSlider" type="range" value="500" min="250" max="5000" step="50">
</div>
</form>
</div>
I am trying to achieve this effect which I got on image. I am having trouble in creating custom shapes. Could someone assist me with this please?
body {
margin: 0;
}
.container {
display: flex;
width: 100%;
height: 100vh;
}
.menu {
background: lightgray;
flex: 0.1;
display: flex;
flex-direction: column;
padding-left: 15px;
}
.numbers {
background: #79726c;
border: none;
transform: skewY(10deg);
}
.content {
flex: 1;
background: blue;
}
<div class="container">
<div class="menu">
<button class="first">Start
</button>
<button class="numbers">1
</button>
<button class="numbers">2
</button>
</div>
<div class="content">
</div>
</div>
If you were only interested in the visual component, then it turned out quite similar:
body {
margin: 0;
display: flex;
justify-content: space-around;
align-items: center;
min-height: 100vh;
background-color: #312a28;
background-image: url("https://cdn.pixabay.com/photo/2016/11/27/05/02/texture-1862140_960_720.jpg");
}
.container {
position: relative;
display: flex;
height: 626px; width: 70vw;
}
.tabs {
position: relative;
top: 124px;
display: flex;
flex-flow: column nowrap;
justify-content: space-between;
height: 464px; width: 66px;
user-select: none;
}
.tabs>input {
position: absolute !important;
height: 1px !important;
width: 1px !important;
border: none !important;
padding: 0 !important;
margin: 0 !important;
white-space: nowrap !important;
overflow: hidden !important;
clip: rect(1px, 1px, 1px, 1px) !important;
}
.tab {
position: relative;
left: 6px;
height: 34px; width: 66px;
border: none;
box-sizing: border-box;
font-size: 40px; line-height: 34px;
font-family: sans-serif; font-weight: bold;
text-align: center;
color: #f9f9f7;
background-color: #79726c;
filter: drop-shadow(-2px 8px 4px #0008);
transition: 0.3s ease;
}
.tab:nth-of-type(1) { z-index: 6; }
.tab:nth-of-type(2) { z-index: 5; }
.tab:nth-of-type(3) { z-index: 4; }
.tab:nth-of-type(4) { z-index: 3; }
.tab:nth-of-type(5) { z-index: 2; }
.tab:nth-of-type(6) { z-index: 1; }
.tab:nth-of-type(7) { z-index: 0; }
.tab::before,
.tab::after {
content: "";
position: absolute;
left: 0; z-index: -1;
width: 100%;
border-radius: 6px 4px 4px 6px;
background-color: inherit;
background-image: inherit;
}
.tab::before {
bottom: 16px; height: 126px;
transform: skewy(-28deg);
}
.tab::after {
top: 16px; height: 40px;
transform: skewy(28deg);
}
.tabs > input:not(:checked) + .tab:hover {
background-color: #aba5a0;
cursor: pointer;
}
.tabs > input:checked + .tab {
left: 0; z-index: 7;
background-color: #d8cec1;
background-image: url("https://cdn.pixabay.com/photo/2016/11/08/03/16/seamless-1807376_960_720.jpg");
color: #393534;
}
.tab .vertical {
position: absolute;
left: 10px; top: -85px;
transform: rotate(-90deg);
font-size: 12px;
text-transform: uppercase;
text-shadow: 0 0 2px currentcolor;
}
.content {
position: relative;
left: -3px; z-index: 8;
flex: 1;
border-radius: 6px;
background-color: #d8cec1;
background-image: url("https://cdn.pixabay.com/photo/2016/11/08/03/16/seamless-1807376_960_720.jpg");
box-shadow: 2px 13px 6px -4px #0008;
}
<section class="container">
<div class="tabs">
<input type="radio" name="tabs" id="tab0" checked><label for="tab0" class="tab"><span class="vertical">Start</span></label>
<input type="radio" name="tabs" id="tab1"><label for="tab1" class="tab">1</label>
<input type="radio" name="tabs" id="tab2"><label for="tab2" class="tab">2</label>
<input type="radio" name="tabs" id="tab3"><label for="tab3" class="tab">3</label>
<input type="radio" name="tabs" id="tab4"><label for="tab4" class="tab">4</label>
<input type="radio" name="tabs" id="tab5"><label for="tab5" class="tab">5</label>
<input type="radio" name="tabs" id="tab6"><label for="tab6" class="tab">6</label>
</div>
<div class="content"></div>
</section>
enter image description here
hello,I tried a little and made this one.I think this structure can be useful for you.
Code:
enter code here
<div class="container">
<div class="menu">
<button class="first">Start
</button>
<button class="numbers" id="btn-top-shadow">1
</button>
<button class="numbers">2
</button>
<button class="numbers">3
</button>
<button class="numbers">4
</button>
<button class="numbers">5
</button>
<button class="numbers">6
</button>
<button class="numbers">7
</button>
</div>
<div class="content">
</div>
</div>
body {
margin: 0;
}
.container {
display: flex;
width: 100%;
height: 100vh;
}
.first
{
transform: rotate(270deg) scale(4.5) ;
position: relative;
top:10%;
font-size: 4px;
}
.menu {
background: lightgray;
flex: 0.1;
display: flex;
flex-direction: column;
padding-left: 15px;
}
.numbers {
background: #79726c;
border: none;
transform: skewY(10deg);
width: 38%;
position: relative;
left: 38px;
top: 110px;
color: white;
text-shadow: 0px 7px 3px black;
height: 5%;
border-bottom: 0.4px solid black
}
#btn-top-shadow
{
box-shadow: 0px -7px 7px black;
}
.content {
flex: 1;
background: blue;
}
To achieve the shape you want on the first button. Use two buttons!
Assign the same scripts!
https://www.codegrepper.com/code-examples/css/css+triangle+button
Here's some details on how to make the triangle part!
Good luck!
The imagine above shows the browser in a smartphone size and thus the stretched space at the right caused by the overlapped divs in blue and red that I put below.
My main aim here was to get these divs to also shrink together with the screen but when I tried using flex properties, it disoriented whenever the page was reduced from desktop size.
Also, I tried percentages but placing the divs at a position after using percentage to size proved rather abortive.
The codes for the the image are found below.
Much help would be appreciated.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Acadera Renewed</title>
<link rel="stylesheet" href="Acadera Imp.css">
</head>
<body>
<div class="head_section">
<div id="top_layout">
<center>
<ul>
<li><a>Home</a></li>
<li><a>Pages</a></li>
<li> <a>Services</a></li>
<li><a>Gallary</a></li>
<li><a>Blog</a></li>
<li><a>Contact</a></li>
<li><a>About</a></li>
<li><input type="text" placeholder="Search"></input></li>
</ul>
</center>
</div>
<h1>WELCOME TO ACADERA</h1>
<p>We bring you the best there is to offer</p>
<center><input type="button" class= "btn" value="GET STARTED" ></input></center>
<div class="lower_section">
<center>
<ul class="two">
<li id="lower"><a href="" class="lower">Akan</a></li>
<li id="lower"><a href="" class="lower">Uwem</a></li>
<li id="lower"><a href="" class="lower">Itoro</a></li>
</ul>
</center>
</div>
</div>
<div class="contain">
<div class="box red"> </div>
<div class="box blue"></div>
</div>
</body>
</html>
CSS
*{
padding: 0px;
margin: 0px;
box-sizing: border-box;
}
body{
background-color: white;
overflow: auto;
background-attachment: scroll;
min-width: 100%;
}
.head_section{
position: relative;
z-index: 1;
height: 32rem;
width: 100%;
background-color: black;
}
.head_section::before{
content: "";
z-index: -1;
position: absolute;
height: 32rem;
width: 100%;
color: black;
background-image: url(image/pexels-birgit-held-1046125.jpg);
background-position: center;
background-attachment: fixed;
background-size: cover;
opacity: 0.6;
}
/*
#top_layout{
padding:5px 0 5px 0;
text-align: center;
justify-content: center;
} */
ul{
margin: auto 0px;
padding: 0px;
list-style: none;
display: table;
width: 80%;
text-align: center;
/* background-color: red; */
}
.two{
margin: auto 0px;
padding-bottom: 40px;
list-style: none;
display: table;
width: 80%;
text-align: center;
top: 0px;
}
li{
display: table-cell;
position: relative;
padding: 5px 10px 5px 12px;
text-transform: uppercase;
font-size: 13px;
letter-spacing: 0.15em;
display: inline-block;
position: relative;
/* background-color: blue; */
}
#lower{
display: table-cell;
padding: 10px 13px 40px 15px;
/* background-color: blue; */
text-transform: uppercase;
font-size: 15px;
letter-spacing: 0.15em;
position: relative ;
/* padding-top: 50px; */
position: 0;
}
a{
padding: 5px 10px;
color: white;
text-decoration: none;
top: 0px;
/* background-color: grey; */
margin-bottom: 20px;
}
a:hover{
color: yellow;
cursor: pointer;
}
a:after{
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
display: block;
height: 2px;
left: 50%;
position: absolute;
background: yellow;
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0px;
}
a:hover:after{
width: 100%;
left: 0;
}
#media screen and (max-height:300px){
ul{
margin-top: 40px;
}
}
#lower:hover{
color: yellow;
cursor: pointer;
}
a .lower{
margin-left: 60px;
}
.lower:after{
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
display: block;
height: 2px;
left: 50%;
position: absolute;
background: rgb(249, 253, 6);
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0px;
}
.lower:hover:after{
width: 65%;
left: 18%;
}
#media screen and (max-height:300px){
.two{
margin-top: 40px;
}
}
h1{
text-align: center;
justify-content: center center;
font-size: 50px;
font-weight: 900;
padding: 150px 5px 5px 5px;
background:linear-gradient(to left, yellow, white);
-webkit-background-clip:text;
-webkit-text-fill-color: transparent;
}
p{
background-color: white;
text-align: center;
-webkit-background-clip:text;
-webkit-text-fill-color: transparent;
}
.btn{
border: none;
background-color: darkgoldenrod;
color: white;
border-radius: 25px;
width: 110px;
height: 30px;
font-size: 12px;
font-weight: 600;
justify-content: center center;
margin: auto;
outline: none;
}
.btn:hover{
background-color: yellow;
color: rgb(15, 12, 12);
cursor: pointer;
}
.lower_section{
bottom: 0;
z-index: 1;
height: 100px;
width: 100%;
position: absolute;
/* padding-top: 40px;
padding-bottom: 40px; */
/* justify-content: center;
text-align: center center; */
}
.lower_section::before{
content: "";
z-index: -1;
bottom: 0;
height:120px;
width: 100%;
text-align: center;
position: absolute;
background-color: black;
filter: brightness(0%);
opacity:0.5;
align-items: center;
justify-content: center center;
}
/* .sub_lower{
margin-top: -15px;
position: relative;
width: 85%;
height: 50px;
color: yellow;
background-color: yellow;
content: "";
z-index: 1;
text-align: center;
justify-content: space-around;
} */
.sub_lower a{
display: inline-flex;
position: relative;
width: 20px;
height: 20px;
margin:2px;
padding-right:100px;
padding-left: 100px;
color: white;
background-color: grey;
text-align: center;
justify-content: center;
justify-items: center center;
}
.contain{
position: relative;
max-width: 300px;
/* height: fit-content; */
}
/* #media only screen and (min-device-width:400px)
{
.box{
max-width: 400px;
}
} */
.box{
display: flex;
flex-shrink: initial;
width: 300px;
height: 300px;
position: absolute;
}
.red{
z-index: 1;
background-color: red;
}
.blue{
z-index: 2;
background-color: blue;
top: 200px;
left: 200px;
}
ADDED:
#media screen and (max-width:576px){
.contain{
max-width: unset;
}
.blue{
left: unset;
right: 0;
}
}
*{
padding: 0px;
margin: 0px;
box-sizing: border-box;
}
body{
background-color: white;
background-attachment: scroll;
min-width: 100%;
}
.head_section{
position: relative;
z-index: 1;
height: 32rem;
width: 100%;
background-color: black;
}
.head_section::before{
content: "";
z-index: -1;
position: absolute;
height: 32rem;
width: 100%;
color: black;
background-image: url(image/pexels-birgit-held-1046125.jpg);
background-position: center;
background-attachment: fixed;
background-size: cover;
opacity: 0.6;
}
/*
#top_layout{
padding:5px 0 5px 0;
text-align: center;
justify-content: center;
} */
ul{
margin: auto 0px;
padding: 0px;
list-style: none;
display: table;
width: 80%;
text-align: center;
/* background-color: red; */
}
.two{
margin: auto 0px;
padding-bottom: 40px;
list-style: none;
display: table;
width: 80%;
text-align: center;
top: 0px;
}
li{
display: table-cell;
position: relative;
padding: 5px 10px 5px 12px;
text-transform: uppercase;
font-size: 13px;
letter-spacing: 0.15em;
display: inline-block;
position: relative;
/* background-color: blue; */
}
#lower{
display: table-cell;
padding: 10px 13px 40px 15px;
/* background-color: blue; */
text-transform: uppercase;
font-size: 15px;
letter-spacing: 0.15em;
position: relative ;
/* padding-top: 50px; */
position: 0;
}
a{
padding: 5px 10px;
color: white;
text-decoration: none;
top: 0px;
/* background-color: grey; */
margin-bottom: 20px;
}
a:hover{
color: yellow;
cursor: pointer;
}
a:after{
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
display: block;
height: 2px;
left: 50%;
position: absolute;
background: yellow;
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0px;
}
a:hover:after{
width: 100%;
left: 0;
}
#media screen and (max-height:300px){
ul{
margin-top: 40px;
}
}
#lower:hover{
color: yellow;
cursor: pointer;
}
a .lower{
margin-left: 60px;
}
.lower:after{
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
display: block;
height: 2px;
left: 50%;
position: absolute;
background: rgb(249, 253, 6);
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0px;
}
.lower:hover:after{
width: 65%;
left: 18%;
}
#media screen and (max-height:300px){
.two{
margin-top: 40px;
}
}
h1{
text-align: center;
justify-content: center center;
font-size: 50px;
font-weight: 900;
padding: 150px 5px 5px 5px;
background:linear-gradient(to left, yellow, white);
-webkit-background-clip:text;
-webkit-text-fill-color: transparent;
}
p{
background-color: white;
text-align: center;
-webkit-background-clip:text;
-webkit-text-fill-color: transparent;
}
.btn{
border: none;
background-color: darkgoldenrod;
color: white;
border-radius: 25px;
width: 110px;
height: 30px;
font-size: 12px;
font-weight: 600;
justify-content: center center;
margin: auto;
outline: none;
}
.btn:hover{
background-color: yellow;
color: rgb(15, 12, 12);
cursor: pointer;
}
.lower_section{
bottom: 0;
z-index: 1;
height: 100px;
width: 100%;
position: absolute;
/* padding-top: 40px;
padding-bottom: 40px; */
/* justify-content: center;
text-align: center center; */
}
.lower_section::before{
content: "";
z-index: -1;
bottom: 0;
height:120px;
width: 100%;
text-align: center;
position: absolute;
background-color: black;
filter: brightness(0%);
opacity:0.5;
align-items: center;
justify-content: center center;
}
/* .sub_lower{
margin-top: -15px;
position: relative;
width: 85%;
height: 50px;
color: yellow;
background-color: yellow;
content: "";
z-index: 1;
text-align: center;
justify-content: space-around;
} */
.sub_lower a{
display: inline-flex;
position: relative;
width: 20px;
height: 20px;
margin:2px;
padding-right:100px;
padding-left: 100px;
color: white;
background-color: grey;
text-align: center;
justify-content: center;
justify-items: center center;
}
.contain{
position: relative;
max-width: 300px;
/* height: fit-content; */
}
/* #media only screen and (min-device-width:400px)
{
.box{
max-width: 400px;
}
} */
.box{
display: flex;
flex-shrink: initial;
width: 300px;
height: 300px;
position: absolute;
}
.red{
z-index: 1;
background-color: red;
}
.blue{
z-index: 2;
background-color: blue;
top: 200px;
left: 200px;
}
#media screen and (max-width:576px){
.contain{
max-width: unset;
}
.blue{
left: unset;
right: 0;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Acadera Renewed</title>
<link rel="stylesheet" href="Acadera Imp.css">
</head>
<body>
<div class="head_section">
<div id="top_layout">
<center>
<ul>
<li><a>Home</a></li>
<li><a>Pages</a></li>
<li> <a>Services</a></li>
<li><a>Gallary</a></li>
<li><a>Blog</a></li>
<li><a>Contact</a></li>
<li><a>About</a></li>
<li><input type="text" placeholder="Search"></input></li>
</ul>
</center>
</div>
<h1>WELCOME TO ACADERA</h1>
<p>We bring you the best there is to offer</p>
<center><input type="button" class= "btn" value="GET STARTED" ></input></center>
<div class="lower_section">
<center>
<ul class="two">
<li id="lower">Akan</li>
<li id="lower">Uwem</li>
<li id="lower">Itoro</li>
</ul>
</center>
</div>
</div>
<div class="contain">
<div class="box red"> </div>
<div class="box blue"></div>
</div>
</body>
</html>
I have been trying to get this layout to animate the search box when clicking on the search icon. It kind of works, except for two things. When the animation begins, the search icon quickly moves to the left where I'd like it to stay put and the search box extend out to the left. That would then push the logo over at the same time the logo switches to the small version.
Any guidance would be appreciated. Here is a JSFIDDLE and the code:
HTML:
<button class="hamburger hamburger-cancel" id="menu-trigger">
<span class="icon"></span>
</button>
<a id="site-logo" data-cy="site-logo" href="http://www.website.local">
<img class="full-logo" src="https://www.tracetronic.com/cms/data/img/inhalte/Logos_TraceTronic/Logo_TEST-GUIDE_rgb_SCREEN.jpg" alt="Engineering360 Logo">
<img class="logo-kite" src="http://i.imgur.com/w4MxJnp.png" alt="Engineering360 Logo Kite">
</a>
<form id="global-search-form" action="/search" data-cy="global-search-form">
<input class="search-box catcomplete" type="text" name="query" required="" value="" data-cy="global-search-box">
<input type="hidden" name="newSearch" value="new">
<input class="submit" type="submit" value="">
</form>
<div class="header-reg-links">
<img id="reg-trigger" data-cy="profile-popup-trigger" src="https://www.freeiconspng.com/uploads/profile-icon-9.png">
</div>
</div>
</header>
CSS/SCSS:
header {
background: black;
background-size: cover;
box-sizing: border-box;
padding: 0 .5em;
position: relative;
width: 100%;
z-index: 10;
#header-content {
align-items: center;
display: flex;
flex-flow: row nowrap;
margin: 0 auto;
max-width: 1140px;
#site-logo {
margin: .5em 2em;
min-width: 0;
flex-grow: 1;
text-align: center;
.logo-kite {
display: none;
}
img {
height: auto;
width: 5em;
}
}
.header-reg-links {
align-items: center;
display: flex;
position: relative;
#reg-trigger {
cursor: pointer;
margin-left: auto;
min-width: 0;
transition: opacity .3s;
width: 2.25em;
height: 1.75em;
padding: 1em .25em;
&:hover {
opacity: 0.9;
}
}
}
#global-search-form {
align-items: center;
display: flex;
flex-flow: row nowrap;
flex-grow: 0;
font-size: 15px;
min-width: 0;
padding: 0 2em;
margin: .5em 0;
padding: 0 .5em;
.nav-search-dropdown {
display: none;
}
.search-box {
background: #fbfbfb;
box-sizing: border-box;
border: 0;
font-size: 15px;
height: 2.25em;
line-height: 2.25em;
margin: 0;
min-width: 0;
flex: 0;
max-width: 40em;
overflow: hidden;
text-overflow: ellipsis;
padding: 0;
transition: width 1s;
width: 0;
}
.submit {
border: 0;
border-radius: 0 3px 3px 0;
box-sizing: border-box;
cursor: pointer;
height: 2.25em;
font-size: 15px;
min-width: 0;
background: url("https://vignette.wikia.nocookie.net/deusex/images/9/9b/Magnifying_glass_icon.png/revision/latest?cb=20141205155051&path-prefix=en") center center / 1.65em no-repeat;
padding: 0;
width: 2em;
}
}
&.search-open {
#site-logo {
flex: 0 0 2em;
margin: 0 .5em;
.logo-kite {
display: block;
width: 2em;
}
.full-logo {
display: none;
}
}
#global-search-form {
flex: 1 1 0;
margin: 0;
padding: 0;
width: 16em;
.search-box {
flex: none;
padding: .25em .5em;
width: 90%;
}
.search-trigger {
display: none;
}
}
}
}
#menu-trigger {
background: transparent;
border: 0 none;
cursor: pointer;
display: inline-block;
height: 1em;
outline: none;
padding: 0;
transition: transform .2s ease-in-out;
vertical-align: middle;
flex: 0 0 1.25em;
font-size: 1.5rem;
margin: 0 .25em;
width: 1.5em;
&:before, &:after {
content: "";
}
&:before, &:after, .icon {
background: #FBFBFB;
border-radius: .05em;
display: block;
height: .1em;
margin: 0 0 .3em;
transition: transform .2s ease-in-out;
width: 100%;
}
&.menu-open:before {
transform: translateY(.4em) rotate(135deg);
}
&.menu-open .icon {
transform: scale(0);
}
&.menu-open:after {
transform: translateY(-.4em) rotate(-135deg);
}
}
}
JQUERY:
$(function() {
// Click event for profile icon.
$("#reg-trigger").click(function() {
$("#header-content .header-reg-links").toggleClass("active");
$(document).on("click.document", function(e) {
var container = $("#header-content .header-reg-links");
// if the target of the click isn't the container nor a descendant of the container
if (!container.is(e.target) && container.has(e.target).length === 0) {
container.removeClass("active");
// remove the click event on the document when it's no longer needed.
$(document).off("click.document");
}
});
})
// Opens main menu
$("#menu-trigger").click(function() {
$("html, #menu-trigger, #site-nav").toggleClass("menu-open");
});
// Header search bar toggle
$("#global-search-form input.submit").click(function(e) {
console.log($("#global-search-form input.search-box").val());
if ($("#header-content").hasClass("search-open")) {
if ($("#global-search-form input.search-box").val() == "") {
e.preventDefault();
$("#header-content").toggleClass("search-open");
} else {
return true;
}
} else {
e.preventDefault();
$("#header-content").toggleClass("search-open");
}
});
});