CSS Animation (Appear from the side by clicking) - html

I'm trying to make something apppear from the right side in a div when I'm click on it.
It's a Div (dish) that have 2 Div in it (infoDish) and (validation).
infoDish have a width of 100%, validation have a width of 20% but is hidden unless I click on Dish.
I can make validation appear and disappear but the thing is it's instantaneus and I want to create an animation that take 1 or 2 seconds to make it appear from the right side (like you open the window from the right to the left).
.plat {
border: 1px solid black;
height: 70px;
width: 95%;
display: flex;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
border-radius: 20px;
background-color: white;
margin-bottom: 20px;
margin-left: 3%;
cursor: pointer;
}
.plat:hover .divValid {
border: 1px solid purple;
background-color: #99E2D0;
border-radius: 0 20px 20px 0;
justify-content: center;
align-items: center;
height: 100%;
width: 20%;
}
.partRouge {
border: 1px solid red;
height: 100%;
width: 100%;
}
.divTitlePlat {
border: 1px solid orangered;
height: 50%;
width: 100%;
padding-left: 2%;
}
.divTitlePlat h3 {
font-size: 20px;
margin-top: 0;
}
.divInfoPlat {
border: 1px solid blue;
height: 50%;
width: 100%;
display: flex;
justify-content: space-between;
}
.divDescPlat {
border: 1px solid green;
height: 100%;
width: 80%;
padding-left: 2%;
}
.divPricePlat {
border: 1px solid yellow;
height: 100%;
width: 20%;
}/*# sourceMappingURL=menuresto.css.map */
<div class="plat">
<div class="partRouge">
<div class="divTitlePlat">
<h3>Tartare de poulpe acidulé</h3>
</div>
<div class="divInfoPlat">
<div class="divDescPlat">
<span>Aux zests d'orange</span>
</div>
<div class="divPricePlat">
<span class="price">25€</span>
</div>
</div>
</div>
<div class="divValid">
<!--<i class="fa-solid fa-circle-check"></i>-->
</div>
</div>

I don't know if I understood what you really want to do...
But if you want to add a little delay, not to change instantly you can add the CSS property transition in the class with the hover. You can even precise for each property you want a delay and the delay. To do this, you have to write:
transition: 1s;
To have more informations about this property, you can read:
https://www.w3schools.com/css/css3_transitions.asp
With your code, it's not perfect but if it's what you were searching for, the changement on the hover is now not instantly, but with a delay of 1 second.
.plat {
border: 1px solid black;
height: 70px;
width: 95%;
display: flex;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
border-radius: 20px;
background-color: white;
margin-bottom: 20px;
margin-left: 3%;
cursor: pointer;
}
.plat:hover .divValid {
border: 1px solid purple;
background-color: #99E2D0;
border-radius: 0 20px 20px 0;
justify-content: center;
align-items: center;
height: 100%;
width: 20%;
transition: 1s;
}
.partRouge {
border: 1px solid red;
height: 100%;
width: 100%;
}
.divTitlePlat {
border: 1px solid orangered;
height: 50%;
width: 100%;
padding-left: 2%;
}
.divTitlePlat h3 {
font-size: 20px;
margin-top: 0;
}
.divInfoPlat {
border: 1px solid blue;
height: 50%;
width: 100%;
display: flex;
justify-content: space-between;
}
.divDescPlat {
border: 1px solid green;
height: 100%;
width: 80%;
padding-left: 2%;
}
.divPricePlat {
border: 1px solid yellow;
height: 100%;
width: 20%;
}/*# sourceMappingURL=menuresto.css.map */
<div class="plat">
<div class="partRouge">
<div class="divTitlePlat">
<h3>Tartare de poulpe acidulé</h3>
</div>
<div class="divInfoPlat">
<div class="divDescPlat">
<span>Aux zests d'orange</span>
</div>
<div class="divPricePlat">
<span class="price">25€</span>
</div>
</div>
</div>
<div class="divValid">
<!--<i class="fa-solid fa-circle-check"></i>-->
</div>
</div>

Related

Custom Progress Bar Html and CSS layout

