Next.js: 3 card flips but only 1 malfunctions - css

just want to quickly thank the community at large for having helped me out many times already. You're all generous and helpful beyond measure. This is also my first post so I apologize if I forget to include anything.
I am currently a self-taught amateur web-developer attempting my first real project. I am using Next.js and am favoring server side rendering. So far everything has gone well, but while testing responsiveness I noticed that 1 of the 3 flip cards I'm using is displaying its back-face slightly too early. Also, this early back-face display only occurs when the window is over 1600px wide and is most easy to replicate on Chrome browsers.
The most confusing part of this is that from what I can tell, all 3 of my flip cards should be exactly the same, yet only one is having issues. Just to clarify, I've placed a flip card component inside of a slider component, hence the two code blocks
incoming code-wall:
Outer "slider" component
import React from 'react';
import SoloContent1 from './SoloContent1';
import SoloContent2 from './SoloContent2';
import SoloContent3 from './SoloContent3';
import CloseButton from './CloseButton';
export default class SliderSolo extends React.Component {
constructor(props) {
super(props);
this.state={
slide1: "slide1",
slide2: "slide2",
slide3: "slide3",
slideClass: "slide3",
}
this.slideLeft = this.slideLeft.bind(this);
this.slideRight = this.slideRight.bind(this);
};
slideRight() {
if (this.state.slideClass === this.state.slide1)
{
this.setState({ slideClass : this.state.slide2 })
}
else if (this.state.slideClass === this.state.slide2)
{
this.setState({ slideClass : this.state.slide3 })
}
else if (this.state.slideClass === this.state.slide3)
{
this.setState({ slideClass : this.state.slide1 })
}
}
slideLeft() {
if (this.state.slideClass === this.state.slide1)
{
this.setState({ slideClass : this.state.slide3 })
}
else if (this.state.slideClass === this.state.slide3)
{
this.setState({ slideClass : this.state.slide2 })
}
else if (this.state.slideClass === this.state.slide2)
{
this.setState({ slideClass : this.state.slide1 })
}
}
render() {
if (this.props.show === true) {
return (
<div className="slider">
<div className={this.state.slideClass} >
<SoloContent1 />
<SoloContent2 />
<SoloContent3 />
</div>
<button id="goLeft" onClick={this.slideRight}><i className="ChevronLeft" id="left"></i></button>
<button id="goRight" onClick={this.slideLeft}><i className="ChevronRight" id="right"></i></button>
<a onClick={this.props.onClose} id="closeLink"><CloseButton id="close" /></a>
<style jsx>
{`
.ChevronLeft {
position: absolute;
height: 75px;
width: 75px;
z-index: 10;
transform: rotate(90deg)
}
.ChevronRight {
position: absolute;
height: 75px;
width: 75px;
z-index: 10;
transform: rotate(-90deg)
}
#left {
right: 40px;
top: 0px;
}
#right {
right: -40px;
top: -5px;
}
.ChevronLeft::before,
.ChevronLeft::after {
position:absolute;
display:block;
content:"";
border:35px solid transparent;
}
.ChevronLeft::before {
border-top-color:#b00;
}
.ChevronLeft::after {
top:-10px;
border-top-color:#fff;
}
.ChevronRight::before,
.ChevronRight::after {
position:absolute;
display:block;
content:"";
border:35px solid transparent;
}
.ChevronRight::before {
border-top-color:#b00;
}
.ChevronRight::after {
top:-10px;
border-top-color:#fff;
}
#closeLink {
position: absolute;
width: 25px;
height: 25px;
cursor: pointer;
right: 6%;
top: 2%;
}
#media (max-width: 720px) {
#closeLink {
top: 45px;
right: 40px;
}
}
button {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 75px;
height: 75px;
background: none;
border: none;
cursor: pointer;
}
button:focus {
outline: none;
box-shadow: none;
}
#goLeft {
left: 5.5%;
}
#goRight {
right: 5.5%;
}
.slider {
position: relative;
width: 100%;
height: 100%;
box-sizing: border-box;
margin: 0;
padding: 0;
display: flex;
align-items: center;
overflow: hidden;
margin-top: 130px;
min-width: 450px;
}
i {
font-size: 2vw;
}
.slide1 {
position: relative;
width: 100%;
height: 60vh;
transition: 0.5s;
margin: auto;
}
#media (max-width: 720px) {
.slide1 {
height: 75vh;
margin-top: 6%
}
}
.slide2 {
position: relative;
width: 100%;
height: 60vh;
transition: 0.5s;
margin: auto;
transform: translateX(100%)
}
#media (max-width: 720px) {
.slide2 {
height: 75vh;
margin-top: 6%
}
}
.slide3 {
position: relative;
width: 100%;
height: 60vh;
transition: 0.5s;
margin: auto;
transform: translateX(200%)
}
#media (max-width: 720px) {
.slide3 {
height: 75vh;
margin-top: 6%
}
}
`}
</style>
</div>
);} else {
return null;
}
}
}
Inner "flip card" component
import React from 'react';
class SoloContent1 extends React.Component {
constructor(props) {
super(props);
this.state={
className1: "flipCard",
className2: "flipCard",
className3: "flipCard",
}
this.flip1 = this.flip1.bind(this);
this.unflip1 = this.unflip1.bind(this);
this.flip2 = this.flip2.bind(this);
this.unflip2 = this.unflip2.bind(this);
this.flip3 = this.flip3.bind(this);
this.unflip3 = this.unflip3.bind(this);
}
flip1() {
this.setState({ className1 : "flipCard is-flipped" })
}
unflip1() {
this.setState({ className1 : "flipCard" })
}
flip2() {
this.setState({ className2 : "flipCard is-flipped" })
}
unflip2() {
this.setState({ className2 : "flipCard" })
}
flip3() {
this.setState({ className3 : "flipCard is-flipped" })
}
unflip3() {
this.setState({ className3 : "flipCard" })
}
render() {
return (
<div id="contentContainer">
<div className="contentCanvas contentCanvas--card">
<div className="flipCardContainer" id="flipContainer1" onMouseEnter={this.flip1} onMouseLeave={this.unflip1}>
<div className={this.state.className1} id="card1">
<div className="card__face card__face--front" id="soloPro1"
style={{
backgroundImage: "url(" + `${require("../public/assets/img1.jpg")}` + ")",
width: "100%",
height:"100%",
backgroundRepeat: "no-repeat",
backgroundSize: "cover",
backgroundPosition: "center",
}}
>
</div>
<div className="card__face card__face--back" id="soloPro2">
<div style={{
backgroundImage: "url(" + `${require("../public/assets/img1.jpg")}` + ")",
width: "100%",
height:"100%",
backgroundRepeat: "no-repeat",
backgroundPosition: "center",
backgroundSize: "cover",
filter: "blur(8px)",
}}>
</div>
<p className="cardText">Card 1 Back</p>
</div>
</div>
</div>
<div className="flipCardContainer" id="flipContainer2" onMouseEnter={this.flip2} onMouseLeave={this.unflip2}>
<div className={this.state.className2} id="card2">
<div className="card__face card__face--front" id="soloPro1"
style={{
backgroundImage: "url(" + `${require("../public/assets/img2.jpg")}` + ")",
width: "100%",
height:"100%",
backgroundRepeat: "no-repeat",
backgroundSize: "cover",
backgroundPosition: "center",
}}
>
</div>
<div className="card__face card__face--back" id="soloPro2">
<div style={{
backgroundImage: "url(" + `${require("../public/assets/img2.jpg")}` + ")",
width: "100%",
height:"100%",
backgroundRepeat: "no-repeat",
backgroundPosition: "center",
backgroundSize: "cover",
filter: "blur(8px)",
}}>
</div>
<p className="cardText">Card 2 Back</p>
</div>
</div>
</div>
<div className="flipCardContainer" id="flipContainer3" onMouseEnter={this.flip3} onMouseLeave={this.unflip3}>
<div className={this.state.className3} id="card3">
<div className="card__face card__face--front" id="soloPro1"
style={{
backgroundImage: "url(" + `${require("../public/assets/img3.jpg")}` + ")",
width: "100%",
height:"100%",
backgroundRepeat: "no-repeat",
backgroundSize: "cover",
backgroundPosition: "center",
}}
>
</div>
<div className="card__face card__face--back" id="soloPro2">
<div style={{
backgroundImage: "url(" + `${require("../public/assets/img3.jpg")}` + ")",
width: "100%",
height:"100%",
backgroundRepeat: "no-repeat",
backgroundPosition: "center",
backgroundSize: "cover",
filter: "blur(8px)",
}}>
</div>
<p className="cardText">Card 3 Back</p>
</div>
</div>
</div>
</div>
<style jsx>
{`
.cardText {
position: absolute;
height: 100%;
width: 100%;
transform: translateY(-65%)
}
#contentContainer {
position: absolute;
height: 100%;
width: 90%;
background-image: url('image');
background-color: rgb(192,192,192);
border-radius: 8px;
transform: translateX(0%);
right: 5%;
overflow: hidden;
border: 5px solid silver;
box-sizing: border-box;
}
#media (max-width: 720px) {
#contentContainer {
height: 100%;
min-height: 575px;
overflow: hidden;
}
}
.contentCanvas {
z-index: 1;
height: 100%;
width: 100%;
margin: auto;
margin-top: 0%;
}
#media (max-width: 720px) {
.contentCanvas {
transform: translate(0, 0%);
min-height: 525px;
height: 102%;
width: 100%;
margin-top: 0%;
}
}
.flipCard {
margin: auto;
list-style: none;
font-size: 1.6em;
width: 100%;
height: 100%;
padding: 0;
display: inline-block;
transition: transform 1s;
transform-style: preserve-3d;
position: relative;
cursor: pointer;
}
#media (max-width: 720px) {
.flipCard {
width: 100%;
height: 100%;
}
}
.card__face {
position: absolute;
height: 100%;
width: 100%;
text-align: center;
}
.card__face--front {
background: white;
}
.card__face--back {
background: black;
transform: rotateY( 180deg );
}
.flipCard.is-flipped {
transform: rotateY( 180deg );
}
#media (max-width: 720px) {
.card__face--back {
background: black;
transform: rotateX( 180deg );
}
.flipCard.is-flipped {
transform: rotateX( 180deg );
}
}
#card1 {
}
#media (max-width: 720px) {
#card2 {
margin-top: -1%
}
}
#media (max-width: 720px) {
#card3 {
margin-top: -1%
}
}
.flipCardContainer {
perspective: 40rem;
z-index: 1;
height: 100%;
width: 33.333333333333333333333333%;
margin: auto;
display: inline-block;
}
#media (max-width: 720px) {
.flipCardContainer {
width: 100%;
height: 33%;
margin-top: 0%;
}
}
`}
</style>
</div>
);
}
}
export default SoloContent1;
Any and all help is appreciated. Also please don't be afraid to criticize my work. This is my first project after all and the last thing I want is to continue developing bad habits. Thank you all in advance.

