Shadow between two divisions in the CSS - css

I am creating a site in order to monitor employees, and there are many interfaces within the site, and from these interfaces there is an interface to add a project, which is the interface shown in the image and as shown in the image there are two sections in the interface, the first part is colored in white and the second section is colored in blue.
How can I create shadow between the two sections?
<template>
<v-app>
<div class="mainPage">
<!-- right section -->
<div class="split left">
<div class="left_body_content">
<div class="left-body-content_logo">
<img class="logo" src="../../../../src/assets/logo_base.png" />
</div>
<div class="left-body-content_illustrationImage">
<v-img src="../../../../src/assets/create.svg"></v-img>
</div>
</div>
</div>
<div class="split-1 right">
<div class="right_body_content">
<div class="right_body_content_text">
<div class="text">
<h1>Create project</h1>
</div>
</div>
<div class="right_body_content_field">
<v-text-field
label="Project Name"
v-model="project_Name"
color="#5f48ea "
class="field"
>{{ project_Name }}
</v-text-field
>
</div>
<div class="right_body_content_button">
</div>
</div>
</div>
</div>
</v-app>
</template>
<style scoped>
.mainPage {
justify-content: flex-start;
align-items: flex-start;
position: relative;
width: 100%;
height: auto;
padding: 0;
margin: 0;
}
.split {
height: 100%;
width: 66%;
position: fixed;
z-index: 1;
top: 0;
overflow-x: hidden;
}
.left_body_content {
display: flex;
width: 100%;
}
.left {
left: 0;
background-color: #fff;
}
.left-body-content_logo {
display: flex;
width: 18%;
padding-left: 2rem;
}
.logo {
display: flex;
width: 100%;
z-index: -1;
}
.left-body-content_illustrationImage {
display: flex;
justify-content: center;
align-content: center;
align-items: center;
background-size: cover;
background-position: center;
z-index: -1;
width: 90%;
height: 100%;
position: absolute;
padding-top: 7rem;
padding-left: 5rem;
}
.split-1 {
height: 100%;
width: 34%;
position: fixed;
z-index: 1;
top: 0;
overflow-x: hidden;
padding-top: 2rem;
}
.right_body_content {
display: flex;
width: 100%;
height: 100%;
}
.right_body_content_text {
display: flex;
justify-content: flex-start;
align-items: center;
text-align: center;
width: 90%;
height: 50%;
padding-left: 2rem;
}
.text {
display: flex;
font-family: Aviliator;
color: #5f48ea;
}
.right_body_content_field{
display: flex;
justify-content: flex-start;
align-items: center;
position: fixed;
width: 25%;
height: 100%;
padding-left: 2.5rem;
}
.field{
display: flex;
width: 40%;
height: 30%;
}
.right {
right: 0;
background-color: blue;
}
</style>

Add class shadow to the div having class split-1 and define shadow class in styles as
.shadow{
-webkit-box-shadow: -3px 0px 0px #ccc; /* Safari 3-4, iOS 4.0.2 - 4.2,
-moz-box-shadow: -3px 0px 0px #ccc; /* Firefox 3.5 - 3.6 */
box-shadow: -3px 0px 0px #ccc; /* IE 9, Firefox 4+, Chrome 6+ */
}
this will add a shadow of 3px to the left of the div with class shadow
You can read more about box-shadow here - https://css-tricks.com/almanac/properties/b/box-shadow/

Here I have created two div's
and for shadow using:
box-shadow: /* offset-x | offset-y | blur-radius | spread-radius | color */
.first {
background-color: rgba(0, 0, 0, 0);
width: 500px;
height: 100px;
box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2);
margin: 5px;
}
.second {
background-color: rgba(0, 0, 255, 1);
width: 500px;
height: 100px;
box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2);
}
<div>
<div class="first">
</div>
<div class="second">
</div>
</div>

Related

Burger Menu Placement in Flexbox