I'm trying to make a 'custom' progress bar with numbers at each end of the progress bar. Left hand number being the current value, and the right hand side being the max/target value. I've got it so that I'm showing the two numbers but I can't seem to position the right hand number correctly.
What I'm trying to achieve is...
and what I currently have is...
This is what I currently have code wise...
JSFiddle
.progress-outer {
width: 96%;
margin: 10px 2%;
padding: 3px;
text-align: center;
background-color: #f4f4f4;
border: 1px solid #dcdcdc;
color: #fff;
border-radius: 20px;
}
.progress-inner {
min-width: 15%;
white-space: nowrap;
overflow: hidden;
padding: 5px;
border-radius: 20px;
background-color: orange;
}
.progressBarCurrent {
color: black;
float: left;
}
.progressBarGoal {
color: black;
float: right;
}
<div class="progress-outer">
<div class="progress-inner" style="width:27%;">
<span class="progressBarCurrent">50g</span>
<span class="progressBarGoal">180g</span>
</div>
</div>
I've tried putting the the second span outside the the progress inner div but then moves the text outside the whole thing and I couldn't work out how to move it into the correct place.
Can anyone help?
I have an interesting solution using linear-gradients, its pretty close, try playing around with the margins and outline to get border right.
.progress-outer {
width: 96%;
display: flex;
height: 35px;
margin: 10px 2%;
text-align: center;
border: 1px solid #dcdcdc;
background-image: linear-gradient( 80deg, orange 37% , #f4f4f4 37% );
border-radius: 20px;
justify-content: center;
align-items: center;
}
.progressBarCurrent {
color: black;
text-align: left;
width: 50%;
position: relative;
margin: 0px;
margin-left: 20px;
}
.progressBarGoal {
color: black;
position: relative;
text-align: right;
width: 50%;
margin: 0px;
margin-right: 20px;
}
<div class="progress-outer">
<span class="progressBarCurrent">50g</span>
<span class="progressBarGoal">180g</span>
</div>
Instead of float:left you can use position:absolute
.progress-outer {
width: 96%;
margin: 10px 2%;
padding: 3px;
text-align: center;
background-color: #f4f4f4;
border: 1px solid #dcdcdc;
color: #fff;
border-radius: 20px;
position: relative;
}
.progress-inner {
min-width: 15%;
white-space: nowrap;
overflow: hidden;
padding: 5px;
border-radius: 20px;
background-color: orange;
}
.progressBarCurrent {
color: black;
float: left;
}
.progressBarGoal {
color: black;
position: absolute;
right: 5px;
}
<div class="progress-outer">
<div class="progress-inner" style="width:27%;">
<span class="progressBarCurrent">50g</span>
<span class="progressBarGoal">180g</span>
</div>
</div>

how can I put a div inside of another div that is sitting next to a div that has a float: left property?

The question is confusing but I just want to put the 'signIn' css selector inside the 'headerRightPanel' selector and have it span that width. That is grow and shrink within it. now headerRightPanel is sitting next to headerLeftPanel which has the Float: left property. and for some reason the sign in div is expanding the whole entirety of the header which i dont want.
how can I just keep sign in inside headerRightPanel and have it expand the whole section?
html{
height: 900px;
border: 2px solid black;
margin: 5px;
}
body{
height: 885px;
border: 2px solid black;
margin: 5px;
}
.MAINPAGE{
border: 2px solid black;
height: 870px;
margin: 5px;
}
.HEADER{
border: 2px solid black;
height: 175px;
margin: 5px;
}
.headerLeftPanel{
border: 2px solid black;
height: 160px;
margin: 5px;
float: left;
width: 75%;
}
.headerRightPanel{
border: 2px solid black;
height: 160px;
margin: 5px;
}
.signIn{
border: 2px solid black;
height: 30px;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="MAINPAGE">
<div class="HEADER">
<div class="headerLeftPanel">
</div>
<div class="headerRightPanel">
<div class="signIn">
</div>
</div>
</div>
</div>
</body>
</html>
Try below things
give .headerRightPanel float: right; position: relative:
set .signIn maxWidth: 100%;
I'd try to solve it with flex:
html {
height: 900px;
border: 2px solid black;
margin: 5px;
}
body {
height: 885px;
border: 2px solid black;
margin: 5px;
}
.MAINPAGE {
border: 2px solid black;
height: 870px;
margin: 5px;
}
.HEADER {
border: 2px solid black;
height: 175px;
margin: 5px;
/* All children shall flex */
display: flex;
}
.headerLeftPanel {
border: 2px solid black;
height: 160px;
margin: 5px;
width: 75%;
}
.headerRightPanel {
border: 2px solid black;
height: 160px;
margin: 5px;
/* This item shall fill remaining space */
flex-grow: 1;
}
.signIn {
border: 2px solid black;
height: 30px;
}
<div class="MAINPAGE">
<div class="HEADER">
<div class="headerLeftPanel">
</div>
<div class="headerRightPanel">
<div class="signIn">
</div>
</div>
</div>
</div>
Use display: grid; in your .HEADER with grid-template-column: 75% auto; - says first column (first child-element of .HEADER) is width of 75% (of its parent-element's width) and auto to set the second column (second child-element of .HEADER) fill the rest of parents element's width.
html{
height: 900px;
border: 2px solid black;
margin: 5px;
}
body{
height: 885px;
border: 2px solid black;
margin: 5px;
}
.MAINPAGE{
border: 2px solid black;
height: 870px;
margin: 5px;
}
.HEADER{
border: 2px solid black;
height: 175px;
display: grid;
grid-template-columns: 75% auto;
grid-gap: 5px;
margin: 5px;
}
.headerLeftPanel{
border: 2px solid black;
height: 160px;
margin: 5px;
}
.headerRightPanel{
border: 2px solid black;
margin: 5px;
}
.signIn{
border: 2px solid black;
height: 30px;
}
<div class="MAINPAGE">
<div class="HEADER">
<div class="headerLeftPanel">
</div>
<div class="headerRightPanel">
<div class="signIn">
</div>
</div>
</div>
</div>

Centering flex item content

I have the following flex item (#globalSearchContLi) inside a flex-container. The container is an unordered list.
My problem is that I'm creating a fun looking search bar with a half-sphere submit button. The button is pretty much attached to the search bar with inline-block and margin properties.
This bundle (the search bar and button) won't center in the div any way I try to.
I tried setting #globalSearchCont with a specific width and auto side margins, but the whole flexbox presentation won't display correctly on mobile.
Any suggestions/advice? Thanks in advance.
#globalSearchContLi {
flex-grow: 7;
margin: 0px 15px;
flex-basis: 100px;
}
#globalSearchContLi {
flex-grow: 7;
margin: 0px 15px;
flex-basis: 100px;
}
#munchGlobalSearchbar {
width: 240px;
height: 50px;
/* box-shadow: 0 0 0 1px#000,0 0 0 3px #FFF, 0 0 0 5px #333; */
font-weight: 300;
font-size: 1.6rem;
border-radius: 10px;
display: inline-block;
margin-top: 20px;
text-align: center;
background-color: #edad0c;
border-bottom: 2px solid #333;
border-top: 2px solid #333;
border-left: 2px solid #333;
}
#munchGlobalSearchbar::placeholder {
color: #000;
}
#globalSearchBtn {
background-image: url(../imgs/addOn/panEmoji.png);
width: 50px;
height: 51px;
margin: 0px 0px -17px -12px !important;
border-bottom-right-radius: 50%;
border-top-right-radius: 50%;
display: inline-block;
border: 2px solid #333;
background-color: #38b32b;
transition: .2s all ease;
}
.backImageCon {
background-repeat: no-repeat;
background-size: contain;
background-position: center;
}
<li id="globalSearchContLi">
<div id="globalSearchCont">
<input placeholder="Search..." type="textbox" name="globalSearch" id="munchGlobalSearchbar">
<div id="globalSearchBtn" class="backImageCon"></div>
</div>
</li>
Use justify-content: center on the parent to horizontally center the button elements.
#globalSearchContLi {
list-style-type: none;
margin-left: 0;
}
#globalSearchCont {
display: flex;
justify-content: center;
height: 50px;
}
#munchGlobalSearchbar {
width: 240px;
font-weight: 300;
font-size: 1.6rem;
border-radius: 10px;
text-align: center;
background-color: #edad0c;
border-bottom: 2px solid #333;
border-top: 2px solid #333;
border-left: 2px solid #333;
}
#munchGlobalSearchbar::placeholder {
color: #000;
}
#globalSearchBtn {
background-image: url(../imgs/addOn/panEmoji.png);
width: 50px;
border-bottom-right-radius: 50%;
border-top-right-radius: 50%;
border: 2px solid #333;
background-color: #38b32b;
transition: .2s all ease;
margin-left: -10px;
}
.backImageCon {
background-repeat: no-repeat;
background-size: contain;
background-position: center;
}
ul {
margin: 0;
padding: 0;
}
* {
box-sizing: border-box;
}
<ul>
<li id="globalSearchContLi">
<div id="globalSearchCont">
<input placeholder="Search..." type="textbox" name="globalSearch" id="munchGlobalSearchbar">
<div id="globalSearchBtn" class="backImageCon"></div>
</div>
</li>
</ul>