In the end I was never able to figure out what was causing the issue. Though I discovered it was directly linked to the pixel width of the viewable window, regardless of which container the element was nested in. Also, beyond a certain width the issue began to pop up in the other flip cards.
Sorry I can't offer a real solution, though I did manage to get around it by causing the backface of each flip card to fade in as it flips.

Related

When click on sidebar menu in right side routes page display

I have sideNavbar and when click on side bar menu return menu componetns on the right side.
Below i have mention the image just look same output want.
Sandboxlink:https://m7tqt3.csb.app/
SideNavbar.js
---
import "./SideNavBar.css";
const SideNavBar = () => {
const menuItems = [
{
text: "Dashboard",
icon: "icons/grid.svg",
},
{
text: "Admin Profile",
icon: "icons/user.svg",
},
{
text: "Messages",
icon: "icons/message.svg",
},
{
text: "Analytics",
icon: "icons/pie-chart.svg",
},
{
text: "File Manager",
icon: "icons/folder.svg",
},
{
text: "Orders",
icon: "icons/shopping-cart.svg",
},
{
text: "Saved Items",
icon: "icons/heart.svg",
},
{
text: "Settings",
icon: "icons/settings.svg",
},
];
return (
<div
className={
"side-nav-container"
}
>
<div className="nav-upper">
<div className="nav-heading">
(
<div className="nav-brand">
<img src="icons/Logo.svg" alt="" srcset="" />
<h2>Showkart</h2>
</div>
)
</div>
<div className="nav-menu">
{menuItems.map(({ text, icon }) => (
<a
className={ "menu-item"}
href="#"
>
<img className="menu-item-icon" src={icon} alt="" srcset="" />
{ <p>{text}</p>}
</a>
))}
</div>
</div>
</div>
);
};
export default SideNavBar;
SideNavbar.css
/* NX = not expanded */
.side-nav-container {
background-color: var(--dark);
width: 300px;
height: 100vh;
position: relative;
color: var(--light);
transition: 0.4s;
}
.side-nav-container-NX {
width: 85px;
}
.nav-upper,
.nav-heading,
.nav-menu,
.menu-item,
.nav-footer {
/* border: 2px solid white; */
display: grid;
}
.nav-heading {
grid-template-columns: 2fr 1fr;
grid-template-rows: 1fr;
height: 75px;
}
.nav-brand {
display: flex;
color: var(--light);
}
.nav-brand img {
width: 40px;
padding: 0 10px;
}
.hamburger {
background: none;
border: none;
cursor: pointer;
margin: auto;
}
.hamburger span {
display: block;
margin-top: 5px;
background-color: var(--light);
border-radius: 15px;
height: 5px;
width: 35px;
transition: 0.4s;
}
.hamburger:hover span {
background-color: var(--primary);
}
.hamburger-in:hover span:nth-child(1) {
width: 25px;
transform: translateY(4px) rotate(-25deg);
}
.hamburger-in:hover span:nth-child(2) {
width: 40px;
}
.hamburger-in:hover span:nth-child(3) {
width: 25px;
transform: translateY(-4px) rotate(25deg);
}
/* ///////////////////// */
/* ///////////////////// */
/* ///////////////////// */
/* ///////////////////// */
.hamburger-out {
margin-left: 24px;
}
.hamburger-out:hover span:nth-child(1) {
width: 25px;
transform: translate(14px, 4px) rotate(-155deg);
}
.hamburger-out:hover span:nth-child(2) {
width: 40px;
}
.hamburger-out:hover span:nth-child(3) {
width: 25px;
transform: translate(14px, -4px) rotate(155deg);
}
.nav-menu {
grid-template-rows: repeat(7, 1fr);
margin-top: 50px;
}
.menu-item {
height: 57px;
display: flex;
color: var(--light);
text-decoration: none;
text-transform: uppercase;
margin: auto 20px;
border-radius: 10px;
}
.menu-item-NX {
margin: auto;
}
.menu-item:hover {
background-color: var(--primary);
}
.menu-item img {
width: 30px;
padding: 0 20px;
}
.nav-footer {
width: 100%;
height: 87px;
position: absolute;
bottom: 0;
grid-template-rows: 1fr;
grid-template-columns: 2fr 1fr;
}
.nav-details {
display: flex;
}
.nav-details img {
width: 50px;
padding: 0 20px;
}
.nav-footer-user-name {
font-size: 18px;
font-weight: 900;
}
.nav-footer-user-position {
margin-top: -15px;
color: var(--gray);
}
.logout-icon {
width: 30px;
margin: auto;
border-radius: 90px;
padding: 20px;
margin-left: 5px;
}
.logout-icon:hover {
background-color: var(--primary);
}
Notes: React router dom version: 5.3.1.
Output look like:
enter image description here
Routes to another components on right side
Firstly, if I undestand your question, you want a side navbar which allows you to navigate to different pages with your react app. If so:
<div className="nav-menu">
{menuItems.map(({ text, icon }) => (
<a <--- The problem is here
className={ "menu-item"}
href="#"
>
<img className="menu-item-icon" src={icon} alt="" srcset="" />
{ <p>{text}</p>}
</a>
))}
</div>
You are using anchor tag which will redirect you out of react router. You should use Link tag which allows to redirect to different pages within your react app.
const menuItems = [
{
text: "Dashboard",
icon: "icons/grid.svg",
navLink:'/dashboard'
},
{
text: "Admin Profile",
icon: "icons/user.svg",
navLink:'/admin'
},...]
<div className="nav-menu">
{menuItems.map(({ text, icon, navlink }) => (
<Link
className={ "menu-item"}
to={navlink}
>
<img className="menu-item-icon" src={icon} alt=""
srcset=""
/>
{ <p>{text}</p>}
</Link>
))}
</div>
Likewise you need to step up your App.js with BrowserRouter, Routes and Route to move between pages.