I want to build a little note taking app but i cant figure out how i can put a burger menu on the right side of the flexbox. Down here you can find my js and css file:
JavaScript / HTML
<div className={styles.wrapper}>
<main className={styles.content}>
<div className={styles.templatelist}>
<div className={styles.template}>
<h2>Daily Meeting Minutes</h2>
<div className={styles.properties}>
<p>Sections: 5</p>
<p>Questions: 5</p>
<p>Tables: 5</p>
</div>
</div>
</div>
</main>
</div>
I have tried to create a new div and position it with top and left but nothing seems to work for me.
CSS
.wrapper {
display: flex;
margin-top: 2rem;
}
.content {
display: flex;
flex-direction: column;
margin: auto;
width: 50%;
height: 100%;
}
.templatelist {
margin-top: 2rem;
display: flex;
flex-direction: column;
}
.template {
width: 100%;
height: 6rem;
border-radius: 1rem;
padding: 1rem;
background: rgba(255, 255, 255, 0);
border-radius: 16px;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(13.3px);
-webkit-backdrop-filter: blur(13.3px);
border: 1px solid rgba(255,153,0, .5);
}
.properties {
display: flex;
flex-direction: row;
margin-top: 1rem;
gap: 2rem;
}
Codepen
https://codepen.io/Vylex/pen/ZERgxzm
Desired outcome
.template {
width: 100%;
height: 6rem;
border-radius: 1rem;
padding: 1rem;
background: rgba(255, 255, 255, 0);
border-radius: 16px;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(13.3px);
-webkit-backdrop-filter: blur(13.3px);
border: 1px solid rgba(255,153,0, .5);
display: flex;
justify-content: space-between;
}
.properties {
display: flex;
flex-direction: column;
}
p {
margin: .5rem;
}
I recommend you do the following:
<div class="templatelist">
<div class="template">
<h2>Daily Meeting Minutes</h2>
<div class="properties">
<p>Sections: 5</p>
<p>Questions: 5</p>
<p>Tables: 5</p>
</div>
</div>
<div class="menu">Burger</div>
keep the border and everything in the templateList class. Use the display to flex, flex-direction to row, and justify-content to space-between. I believe this will work for you.
CSS and HTML
.wrapper {
display: flex;
margin-top: 2rem;
}
.content {
display: flex;
flex-direction: column;
margin: auto;
width: 50%;
height: 100%;
}
.templatelist {
margin-top: 2rem;
display: flex;
flex-direction: column;
}
.template {
width: 100%;
border-radius: 1rem;
padding: 1rem;
background: rgba(255, 255, 255, 0);
border-radius: 16px;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(13.3px);
-webkit-backdrop-filter: blur(13.3px);
border: 1px solid rgba(255,153,0, .5);
}
.properties {
display: flex;
flex-direction: row;
gap: 2rem;
justify-content: space-between;
align-items: center;
}
.burger{
font-size: 2em;
}
.options{
display: flex;
column-gap: 1em;
}
<div class="wrapper">
<main class="content">
<div class="templatelist">
<div class="template">
<div class="properties">
<div class="left">
<h2>Daily Meeting Minutes</h2>
<div class="options">
<p>Sections: 5</p>
<p>Questions: 5</p>
<p>Tables: 5</p>
</div>
</div>
<div class="burger">
<p>:</p>
</div>
</div>
</div>
</div>
</main>
</div>

How can I make flexbox overlay with object-fit working properly

This may be a begginer question, but I just can't seem to figure it out.
HTML:
<div id = "upper">
<input id = "leftBigArrow" class = "button" type="button">
<div id = "picBox">
<img id = "bigPic" src="images/IMG_1744.JPG" alt="">
<div id = "overlay">
<div id = "olText">
<h1>Title</h1>
<p>Description</p>
</div>
</div>
</div>
<input id = "rightBigArrow" class = "button" type="button">
</div>
CSS:
#upper {
display: flex;
background: white;
box-shadow: 0px 0px 7px 2px #313131;
}
#picBox {
width: 800px;
height: 600px;
background-color: #8D918D;
display: flex;
}
#pigPic {
object-fit: contain;
object-position: center;
z-index: 1;
}
#overlay {
align-self: flex-end;
width: 100%;
height: 20%;
background-color: black;
color: white;
opacity: 0.6;
margin: 0;
font-size: 80%;
z-index: 2;
}
#olText {
display: flex;
width: 100%;
height: 100%;
flex-direction: column;
justify-content: center;
}
h1, p {
margin-left: 20px;
}
h1 {
margin-top: 0;
margin-bottom: 10px;
}
p {
margin-top: 0;
margin-bottom: 0;
}
In #picBox I have 2 items, an image (#bigPic) with object-fit attribute and a div with a div with 2 text items (#overlay). I want to have the overlay over the image. Overlay height is 20% at the bottom of #picBox and the 2 text items in #olText need to be arranged as css shows. If I use position absolute and relative, it messes up the object-fit. So how can I make this work as I intended?
In CSS, if you want to overlay an element, that element's position (in this case #picBox) needs to be set to relative first. Then the position of the element you want on top (#overlay) should be set to absolute. See the example below.
#upper {
display: flex;
background: white;
box-shadow: 0px 0px 7px 2px #313131;
}
#picBox {
width: 800px;
height: 600px;
background-color: #8D918D;
display: flex;
position: relative;
}
#pigPic {
object-fit: contain;
object-position: center;
z-index: 1;
}
#overlay {
align-self: flex-end;
width: 100%;
height: 20%;
background-color: black;
color: white;
opacity: 0.6;
margin: 0;
font-size: 80%;
z-index: 2;
position: absolute;
}
#olText {
display: flex;
width: 100%;
height: 100%;
flex-direction: column;
justify-content: center;
}
h1,
p {
margin-left: 20px;
}
h1 {
margin-top: 0;
margin-bottom: 10px;
}
p {
margin-top: 0;
margin-bottom: 0;
}
<div id="upper">
<input id="leftBigArrow" class="button" type="button">
<div id="picBox">
<img id="bigPic" src="https://www.w3schools.com/tags/img_pink_flowers.jpg" alt="">
<div id="overlay">
<div id="olText">
<h1>Title</h1>
<p>Description</p>
</div>
</div>
</div>
<input id="rightBigArrow" class="button" type="button">
</div>