How to make a full window page height border for divider?

I'm attempting to make a login page for a website, https://essaydapp.com to submit and try and get into the application. I'm trying to mimic their design (see link) but I'm having some issues:
Screenshots:
https://imgur.com/w2GAphF
https://imgur.com/rimWY0s
In the first screenshot you can see the little 1px dashed border, I would like that to be the height of the entire page rather than the form only.
In the second screenshot you can see on the edges of the page and top there is the white color, but I would like that to be blue too. Thanks for any help in advance.
form {
/*border: 10px solid #1acebc;*/
padding: 28px;
border-left: 1px solid black;
border-left-style: dashed;
border-right: 1px solid black;
border-right-style: dashed;
}
button:hover {
opacity: 0.8;
}
button {
background-color: #09c;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
input[type=text],
input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #1acebc;
box-sizing: border-box;
}
img {
display: block;
margin: 0 auto;
padding-bottom: 60px;
padding-top: 30px;
width: 300px;
height: 300px;
}
body {
background-color: #e7f3f6;
/*border-left: 250px solid #007da5;
border-right: 250px solid #007da5;*/
border-left: 175px solid #007da5;
border-right: 175px solid #007da5;
padding-top: 175px;
padding-bottom: 215px;
}
<form>
<img src="https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png" alt="profilepicture">
<input type="text" placeholder="Username">
<input type="password" placeholder="Password">
<button type="button" name="Login">Login</button>
</form>
This code removes any padding from left and right.
I hope that's what you want.
body{
border: 1px dashed;
backgroud-color: #e7f3f6;
margin-left: 0px;
margin-right: 0px;
}
Your existing code is somewhat messy. Instead, I suggest to use the following flex-box solution
body {
padding: 0;
margin: 0 auto;
background-color: #007da5;
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
form {
display: flex;
width: 75%; /*Set the width required*/
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #e7f3f6;
border-left: 1px dashed black;
border-right: 1px dashed black;
}
img {
width: 300px;
height: 300px;
padding-bottom: 60px;
padding-top: 30px;
}
button:hover {
opacity: 0.8;
}
button {
background-color: #09c;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 85%;
}
input[type=text],
input[type=password] {
width: 85%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #1acebc;
box-sizing: border-box;
}
<form>
<img src="https://i.imgur.com/ihZBCxx.png" alt="profilepicture">
<input type="text" placeholder="Username">
<input type="password" placeholder="Password">
<button type="button" name="Login">Login</button>
</form>

Flexbox creates a lot of whitespace and moves down the object it is affecting

So I am learning to use flexbox and it was working fine untill I tried to use it on a some items that wrapped. When that happened the whole block moved down by the amount of the wrapped object.Just to be clear the top part here above the cars and below the lorem ipsum is the part that has been moved.
As you can see there's a lot of whitespace there and that is not supposed to be there and it wasn't untill I used flexbox. But my goal is to make it wrap just using flexbox (so no float: left trickery). Here's my code. http://jsfiddle.net/0eccdumy
#import url(https://fonts.googleapis.com/css?family=Roboto);
* {
margin: 0;
padding: 0;
}
#media screen and (min-width: 604px) {
#menu {
height: 50px;
width: 99.8%-1px;
display: flex;
-webkit-flex-direction: row;
-moz-flex-direction: row;
position: relative;
z-index: 99;
background: linear-gradient(#CC0, #EE0);
padding: 5px 0px 5px 0px;
border: 1px solid #566;
}
body {
margin: 0px;
height: 100%;
background-color: #444;
font-family: Roboto, sans-serif;
}
#ida {
border-right: 1px solid #111;
padding: 10px;
display: block;
}
a {
color: black;
padding: 10px;
text-decoration: none;
font-size: 1.3em;
}
div.top {
height: 100%;
width: 75%;
background-color: #F1F1F1;
margin: 0px auto;
display: block;
position: relative;
border: 5px solid #1F1F1F;
}
p {
display: inline-block;
font-size: 0.7em;
margin: 1px;
color: black;
}
.desc {
display: block;
top: -31.5%;
height: 50px;
width: 100%;
position: relative;
background-color: #F5F3F3;
border-radius: 0px 0px 9px 9px;
}
.image {
height: 110%;
width: 100%;
position: relative;
border-radius: 9px;
}
.foot {
border-top: 1px solid black;
height: 20px;
width: 100%;
top: 38.5%;
position: relative;
}
#footext {
margin: auto;
position: relative;
left: 28%;
font-size: 0.8em;
color: grey;
}
#Vaerksted {
height: 110%;
width: 100%;
position: relative;
display: block;
}
.Overflow {
height: 240px;
width: 99.8%-1px;
overflow: hidden;
margin: auto;
}
.header {
border-top: 1px solid black;
border-bottom: 1px solid black;
}
h3 {
margin: 0px
}
h4 {
margin: 0px
}
.New {
width: 90%;
height: 90%;
margin: auto;
margin-top: 10px;
margin-bottom: 15px;
position: relative;
background-color: white;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .16);
box-shadow: 0 1px 1px rgba(0, 0, 0, .16);
padding: 5px;
display: flex;
flex-wrap: wrap;
flex-direction: row;
}
.carfs {
height: 250px;
width: 250px;
border: 1px solid black;
border-radius: 9px;
position: relative;
top: 20px;
left: 0px;
margin-left: 10px;
margin-bottom: 15px;
display: inline-block;
overflow: hidden;
}
.men0img {
height: 60px;
position: relative;
top: -5px;
}
.del3 {
width: 38%;
height: 318px;
float: right;
position: relative;
top: -322px;
left: -12px;
overflow: hidden;
border: 1px solid #EAEAEA;
-webkit-box-shadow: 0 2px 2px rgba(0, 0, 0, .16);
box-shadow: 0 2px 2px rgba(0, 0, 0, .16);
}
.3delt {
height: 500px;
width: 100%;
position: relative;
}
.del1 {
width: 60%;
border: 1px solid #C6C8C8;
}
.velkommen {
font-size: 1em;
}
.aabningstider {
height: 100px;
width: 100px;
}
.googlemaps {
height: 159px;
width: 345px;
overflow: hidden;
top: 20px;
position: relative;
}
.google_maps {
top: 25px;
margin-top: auto;
position: relative;
overflow: hidden;
}
.randlogo {
height: 56px;
width: 140px;
position: relative;
top: -2px;
margin-left: auto;
margin-right: auto;
}
#Mc {
margin-bottom: auto;
height: 110%;
position: relative;
top: -20px;
}
.op {
}
}
Now for my html
<div class="op">
<div class="New">
<div class="header">
<h3>Nyeste Biler</h3>
</div>
<div class="flexit">
<div class="carfs">
<img src="Car.jpg" class="image">
<div class="desc">
<p>
- Kilometer: 147000 KM
<br> - Geartype: Automatgear
<br> - Brænsstoftype: Benzin
</p>
<p>
- Farve: Sølv metal
<br> - Antal døre: 5 Døre
<br> - Type: Stationcar
</p>
</div>
</div>
<div class="carfs">
<img src="Car1.jpg" class="image">
<div class="desc">
<p>
- Kilometer: 153000 KM
<br> - Geartype: Manuel
<br> - Brænsstoftype: Benzin
</p>
<p>
- Farve: Sort metal
<br> - Antal døre: 5 Døre
<br> - Type: Stationcar
</p>
</div>
</div>
<div class="carfs">
<img src="MC.jpg" class="image" id="Mc">
<div class="desc">
<p>
- Kilometer: 72000 KM
<br> - Hestekræfter: 96Hk
<br> - Brænsstoftype: Benzin
</p>
<p>
- Farve: Rød
<br> - Antal døre: 0 Døre
<br> - Type: Standard
</p>
</div>
</div>
<div class="carfs">
<img src="AC.jpg" class="image">
<div class="desc">
<p>
- Kilometer: 220000 KM
<br> - Geartype: Automatgear
<br> - Brænsstoftype: Benzin
</p>
<p>
- Farve: Hvid
<br> - Antal døre: 4 Døre
<br> - Type: Autocamper
</p>
</div>
</div>
</div>
</div>
</div>
Revised Answer
The problem isn't the flexbox.
The problem is that you have a div – .del3 – which is relatively positioned upward.
Because .del3 is relatively positioned, adjacent elements will respect its original place in the layout.
The large white space represents the location of del3 before you moved it up with top: -322px.
Here's your layout with top: -322px commented out:
DEMO
There are many better ways to accomplish this layout.
There's flexbox, of course.
Or you could take del3 out of the flow with absolute positioning, so adjacent boxes ignore its existence. (Make sure to set the parent – .3delt – to position: relative.)
Or you could simply apply float: left to the first div in the row:
.del1 {
width: 60%;
border: 1px solid #C6C8C8;
float: left; /* NEW */
}
.del3 {
width: 38%;
height: 318px;
/* float: right; */
/* position: relative; */
/* top: -322px; */
/* left: -12px; */
overflow: hidden;
border: 1px solid #EAEAEA;
-webkit-box-shadow: 0 2px 2px rgba(0, 0, 0, .16);
box-shadow: 0 2px 2px rgba(0, 0, 0, .16);
}
DEMO
Original Answer
Try removing or adjusting height: 240px from:
#media screen and (min-width: 1px)
.Overflow {
height: 240px;
width: 99.8%-1px;
overflow: hidden;
margin: auto;
}
Also, the width rule has a syntax error. Try this: width: calc(98.8% - 1px);
DEMO