React: content not fulfilling 100vh between aspect ratio

I need this to fill the screen with no scroll bar
#media (min-aspect-ratio: 2/3) and (max-aspect-ratio: 3/2) {
.containerMedia {
columns: 3 auto;
}
.individualBoxMedia{
height: calc(100vh/3);
}
but its like this
but this is working
#media (max-aspect-ratio: 2/3) {
.containerMedia {
columns: 2 auto;
}
.individualBoxMedia{
height: 25vh;
}
}
full code
App.js
//import logo from './images/logo512.png';
import './App.css';
import cardData from './data/cardData';
function App() {
return (
<div className="App">
<div className='container containerMedia'>
{cardData.map(card => {
return (
<div className='individualBox individualBoxMedia'>
<div className='card'>
<div className='cardImageBox'>
<img src={card.location}/>
</div>
<div className='cardTextBox'>
<p>{card.text}</p>
</div>
</div>
</div>
)
})}
</div>
</div>
);
}
export default App;
/*
https://codesandbox.io/s/repeat-element-dpocp?file=/src/App.tsx
*/
app.css
.App {
text-align: center;
}
#media (max-aspect-ratio: 2/3) {
.containerMedia {
columns: 2 auto;
}
.individualBoxMedia{
height: 25vh;
}
}
#media (min-aspect-ratio: 2/3) and (max-aspect-ratio: 3/2) {
.containerMedia {
columns: 3 auto;
}
.individualBoxMedia{
height: calc(100vh/3);
}
}
#media (min-aspect-ratio: 3/2) {
.containerMedia {
columns: 4 auto;
}
.individualBoxMedia{
height: 50vh;
}
}
.individualBox {
border-style: solid;
border-width: 0em;
box-sizing: border-box;
padding: 1vw;
background-color: lightgray;
}
.card{
box-sizing: border-box;
height: 100%;
width: 100%;
padding: 0.5vw;
background-color: white;
border-radius: 0.5em;
}
.cardImageBox{
box-sizing: border-box;
height: 60%;
width: 100%;
}
.cardTextBox {
box-sizing: border-box;
min-height: 0;
min-height: 40%;
max-height: 40%;
width: 100%;
overflow: hidden;
}
.container {
column-gap: 0rem;
max-height: 100vh;
max-width: 100vw;
}
.individualBox img {
width: 100%;
height: 100%;
object-fit: cover;
object-position:top;
border-radius: 0.5em 0.5em 0px 0px;
}
.individualBox p {
padding: 0;
margin: 0;
overflow: hidden;
}
data
//Card Data
export default [
{
text: 'The final Computer Space design uses no microprocessor; the entire computer system is a state machine made of 7400-series integrated circuits, with monochrome graphic elements held in diode arrays.',
location: './images/object1.jpg',
},
{
text: 'object2 rtxyculvy fvgbhjn fcvgbhjn vybhnj ytbjhk xdcfvgbjh ctryvb crtfyvgbh',
location: './images/object2.jpg',
},
{
text: 'object3 cytvub tcvb tcfvyg trcvyb trcyvub yvtub yvtuby vytub vtuyb vtgubh vuybi',
location: './images/object3.jpg',
},
{
text: 'object4 tdrfygu ctryvbuu rtcyvbuni rtyvbu ed5rftyguhijo rextcvyb rtcyguhi rftyguhi',
location: './images/object4.jpg',
},
{
text: 'object5 cvgb ytvubiu rytui rytguhi rtfyguhijo rtfyguhijo zwxretcfyvguhio drftyg',
location: './images/object5.jpg',
},
{
text: 'object6 yvubyhinj ctryvuy rctyvub yrctvubiu rctyfugi f7tygiu rctvyubiu rftyguih',
location: './images/object6.jpg',
},
{
text: 'object7 cfvgbjhkn cfvygtbyhn rxectfvygbuni rtcvybun rctyvbuin rtyvub etcrvytgbu',
location: './images/object7.jpg',
},
{
text: 'object8 cvbyn rcytvubu trcyvubu rfytgui ytugi yrtvubi ytvubi yrctui ytui rfytugih',
location: './images/object8.jpg',
}
];
I would suggest using something like this
.parent {
display: grid;
grid-template-columns: (auto, minmax(250px, 300px))
}

