Burger Menu Placement in Flexbox - css

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>

Related

How can we shrink middle flex item?

I am trying to make a layout from flexbox. I have 3 column of boxes which have following layout till they reach mobile layout where they will stack on top of another.
But before I reach mobile layout I am trying to shrink all the items proportionally. (i.e when I reduce the browsers width, it should equally be small). But only the left and right items are equally reducing except the middle item. How do I make that shrink so that all the items proportionally shrink while reducing browsers width?
CODE GOES HERE
.container {
width: 100%;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding-top: 80px;
}
.box {
width: 400px;
/* min-width: 280px; */
height: 400px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid black;
font-size: 30px;
font-weight: bold;
font-family: cursive;
box-shadow: 1px 4px 3px rgba(0, 0, 0, 0.5);
}
.box1 {
background: grey;
}
.box2 {
background: green;
margin-bottom: 20px;
}
.box3 {
background: greenyellow;
}
.box4 {
background: orange;
}
.middle-part {
margin: 0px 20px;
/* min-width: 280px; */
}
<div class="container">
<div class="box box1">
I am box1
</div>
<div class="middle-part">
<div class="box box2">
I am box2
</div>
<div class="box box3">
I am box3
</div>
</div>
<div class="box box4">
I am box4
</div>
</div>
If you want it to shrink dynamically, you need to remove the width set. Add flex-grow: 1 on .box and .middle-part to make it grow. In addition, padding-top only accept 1 value, so perhaps some typos there.
.container {
width: 100%;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding-top: 80px 40px; /* padding top only accept 1 value */
}
.middle-part {
flex-grow: 1;
}
.box {
flex-grow: 1;
/* min-width: 280px; */
height: 400px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid black;
font-size: 30px;
font-weight: bold;
font-family: cursive;
box-shadow: 1px 4px 3px rgba(0, 0, 0, 0.5);
}
.box1 {
background: grey;
}
.box2 {
background: green;
margin-bottom: 20px;
}
.box3 {
background: greenyellow;
}
.box4 {
background: orange;
}
.middle-part {
margin: 0px 20px;
/* min-width: 280px; */
}
<body>
<div class="container">
<div class="box box1">
I am box1
</div>
<div class="middle-part">
<div class="box box2">
I am box2
</div>
<div class="box box3">
I am box3
</div>
</div>
<div class="box box4">
I am box4
</div>
</div>
</body>

Shadow between two divisions in the 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>

Flex wrap not working with fixed width container

I have a flex-box container with two child containers where the right should fold under the left at smaller screens. However, this only seems to work when the parent container width is 100% and not when it's set to a fixed width. It needs a fixed width based on a design, and I've tried wrapping the fixed width container in a parent container with a 100% width, but this isn't effective.
How can I set the container with a fixed width so that the items wrap correctly at smaller screen sizes?
.call-out-container {
width: 1172px;
display: flex;
-webkit-flex-flow: row wrap;
justify-content: space-around;
flex-wrap: wrap;
}
.call-out-box {
color: #eee;
font-weight: bold;
font-size: 3em;
text-align: center;
}
.call-out-box {
width: auto;
height: 200px;
color: #eee;
font-weight: bold;
font-size: 3em;
text-align: center;
}
.call-out-box h1 {
font-family: 'Helvetica';
color: #00477B;
font-weight: 400;
font-size: 56px;
}
.call-out-box p {
color: #333;
font-size: 12px;
}
<div class="call-out-container">
<div class="call-out-box">
<div style="width: 540px; height: 365px; margin: 0px 0px 0px 80px; display: flex; border: 2px solid orange; justify-content: center;">
<div style="width: 445px; height: 445px; background-color: rgb(255, 255, 255); box-shadow: rgb(221, 221, 221) 0px 3px 11px 4px; position: relative; right: -30px; top: 20px; text-align: center; vertical-align: middle;">
<p>CONTENT</p>
</div>
</div>
</div>
<div class="call-out-list">
<h1>10.5k</h1>
<p>Line 1</p>
<p>Line 2</p>
</div>
</div>
<div class="call-out-container">
<div class="call-out-list">
<h1>10.5k</h1>
<p>Line 1</p>
<p>Line 2</p>
</div>
<div class="call-out-box">
<div style="width: 540px; height: 365px; margin: 0px 0px 0px 80px; display: flex; border: 2px solid orange; justify-content: center;">
<div style="width: 445px; height: 445px; background-color: rgb(255, 255, 255); box-shadow: rgb(221, 221, 221) 0px 3px 11px 4px; position: relative; right: -30px; top: 20px; text-align: center; vertical-align: middle;">
<p>CONTENT</p>
</div>
</div>
</div>
</div>
JSFIDDLE LINK: LINK
Instead of using flexbox, use grid, if those sizes are fixed.
.call-out-box{
/*other styles*/
display:grid;
grid-template-columns: 540px 445px;
grid-template-rows: 365px 445px;
}
the just remove the width and the height attributes in the in-line style.
if sizes are fixed then use grid
also go here jsfiddle
.call-out-container {
width: 100%;
display: flex;
-webkit-flex-flow: row wrap;
justify-content: space-around;
flex-wrap: wrap;
margin-top: 200px;
}
.call-out-box {
color: #eee;
display:grid;
grid-template-columns: 540px 445px;
grid-template-rows: 365px 445px;
}
.call-out-list {
color: #eee;
font-weight: bold;
font-size: 3em;
text-align: center;
padding-top: 100px;
}
.call-out-list h1{
font-family: 'Helvetica';
color: #00477B;
font-weight: 400;
font-size: 56px;
}
.call-out-list p {
color: #333;
font-size: 12px;
}
<div class="call-out-container">
<div class="call-out-box">
<div style="width: 540px; height: 365px; margin: 0px 0px 0px 80px; display: flex; border: 2px solid orange; justify-content: center;">
<div style="width: 445px; height: 445px; background-color: rgb(255, 255, 255); box-shadow: rgb(221, 221, 221) 0px 3px 11px 4px; position: relative; right: -30px; top: 20px; text-align: center; vertical-align: middle;">
<p>CONTENT</p>
</div>
</div>
</div>
<div class="call-out-list">
<h1>10.5k</h1>
<p>Line 1</p>
<p>Line 2</p>
</div>
</div>
<div class="call-out-container">
<div class="call-out-list">
<h1>10.5k</h1>
<p>Line 1</p>
<p>Line 2</p>
</div>
<div class="call-out-box">
<div style="width: 540px; height: 365px; margin: 0px 0px 0px 80px; display: flex; border: 2px solid orange; justify-content: center;">
<div style="width: 445px; height: 445px; background-color: rgb(255, 255, 255); box-shadow: rgb(221, 221, 221) 0px 3px 11px 4px; position: relative; right: -30px; top: 20px; text-align: center; vertical-align: middle;">
<p>CONTENT</p>
</div>
</div>
</div>
</div>

