I have a header button which looks like this
here is the code:
.button {
width: 148px !important;
min-height: 40px !important;
font-family: 'Teko', sans-serif !important;
font-weight: 500 !important;
font-size: 20px !important;
background: transparent !important;
margin-bottom: 60px !important;
backdrop-filter: blur(12px);
}
and then I have a hamburger menu like this:
here is the code:
<div className={styles.overlay}>
<div className={styles.content}>
<span className={styles.openedArrow2}></span>
<h1 onClick={onClick2}>{'Main Menu'}</h1>
{pagination && (
<>
<span className={styles.pagination}>.</span>
<h2 onClick={onClick3}>Services</h2>
</>
)}
</div>
</>
)}
<div onClick={onClick} className={styles.close}></div>
</div>
{children}
</div>
</div>
.overlay{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 200vh;
overflow: auto;
background-color: rgba(18, 34, 45, 0.65);
}
.content{
position: absolute;
width:294px;
height: 640px;
background: rgb(62,75,83, 0.88);
backdrop-filter: blur(15px);
padding: 24px 20px 0 42px;
top:0;
right: 0;
line-height: 2;
}
When I open the menu, it looks like this:
When I comment the backdrop-filter: blur(12px), it works fine but I need the button to be blurred. How to fix this?
Increase the z-index of your overlay clas
z-index:9999999;
Related
I have a which contains a gridlayout with some cells. When the div is shown or hidden it should scale gradually over time. Currently when showing, the div is initially sized to fit the contents and then scales. When hidden it is immediately hidden unless padding is set. Then it is immediately resized to the size of the padding.
Example is shown below. How to adapt the styling in such that the div resizes smoothly and text stays in place (clips and does not wrap)
function toggle() {
if (document.getElementsByClassName("ovdInfobox")[0].classList.contains("ovdInfobox--visible")) {
document.getElementsByClassName("ovdInfobox")[0].classList.remove("ovdInfobox--visible")
console.log('remove');
} else {
document.getElementsByClassName("ovdInfobox")[0].classList.add("ovdInfobox--visible")
console.log('add');
}
}
.ovdInfobox {
display: grid;
grid: 40px auto / auto auto;
z-index: 1;
position: absolute;
top: 50px;
width: 0;
height: 0;
min-width: 0;
min-height: 0;
overflow: hidden;
padding: 0;
border: 0;
background: rgba(255, 255, 255, 0.98);
border-radius: 4px;
font-family: inherit;
font-size: inherit;
line-height: inherit;
transition: all 4.2s ease-in-out;
background: green;
}
.ovdInfobox--visible {
width: unset;
height: unset;
min-width: 300px;
border: 1px solid #d1d1d1;
/* padding: 15px 15px 15px 15px;*/
}
.ovdInfobox__header {
grid-column-start: span 2;
color: #c20063;
font-size: 18px;
font-weight: normal;
}
.ovdInfobox__label {
font-weight: bold;
}
.ovdInfobox__data {}
<div>
<button onclick="toggle()">
Click Me!
</button>
<div class="ovdInfobox ovdInfobox--visible" onCLick="toggle()">
<div class="ovdInfobox__header">Details</div>
<div class="ovdInfobox__label">
label
</div>
<div class="ovdInfobox__data">
data
</div>
<div class="ovdInfobox__label">
label
</div>
<div class="ovdInfobox__data">
data
</div>
</div>
</div>
New day, fresh start, fresh mind.
Changed class .ovdInfobox and .ovdInfobox--visible by replacing width, height, min-width and min-height by max-width and max-height. Resizing now works as expected.
function toggle() {
if (document.getElementsByClassName("ovdInfobox")[0].classList.contains("ovdInfobox--visible")) {
document.getElementsByClassName("ovdInfobox")[0].classList.remove("ovdInfobox--visible")
console.log('remove');
} else {
document.getElementsByClassName("ovdInfobox")[0].classList.add("ovdInfobox--visible")
console.log('add');
}
}
.ovdInfobox {
display: grid;
grid: 40px auto / auto auto;
column-gap:10px ;
row-gap: 5px;
z-index: 1;
position: absolute;
top: 50px;
max-width: 0;
max-height: 0;
overflow: hidden;
padding: 0;
border: 0;
background: rgba(255, 255, 255, 0.98);
border-radius: 4px;
font-family: inherit;
font-size: inherit;
line-height: inherit;
transition: all 4.2s ease-in-out;
background: green;
}
.ovdInfobox--visible {
max-width: 300px;
max-height: 200px;
border: 1px solid #d1d1d1;
padding: 15px 15px 15px 15px;
}
.ovdInfobox__header {
grid-column-start: span 2;
color: #c20063;
font-size: 18px;
font-weight: normal;
}
.ovdInfobox__label {
font-weight: bold;
}
.ovdInfobox__data {}
<div>
<button onclick="toggle()">
Click Me!
</button>
<div class="ovdInfobox ovdInfobox--visible" onCLick="toggle()">
<div class="ovdInfobox__header">Details</div>
<div class="ovdInfobox__label">
label
</div>
<div class="ovdInfobox__data">
data
</div>
<div class="ovdInfobox__label">
label
</div>
<div class="ovdInfobox__data">
data
</div>
</div>
</div>
when opening a modal form with round corners I wish to remove the white background
This is my css for the modal form
.modal-msg {
.modal-dialog {
width: 25vw !important;
max-width: 35vw !important;
}
.form-msg {
box-shadow: -20px 20px 30px 0 rgba(0, 0, 0, 0.16);
background-image: linear-gradient(41deg, #40d2ea, #964ada 54%, #7d2abd 77%, #7c29bb 77%, #541b7e 91%);
color: #fff;
overflow: hidden;
border-radius: 120px;
background-radius: 120px;
.modal-header {
border: none;
padding-bottom: 0 !important;
justify-content: space-around;
.close-icon {
background-image: url('close.svg');
width: 20px;
height: 20px;
background-repeat: no-repeat;
background-size: contain;
margin-left: 10px;
z-index: 100;
&:focus {
outline: none;
}
}
.header {
font-size: 33px;
font-weight: 600;
}
}
.modal-body {
padding: 1rem 12%;
.header {
font-size: 33px;
font-weight: 600;
direction: rtl;
margin-bottom: 1rem;
}
.form-control {
color: #112d60;
font-weight: 600;
&:focus {
border-color: #112d60 !important;
}
}
}
.background {
width: 100%;
position: relative;
.circle {
position: absolute;
}
}
}
}
I've tried setting the background to transparent and playing with background-clip I guess I'm using it wrong or in not in the right order
please advice,
cheers.
the html code using this is:
<div class="form-msg">
<div class="background">
<div class="circle left-circle"></div>
<div class="circle right-circle"></div>
</div>
<div class="modal-header">
<button type="button" class="close" aria-label="Close" (click)="close()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12 text-center header">
<span class="inspire-text">Inspiration Msg</span>
</div>
</div>
</div>
</div>
I finally figured it out and overloaded modal-content like this
.modal-content{
background-color: transparent;
border:none !important;
}
I'm working on a website splash page which should show rows of same height. Each row has a title and further text items and one image.
The text and image items should align at the bottom of each row as shown on following screenshot
On Hover, the image should slide up to max height which fits into the row.
My question is:
Can I access the current value of 1fr from parent row grid-auto-rows: 1fr;to give the image on hover a max height?
This is how my code currently looks like:
html, body {margin:0; padding:0}
.jumbo {
width: 100%;
height: 100vh;
background: yellow;
display: grid;
grid-auto-rows: 1fr;
}
.jumbo__item {
position: relative;
box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.75);
font-size: 20vh;
padding: 0 0 0 10px;
#overflow: hidden;
}
.jumbo__rowtags{
position: absolute;
bottom: 0;
right: 0;
}
.jumbo__tag {
margin-right: 10px;
display: inline-block;
background: white;
vertical-align: bottom;
height: 30px;
padding: 0 10px;
font-size: 20px;
line-height: 30px;
}
.jumbo__tag-high{
height: 30px;
overflow: hidden;
background: none;
cursor: pointer;
}
.jumbo__tag-high:hover{
height: auto;
max-height: 200px;
}
.a {background: lightblue; }
.b {background: lightgreen}
.c {background: lightgrey}
<div class="jumbo">
<div class="jumbo__item a">
Dogs
</div>
<div class="jumbo__item b">
and
<section class="jumbo__rowtags">
<span class="jumbo__tag jumbo__tag-high"><img src="https://placeimg.com/350/200/nature"></span>
<span class="jumbo__tag">Hello</span>
<span class="jumbo__tag">World</span>
</section>
</div>
<div class="jumbo__item c">
cats
</div>
</div>
You can make the image and its container to be height:100% of the row then consider a transform animation
html, body {margin:0; padding:0}
.jumbo {
width: 100%;
height: 100vh;
background: yellow;
display: grid;
grid-auto-rows: 1fr;
}
.jumbo__item {
position: relative;
box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.75);
font-size: 20vh;
padding: 0 0 0 10px;
#overflow: hidden;
}
.jumbo__rowtags{
position: absolute;
bottom: 0;
right: 0;
top:0; /* added */
}
.jumbo__tag {
margin-right: 10px;
display: inline-block;
background: white;
vertical-align: bottom;
height: 30px;
padding: 0 10px;
font-size: 20px;
line-height: 30px;
}
.jumbo__tag-high{
height: 100%; /* added */
overflow: hidden;
background: none;
cursor: pointer;
}
.jumbo__tag-high img {
height:100%; /* added */
transform:translateY(calc(100% - 30px));
transition:1s all;
}
.jumbo__tag-high:hover img{
transform:translateY(0%);
}
.a {background: lightblue; }
.b {background: lightgreen}
.c {background: lightgrey}
<div class="jumbo">
<div class="jumbo__item a">
Dogs
</div>
<div class="jumbo__item b">
and
<section class="jumbo__rowtags">
<span class="jumbo__tag jumbo__tag-high"><img src="https://placeimg.com/350/200/nature"></span>
<span class="jumbo__tag">Hello</span>
<span class="jumbo__tag">World</span>
</section>
</div>
<div class="jumbo__item c">
cats
</div>
</div>
I have a main position: relative.
Nested (input check box) position: absolute.
When the checkbox is checked the inside div color will scale to 500px. The problem is the color will spill out its main .
Here is the screen shot of the checkbox border spilling out of the main square . https://pasteboard.co/I7uA6am.jpg
What I am trying to do is When we click the circle checkbox at the bottom right. The background color of that checkbox will fill the entire main which is a rectangle of 300px by 400px. In this case the checkbox border takes almost the entire screen as it is set to 500px.
I have tried
- Z-index
- Setting the width of the box-shadow transform to 100% width of the main
- overflow: hidden.
- position: absolute;
None of those solutions worked.
// HTML CODE //
<div class="card">
<input type="checkbox" name="">
<div class="toggle">+</div>
<div class="imgBox"> </div>
<div class="content"> </div>
<div class="details">
<h2>A quick check on CSS</h2>
<p> Just doing a quick test on CSS</p>
</div>
</div>
// CSS CODE //
card {
position: relative;
width: 300px;
height: 400px;
background: #262626;
}
input,
.toggle {
position: absolute;
width: 50px;
height: 50px;
bottom: 20px;
right: 20px;
border: none;
outline: none;
z-index: 10;
}
input {
opacity: 0;
}
.toggle {
pointer-events: none;
border-radius: 50%;
background: #fff;
transition: 0.5s;
text-align: center;
font-size: 36px;
line-height: 40px;
box-shadow: 0 0 0 0px #9c27b0;
overflow: hidden;
}
/* WHEN INPUT IS SET TO CHECK, TOGGLE APPEARS */
input:checked ~ .toggle {
box-shadow: 0 0 0 500px #9c27b0;
transform: rotate(500);
}
As i understand you would need overflow:hidden on the .card. please let me know if this is what you were looking for
.card {
position: relative;
width: 300px;
height: 400px;
background: #262626;
overflow: hidden;
}
input,
.toggle {
position: absolute;
width: 50px;
height: 50px;
bottom: 20px;
right: 20px;
border: none;
outline: none;
z-index: 10;
}
input {
opacity: 0;
}
.toggle {
pointer-events: none;
border-radius: 50%;
background: #fff;
transition: 0.5s;
text-align: center;
font-size: 36px;
line-height: 40px;
box-shadow: 0 0 0 0px #9c27b0;
overflow: hidden;
}
input:checked~.toggle {
box-shadow: 0 0 0 300px #9c27b0;
transform: rotate(500);
}
<div class="card">
<input type="checkbox" name="">
<div class="toggle">+</div>
<div class="imgBox"> </div>
<div class="content"> </div>
<div class="details">
<h2>A quick check on CSS</h2>
<p> Just doing a quick test on CSS</p>
</div>
</div>
is this how you want it?
card {
position: relative;
width: 300px;
height: 400px;
background: #262626;
}
input,
.toggle {
position: absolute;
width: 50px;
height: 50px;
bottom: 20px;
right: 20px;
border: none;
outline: none;
z-index: 10;
}
input {
opacity: 0;
}
.toggle {
pointer-events: none;
border-radius: 50%;
background: #fff;
transition: 0.5s;
text-align: center;
font-size: 36px;
line-height: 40px;
box-shadow: 0 0 0 0px #9c27b0;
overflow: hidden;
}
input:checked~.toggle {
box-shadow: 0 0 0 300px #9c27b0;
transform: rotate(500deg);
background-color: #9c27b0;
}
<div class="card">
<input type="checkbox" name="">
<div class="toggle">+</div>
<div class="imgBox"> </div>
<div class="content"> </div>
<div class="details">
<h2>A quick check on CSS</h2>
<p> Just doing a quick test on CSS</p>
</div>
</div>
I am trying to achieve the box-shadow inside the right-border, currently everything is working fine except the shadow is getting display outside the right border. Following is the js-fiddle sample code I have tried...
http://jsfiddle.net/5y1guk6d/1/
HTML:
<div class="header">
<div class="header-bar">
<h1 class="title">Page title</h1>
</div>
</div>
<div class="main">
<div class="left-bar">
<div class="menu">
Menu Content
</div>
</div>
<div class="content">
Main content area
</div>
</div>
CSS:
.header {
width: 100%;
height: 40px;
top: 0;
color: white;
}
.header-bar {
height: 100%;
overflow: hidden;
background-color: #009BE1;
}
h1.title {
display: inline-block;
font: bold 16px Arial, sans-serif;
margin: 0 5px 0 15px;
position: relative;
top: 25%;
}
.main {
width: 100%;
overflow: hidden;
position: absolute;
top: 48px;
bottom: 0;
}
/* left bar */
.left-bar {
width: 160px;
float: left;
padding:10px;
background-color: #F0F0F0;
height: 100%;
position: relative;
border-right:1px solid #aaa;
box-shadow:5px 0 5px #ccc;
}
.content {
overflow: hidden;
left: 12px;
padding: 5px 17px 5px 5px;
height: 100%;
position: relative;
}
Appreciated your help..
If you want the box shadow to appear inside of the element instead of outside, use inset. Then you want to invert the x-offset so it appears on the right side.
box-shadow:inset -5px 0 5px #ccc;
http://jsfiddle.net/5y1guk6d/3/