How make a verticale smooth transition in CSS with react component?

I try to make a smooth transition for my hamburger menu, but I don't find solution to do it... I'm not really fluid with the CSS and it's very difficult to find a good example on the web or a good tutorial to explain the process.
below my code, I hope it's enough simple to understand my problem.
a link to the project https://github.com/StanLepunK/cafe366/blob/stan/src/components/menu/menu_small.js
export const MenuSmallImpl = () => {
let res = Get_window();
const [width, set_width] = useState(res[0]/2);
const [open, set_open] = useState(false);
const toggleMenu = () => {
set_open(!open);
}
return (
<Fragment>
<div className={nav_bar}>
<button
onClick={() => toggleMenu()}
className={toggle_menu}
>
<div className={hamburger_container}>
<div className={hamburger}>
<div className={[burger, "burger1"].join(" ")} />
<div className={[burger, "burger2"].join(" ")} />
<div className={[burger, "burger3"].join(" ")} />
</div>
<style>{`
.burger1 {
transform: ${ open ? 'rotate(45deg)' : 'rotate(0)'};
}
.burger2 {
opacity: ${ open ? 0 : 1};
}
.burger3 {
transform: ${ open ? 'rotate(-45deg)' : 'rotate(0)'};
}
`}</style>
</div>
</button>
<div>{open ? <div className={show}><MenuContent /></div> : <div className={hidden}><MenuContent /></div> }</div>
</div>
</Fragment>
)
}
.nav_bar {
text-align: center;
border-radius: 0;
background-color: rgb(var(--orange_366_rgb));
transition: height 3s ease;
}
.nav_bar .show {
height: 100%;
overflow: visible;
}
.nav_bar .hidden {
height: 0;
overflow: hidden;
}
.nav_bar:active {
height: 100%;
overflow: visible;
}
.toggle_menu {
height: 50px;
width: 50px;
z-index: 1;
}
.hamburger_container {
display: flex;
justify-content: center;
align-items: center;
}
.hamburger{
width: 2rem;
height: 2rem;
display: flex;
justify-content: space-around;
flex-flow: column nowrap;
}
.burger{
width: 2rem;
height: 2px;
border-radius: 2px;
background-color: rgb(var(--lin_rgb));
transform-origin: 1px;
transition: all 0.3s linear;
}
CODE IMPROVED on the advice John Ruddell, but it's not enough, that's work but not totally only for the text not for the frame. See here use a small window to see the hamburger menu https://cafe366stan.gatsbyjs.io/
I don't understand why the text move and not the frame...
my new code
JS
import React, { useState, Fragment } from "react"
// CAFÉ 366
import MenuContent from "./menu_content"
import { nav_bar, toggle_menu, content_menu_small,
hamburger, burger, hamburger_container,
show, hidden } from "./menu_small.module.css";
// UTILS
import { Get_window } from "../../utils/canvas"
export const MenuSmallImpl = () => {
const [open, set_open] = useState(false);
const toggleMenu = () => {
set_open(!open);
}
return (
<Fragment>
<div style={{textAlign:`center`}}>
<button
onClick={() => toggleMenu()}
className={toggle_menu}
>
<div className={hamburger_container}>
<div className={hamburger}>
<div className={[burger, "burger1"].join(" ")} />
<div className={[burger, "burger2"].join(" ")} />
<div className={[burger, "burger3"].join(" ")} />
</div>
<style>{`
.burger1 {
transform: ${ open ? 'rotate(45deg)' : 'rotate(0)'};
}
.burger2 {
opacity: ${ open ? 0 : 1};
}
.burger3 {
transform: ${ open ? 'rotate(-45deg)' : 'rotate(0)'};
}
`}</style>
</div>
</button>
</div>
<div className={[nav_bar, "move"].join(" ")}>
{/* <div>{open ? <div className={show}><MenuContent /></div> : <div className={hidden}><MenuContent /></div> }</div> */}
<MenuContent />
</div>
<style>{`
.move {
transform: ${open ? 'translatey(0)' : 'translatey(-400px)'};
}
`}</style>
</Fragment>
)
}
export default function MenuSmall() {
return (
<MenuSmallImpl/>
)
}
CSS
.nav_bar {
height: 0%;
text-align: center;
border-radius: 0;
background-color: rgb(var(--orange_366_rgb));
transition: 1s ease;
/* border-right: 1px solid; */
}
.nav_bar .show {
height: 100%;
overflow: visible;
}
.nav_bar .hidden {
height: 0;
overflow: hidden;
}
.nav_bar:active {
height: 100%;
overflow: visible;
}
.toggle_menu {
height: 50px;
width: 50px;
z-index: 1;
/* border: solid 1px white; */
}
.hamburger_container {
display: flex;
justify-content: center;
align-items: center;
}
.hamburger{
width: 2rem;
height: 2rem;
display: flex;
justify-content: space-around;
flex-flow: column nowrap;
/* border: solid 1px white; */
}
.burger{
width: 2rem;
height: 2px;
border-radius: 2px;
background-color: rgb(var(--lin_rgb));
transform-origin: 1px;
transition: all 0.3s linear;
}
and two screenshots to understand my goal
now when it's deploy