SVG images inside flex div display differently in Safari and Chrome

Where Chrome contains the SVG, Safari lets it stretch to a much larger size. Not sure what I can do to get rid of that behavior.
Here's a pen: https://codepen.io/sashakevich/pen/boEPdb
In Chrome it's perfect, in Safari the images are too large.
And here's the code:
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.row {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
padding: 30px 10px;
}
.text-item {
-ms-flex-preferred-size: 200px;
flex-basis: 200px;
margin: 0 1.5%;
}
.img-item {
-ms-flex-preferred-size: 33%;
flex-basis: 33%;
margin: 0 1.5%;
-webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
background: #fff;
border-radius: 3px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
padding: 25px 35px;
min-height: 200px;
}
.img-item img {
width: 100%;
height: auto;
}
<div class="row" style="background:#f1f1f1;">
<div class="text-item">
<p>A remake of their old logo of a kid holding a toothbrush.</p>
</div>
<div class="img-item">
<img src="https://www.simplylogos.net/wp-content/uploads/svg_port/sl-franklin-1.svg">
</div>
<div class="img-item">
<img src="https://www.simplylogos.net/wp-content/uploads/svg_port/sl-franklin-2.svg">
</div>
<div class="img-item">
<img src="https://www.simplylogos.net/wp-content/uploads/svg_port/sl-franklin-3.svg">
</div>
</div>
<div class="row" style="background:#e1e1e1;">
<div class="text-item">
<p>A remake of their old logo of a kid holding a toothbrush.</p>
</div>
<div class="img-item">
<img src="https://www.simplylogos.net/wp-content/uploads/svg_port/sl-mogtel-3.svg">
</div>
<div class="img-item">
<img src="https://www.simplylogos.net/wp-content/uploads/svg_port/sl-mogtel-1.svg">
</div>
<div class="img-item">
<img src="https://www.simplylogos.net/wp-content/uploads/svg_port/sl-mogtel-2.svg">
</div>
</div>
#Steve-Schrab's flex shrink solution didn't help - SVG in flexbox messes up height of other elements)
(Maybe I'm running into the Implied Minimum Size of Flex Items as suggested by #michael_b here: Why doesn't flex item shrink past content size? but if I am, I don't know what to do to make it behave.
It seems min-height on the .img-item is causing the issue. Changing this to max-height might get the desired result.
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.row {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
padding: 30px 10px;
}
.text-item {
-ms-flex-preferred-size: 200px;
flex-basis: 200px;
margin: 0 1.5%;
}
.img-item {
-ms-flex-preferred-size: 33%;
flex-basis: 33%;
margin: 0 1.5%;
-webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
background: #fff;
border-radius: 3px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
/* justify-content: center; */
/* align-self: stretch; */
padding: 25px 35px;
min-height: 200px;
/* position: relative; */
}
.img-item img {
width: 100%;
height: auto;
}
<div class="row" style="background:#f1f1f1;">
<div class="text-item">
<p>A remake of their old logo of a kid holding a toothbrush.</p>
</div>
<div class="img-item"><img src="https://www.simplylogos.net/wp-content/uploads/svg_port/sl-franklin-1.svg"></div>
<div class="img-item"><img src="https://www.simplylogos.net/wp-content/uploads/svg_port/sl-franklin-2.svg"></div>
<div class="img-item"><img src="https://www.simplylogos.net/wp-content/uploads/svg_port/sl-franklin-3.svg"></div>
</div>
<div class="row" style="background:#e1e1e1;">
<div class="text-item">
<p>A remake of their old logo of a kid holding a toothbrush.</p>
</div>
<div class="img-item"><img src="https://www.simplylogos.net/wp-content/uploads/svg_port/sl-mogtel-3.svg"></div>
<div class="img-item"><img src="https://www.simplylogos.net/wp-content/uploads/svg_port/sl-mogtel-1.svg"></div>
<div class="img-item"><img src="https://www.simplylogos.net/wp-content/uploads/svg_port/sl-mogtel-2.svg"></div>
</div>

Flexbox child not reading height/width of parent

I was experimenting with flexbox and created this layout. I'm trying to get the middle white box that says "hey" to be 90% width/height of the parent but percentages don't seem to affect it. (I have it set as 100px/100px currently which works)
It's strange since the parent has a defined width/height on inspection.
Can anyone tell me how to implement that? (also, general critique on how I used flexbox appreciated as well)
http://jsfiddle.net/yv3Lw5gy/1/
relevant class:
.super-thing{
height: 100px;
width: 100px;
background-color: white;
margin:auto;
box-shadow: 2px 1px 1px #000;
}
The .body parent of .super-thing is display: flex so its children don't inherit its height or width if they don't have flex properties.
###The power of flex compels you!
Set flex: 1 on .super-thing so it grows and shrinks with a 1% margin to create a gap. There is no need for a width or height.
.super-thing {
background-color: white;
margin: 1%;
box-shadow: 2px 1px 1px #000;
flex: 1;
}
###Complete Example
In this example, the box-sizing: border-box and the removal of the margin to be replaced with padding on <body>, get the entire container properly sized in the viewport so there is no scrollbar.
* {
background-color: rgba(255, 0, 0, .2);
box-sizing: border-box;
}
* * {
background-color: rgba(0, 255, 0, .2);
}
* * * {
background-color: rgba(0, 0, 255, .2);
}
* * * * {
background-color: rgba(255, 0, 255, .2);
}
* * * * * {
background-color: rgba(0, 255, 255, .2);
}
* * * * * * {
background-color: rgba(255, 255, 0, .2);
}
html,
body,
.container {
height: 100%;
}
body {
padding: 10px;
margin: 0;
}
.container {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: stretch;
/* align-content: center; */
}
.header {
flex: 1 0 30px;
display: flex;
}
.header-left {
flex: 11 0 auto;
}
.header-right {
flex: 1 0 auto;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
}
.header-right .small-item {
width: 100%;
outline: 1px solid #fff;
}
.main {
background-color: #fff;
flex: 10 0 30px;
display: flex;
}
.left-column {
flex: 3;
flex-direction: column;
display: flex;
justify-content: center;
}
.left-column .story {
flex: 2;
outline: 1px solid white;
/* margin:auto; */
}
.right-column {
flex: 12;
background-color: #f0f;
display: flex;
flex-direction: column;
}
.right-column-body {
flex: 10;
display: flex;
flex-direction: column;
}
.right-column-body .header {
flex: 1;
display: flex;
justify-content: center;
}
.thing {
width: 20%;
margin: 5px
}
.super-thing {
background-color: white;
margin: 1%;
box-shadow: 2px 1px 1px #000;
flex: 1;
}
.right-column-body .body {
background-color: #ccc;
flex: 5;
display: flex;
flex-direction: column;
justify-content: center;
}
.right-column-footer {
flex: 1;
background-color: white;
}
.footer {
flex: 1 0 30px;
}
<div class="container">
<div class="header">
<div class="header-left">Left</div>
<div class="header-right">
<div class="small-item">A</div>
<div class="small-item">B</div>
<div class="small-item">C</div>
<div class="small-item">D</div>
</div>
</div>
<div class="main">
<div class="left-column">
<span class="story">A</span>
<span class="story">A</span>
<span class="story">A</span>
<span class="story">A</span>
</div>
<div class="right-column">
<div class="right-column-body">
<div class="header">
<div class="thing">A</div>
<div class="thing">B</div>
<div class="thing">C</div>
</div>
<div class="body">
<div class="super-thing">Hey</div>
</div>
<div class="right-column-footer">Footer</div>
</div>
</div>
</div>
<div class="footer">Footer</div>
</div>

Resources