Correctly style Image inside grid-auto-rows

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>

Force 100% height and vertically align content in FlexBox Columns

I've looked at many other questions and answers, but can't figure out why I can't force 100% height on some flexbox columns - i.e., "Genre" with one line of text to match the height of "Song & The Artist" with two lines - while also vertically aligning and centering all text:
Codepen: https://codepen.io/bluedogranch/pen/ZEYXGmx
HTML:
<div class="Rtable Rtable--4cols Rtable--collapse">
<div class="Rtable-cell genre-cell">Genre</div>
<div class="Rtable-cell song-cell">Song<br /><span class="artist">The Artist</span></div>
<div class="Rtable-cell flag-cell">Length</div>
<div class="Rtable-cell link-cell">Link</div>
<div class="Rtable-cell genre-cell">Genre</div>
<div class="Rtable-cell song-cell">Song<br /><span class="artist">The Artist</span></div>
<div class="Rtable-cell flag-cell">Length</div>
<div class="Rtable-cell link-cell">Link</div>
</div>
CSS:
html, body {
min-height: 100%;
margin: 0 auto;
}
.Rtable {
display: flex;
height: 100%;
flex-wrap: wrap;
justify-content: center;
align-items: center;
margin: 0;
padding: 0;
}
.Rtable-cell, .genre-cell, .song-cell, .flag-cell, .link-cell {
box-sizing: border-box;
flex-grow: 0;
width: 100%;
height: 100%;
padding: 0.5em 0em 0.5em 0em;
overflow: hidden;
list-style: none;
color: #000;
font-size: 12px;
text-align: center;
}
.genre-cell {
width: 20% !important;
font-weight: bold;
}
.song-cell {
width: 40% !important;
}
.flag-cell {
width: 30% !important;
}
.link-cell {
width: 10% !important;
}
.Rtable--4cols > .Rtable-cell {
width: 25%;
}
.Rtable {
position: relative;
top: 1px;
left: 1px;
}
.Rtable-cell {
margin: -1px 0 0 -1px;
border: solid 1px #000000;
}
html, body {
min-height: 100%;
margin: 0 auto;
}
.Rtable {
display: flex;
height: 100%;
flex-wrap: wrap;
justify-content: center;
align-items: stretch;
margin: 0;
padding: 0;
}
.Rtable-cell, .genre-cell, .song-cell, .flag-cell, .link-cell {
display: flex;
box-sizing: border-box;
justify-content: center;
align-items: center;
width: 100%;
padding: 0.5em 0em 0.5em 0em;
overflow: hidden;
list-style: none;
color: #000;
font-size: 12px;
text-align: center;
}
.genre-cell {
width: 20% !important;
font-weight: bold;
}
.song-cell {
width: 40% !important;
}
.flag-cell {
width: 30% !important;
}
.link-cell {
width: 10% !important;
}
.Rtable--4cols > .Rtable-cell {
width: 25%;
}
.Rtable {
position: relative;
top: 1px;
left: 1px;
}
.Rtable-cell {
margin: -1px 0 0 -1px;
border: solid 1px #000000;
}
<div class="Rtable Rtable--4cols Rtable--collapse">
<div class="Rtable-cell genre-cell">Genre</div>
<div class="Rtable-cell song-cell"><div>Song<br /><span class="artist">The Artist</span></div></div>
<div class="Rtable-cell flag-cell">Length</div>
<div class="Rtable-cell link-cell">Link</div>
<div class="Rtable-cell genre-cell">Genre</div>
<div class="Rtable-cell song-cell"><div>Song<br /><span class="artist">The Artist</span></div></div>
<div class="Rtable-cell flag-cell">Length</div>
<div class="Rtable-cell link-cell">Link</div>
</div>

why does box-shadow disappear for a div when i remove the relative position for the div?

i have a top_div which when set to relative position box shadow retains. and when i remove relative position box shadow disappears. could someone help me understanding this or where am i going wrong.
Below is the code,
<div class="top_div">
<div class="drawer">
<div class="menu">
<header>
<Svg>
<button></button>
</header>
<ul>
<li></li>
</ul></div></div></div>
.top_div {
z-index: 1;
display: flex;
position: relative;
width: 100%;
height: 48px;
padding: 0 12px 0 12px;
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.3);
align-items: center;
}
.drawer {
display: flex;
flex-direction: column;
background-color: $white;
position: absolute;
width: 380px;
top: 55px;
right: 8px;
min-height: 40%;
max-height: 80%;
header {
height: 41px;
border-bottom: 1px solid #CCCCCC;
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 0px;
padding-top: 2px;
svg {
margin-left: 16px;
}
}
ul {
overflow-x: hidden;
}}}

Resources