How i can referecne nested classes inside my scss

I have the following .scss file:=
.singleNews {
text-decoration: none;
font-family: $font-family;
font-size: $font-size;
font-weight: $regular-font-weight;
&__image {
padding: 5em;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
&.featured {
height: 75%;
}
}
}
so how i can define the featured? i tried the following but all failed:-
import styles from './SingleNews.module.scss';
//code goes here...
<div className={styles.singleNews__image__featured} style={{ backgroundImage: `url(${post.image})` }}/>
<div className={styles.singleNews__image featured} style={{ backgroundImage: `url(${post.image})` }}/>
<div className={styles.singleNews__image.featured} style={{ backgroundImage: `url(${post.image})` }}/>
&.featured selects the the parent selector with the class featured, which means that the div need have the classes singleNews__image and featured
.singleNews__image.featured {
background-color: blue;
width: 100px;
height: 100px;
}
/* Same selector with Sass */
/*
.singleNews {
&__image {
&.featured {
background-color: blue;
width: 100px;
height: 100px;
}
}
}
*/
<div class="singleNews__image featured">
</div>

"justify-content: space-between" doesn't work?

"justify-content: space-between;" doesn't work
#app {
width: 300px;
height: 40.8px;
border: 1px solid #409EFF;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
.el-form {
.el-form-item {
/deep/ .el-form-item__content {
display: flex;
justify-content: space-between;
.el-input {
width: 165px;
}
.el-button {
width: 115px;
}
}
}
}
}
<div id="app">
<el-form>
<el-form-item>
<el-input placeholder="请输入验证码"></el-input>
<el-button type="primary">获取验证码</el-button>
</el-form-item>
</el-form>
</div>
I have provided complete code at JSFiddle.
As shown in the iframe,the el-input isn't flush with the main-start edge, and the el-button isn't flush with the main-end edge.
Why doesn't "space-between" work?it works just like "space-around".
The problem is related to the styling you got from element-ui. this selector should be overridden:
.el-form-item__content::after, .el-form-item__content::before {
display: table;
content: "";
}
To remove this add:
.el-form-item__content {
&:before, &:after {
content: none !important;
}
}

Resources