как сделать что бы белый блок отображался справа от основного .shortBlock { margin-top: 90px; display: flex; flex-direction: column; gap: 30px; width: 700px; .headerLogo { display: flex; align-items: center; gap: 25px; h5 { font-family: RoadRadio, sans-serif; font-size: 32px; font-weight: 600; } } .descriptionShort { color: #d1d1d1; display: flex; p { font-family: RoadRadio, sans-serif; font-size: 16px; } } .short { display: flex; gap: 15px; input { background-color: #fff; border: transparent; padding: 16px; border-radius: 15px; width: 100%; color: #000; font-weight: 400; font-size: 16px; padding-left: 20px; &::placeholder { opacity: 0.6; /* Set the opacity to 80% */ font-weight: 400; } transition: background-color 0.2s ease-in; /* Smooth transition for background color */ } button { font-family: RoadRadio; background-color: #fef7bc; border: transparent; padding: 16px 20px; font-size: 18px; font-weight: 600; border-radius: 15px; color: #f5d31e; cursor: pointer; transition: background-color 0.2s ease-in, color 0.2s ease-in; &:hover { background-color: #f5d31e; color: #fef7bc; } } } .contentShortBlock { background-color: #fff; border-radius: 15px; padding: 15px; display: flex; align-items: stretch; justify-content: space-between; opacity: 0; /* Initially set to 0 to hide */ flex-direction: row; height: auto; &.slide-in { opacity: 1; transform: translateY(0); height: auto; transition: opacity 0.3s ease, transform 0.5s ease; /* Add transition properties */ } transition: opacity 0.3s ease, transform 0.5s ease; .leftFlex { display: flex; flex-direction: column; justify-content: space-between; .link { display: flex; align-items: center; gap: 10px; color: #e74c3c; img { width: 30px; } a { font-weight: 600; text-decoration: none; color: #34aadc; font-family: RoadRadio; font-size: 18px; } } .copyShare { display: flex; align-items: center; gap: 15px; .copy { button { display: flex; border: none; background-color: #fef7bc; color: #f5d31e; align-items: center; padding: 10px 15px; border-radius: 10px; gap: 10px; font-weight: 600; font-family: RoadRadio; font-size: 16px; cursor: pointer; transition: background-color 0.2s ease-in, color 0.2s ease-in; /* Smooth transition for background and text color */ &:hover { background-color: #f5d31e; color: #fef7bc; /* SVG path color change */ + svg path { fill: black; } } } } .share { button { display: flex; border: none; background-color: #fef7bc; color: #f5d31e; align-items: center; padding: 10px 15px; border-radius: 10px; gap: 10px; font-weight: 600; font-family: RoadRadio; cursor: pointer; transition: background-color 0.2s ease-in, color 0.2s ease-in; /* Smooth transition for background and text color */ font-size: 16px; &:hover { background-color: #f5d31e; color: #fef7bc; } } } } } } } .ShareBlock { background-color: #fff; border-radius: 15px; width: 139px; /* Adjust the width as needed */ height: 162px; /* Adjust the height as needed */ } CSS .shortBlock { margin-top: 90px; display: flex; flex-direction: column; gap: 30px; width: 700px; .headerLogo { display: flex; align-items: center; gap: 25px; h5 { font-family: RoadRadio, sans-serif; font-size: 32px; font-weight: 600; } } .descriptionShort { color: #d1d1d1; display: flex; p { font-family: RoadRadio, sans-serif; font-size: 16px; } } .short { display: flex; gap: 15px; input { background-color: #fff; border: transparent; padding: 16px; border-radius: 15px; width: 100%; color: #000; font-weight: 400; font-size: 16px; padding-left: 20px; &::placeholder { opacity: 0.6; /* Set the opacity to 80% */ font-weight: 400; } transition: background-color 0.2s ease-in; /* Smooth transition for background color */ } button { font-family: RoadRadio; background-color: #fef7bc; border: transparent; padding: 16px 20px; font-size: 18px; font-weight: 600; border-radius: 15px; color: #f5d31e; cursor: pointer; transition: background-color 0.2s ease-in, color 0.2s ease-in; &:hover { background-color: #f5d31e; color: #fef7bc; } } } .contentShortBlock { background-color: #fff; border-radius: 15px; padding: 15px; display: flex; align-items: stretch; justify-content: space-between; opacity: 0; /* Initially set to 0 to hide */ flex-direction: row; height: auto; &.slide-in { opacity: 1; transform: translateY(0); height: auto; transition: opacity 0.3s ease, transform 0.5s ease; /* Add transition properties */ } transition: opacity 0.3s ease, transform 0.5s ease; .leftFlex { display: flex; flex-direction: column; justify-content: space-between; .link { display: flex; align-items: center; gap: 10px; color: #e74c3c; img { width: 30px; } a { font-weight: 600; text-decoration: none; color: #34aadc; font-family: RoadRadio; font-size: 18px; } } .copyShare { display: flex; align-items: center; gap: 15px; .copy { button { display: flex; border: none; background-color: #fef7bc; color: #f5d31e; align-items: center; padding: 10px 15px; border-radius: 10px; gap: 10px; font-weight: 600; font-family: RoadRadio; font-size: 16px; cursor: pointer; transition: background-color 0.2s ease-in, color 0.2s ease-in; /* Smooth transition for background and text color */ &:hover { background-color: #f5d31e; color: #fef7bc; /* SVG path color change */ + svg path { fill: black; } } } } .share { button { display: flex; border: none; background-color: #fef7bc; color: #f5d31e; align-items: center; padding: 10px 15px; border-radius: 10px; gap: 10px; font-weight: 600; font-family: RoadRadio; cursor: pointer; transition: background-color 0.2s ease-in, color 0.2s ease-in; /* Smooth transition for background and text color */ font-size: 16px; &:hover { background-color: #f5d31e; color: #fef7bc; } } } } } } } .ShareBlock { background-color: #fff; border-radius: 15px; width: 139px; /* Adjust the width as needed */ height: 162px; /* Adjust the height as needed */ }
Toil import React, { useEffect, useState, useRef } from "react"; import QRCodeStyling from "qr-code-styling"; import Link from "../../assets/images/link.png"; import Copy from "../../assets/svg/copy.svg"; import Logo from "../../assets/svg/darkLogo.svg"; import Share from "../../assets/svg/share.svg"; import Copied from "../../assets/svg/copied.svg"; import ShareBlock from "./shareBlock.jsx"; const LinkItem = ({ link }) => { const [copied, setCopied] = useState(false); const [isVisible, setIsVisible] = useState(false); const qrCodeRef = useRef(null); const qrCodeInstanceRef = useRef(null); useEffect(() => { if (!qrCodeInstanceRef.current) { const newQrCodeInstance = new QRCodeStyling({ width: 120, height: 120, data: link, image: Logo, dotsOptions: { color: "#fff", type: "extra-rounded" }, cornersSquareOptions: { type: 'extra-rounded' }, imageOptions: { crossOrigin: "anonymous", margin: 0 }, backgroundOptions: { color: '#343434', } }); qrCodeInstanceRef.current = newQrCodeInstance; newQrCodeInstance.append(qrCodeRef.current); setIsVisible(true); // Set the visibility after the QR code instance is created } else { qrCodeInstanceRef.current.update({ data: link }); setIsVisible(true); // Set the visibility after the QR code instance is updated } }, [link]); const handleCopyClick = () => { navigator.clipboard.writeText(link); setCopied(true); setTimeout(() => { setCopied(false); }, 2000); }; return ( <div> <div className={`contentShortBlock ${isVisible ? 'slide-in' : ''}`}> <div className="leftFlex"> <div className="link"> <img src={Link} alt="" /> <a href={link}>{link}</a> </div> <div className="copyShare"> <div className="copy"> <button onClick={handleCopyClick}> {copied ? 'Скопировано' : 'Копировать'} <img src={copied ? Copied : Copy} alt="" /> </button> </div> <div className="share"> <button> Поделиться <img src={Share} alt="" /> </button> </div> </div> </div> <div className="rightFlex"> <div className="qrCode" ref={qrCodeRef}></div> </div> </div> <ShareBlock link={link} /> </div> ); }; export default LinkItem; JS import React, { useEffect, useState, useRef } from "react"; import QRCodeStyling from "qr-code-styling"; import Link from "../../assets/images/link.png"; import Copy from "../../assets/svg/copy.svg"; import Logo from "../../assets/svg/darkLogo.svg"; import Share from "../../assets/svg/share.svg"; import Copied from "../../assets/svg/copied.svg"; import ShareBlock from "./shareBlock.jsx"; const LinkItem = ({ link }) => { const [copied, setCopied] = useState(false); const [isVisible, setIsVisible] = useState(false); const qrCodeRef = useRef(null); const qrCodeInstanceRef = useRef(null); useEffect(() => { if (!qrCodeInstanceRef.current) { const newQrCodeInstance = new QRCodeStyling({ width: 120, height: 120, data: link, image: Logo, dotsOptions: { color: "#fff", type: "extra-rounded" }, cornersSquareOptions: { type: 'extra-rounded' }, imageOptions: { crossOrigin: "anonymous", margin: 0 }, backgroundOptions: { color: '#343434', } }); qrCodeInstanceRef.current = newQrCodeInstance; newQrCodeInstance.append(qrCodeRef.current); setIsVisible(true); // Set the visibility after the QR code instance is created } else { qrCodeInstanceRef.current.update({ data: link }); setIsVisible(true); // Set the visibility after the QR code instance is updated } }, [link]); const handleCopyClick = () => { navigator.clipboard.writeText(link); setCopied(true); setTimeout(() => { setCopied(false); }, 2000); }; return ( <div> <div className={`contentShortBlock ${isVisible ? 'slide-in' : ''}`}> <div className="leftFlex"> <div className="link"> <img src={Link} alt="" /> <a href={link}>{link}</a> </div> <div className="copyShare"> <div className="copy"> <button onClick={handleCopyClick}> {copied ? 'Скопировано' : 'Копировать'} <img src={copied ? Copied : Copy} alt="" /> </button> </div> <div className="share"> <button> Поделиться <img src={Share} alt="" /> </button> </div> </div> </div> <div className="rightFlex"> <div className="qrCode" ref={qrCodeRef}></div> </div> </div> <ShareBlock link={link} /> </div> ); }; export default LinkItem; import React, {useEffect, useRef, useState} from "react"; import './styles/short.scss'; const ShareBlock = ({ link }) => { return ( <div> <div className="ShareBlock" /> </div> ); }; export default ShareBlock; JS import React, {useEffect, useRef, useState} from "react"; import './styles/short.scss'; const ShareBlock = ({ link }) => { return ( <div> <div className="ShareBlock" /> </div> ); }; export default ShareBlock;
Полковник, а, бля, я чет не правильно изначально понял. Я думал ты так и хотел сделать. Если ты имел ввиду чтобы белый был справа от элемента с ссылками и qr, то пропиши display: flex; для этого элемента
Toil, гуд только как теперь сделать что бы основной блок вместо того что бы становится меньше просто отодвигался влево
Полковник, так точно не скажу, но можешь попытаться с width поиграться в .contentShortBlock, чтобы оно не становилось меньше
Полковник, чтобы сделать белый блок отображался справа от основного, можно использовать свойство `float` в CSS. В данном случае, нужно добавить следующий код: .shortBlock { float: right; } CSS .shortBlock { float: right; } Таким образом, блок с классом `.shortBlock` будет выравниваться справа от основного контента. Поместите этот код внутри селектора `.shortBlock` в вашем CSS: .shortBlock { margin-top: 90px; display: flex; flex-direction: column; gap: 30px; width: 700px; float: right; /* остальные стили */ } CSS .shortBlock { margin-top: 90px; display: flex; flex-direction: column; gap: 30px; width: 700px; float: right; /* остальные стили */ } После этого белый блок будет отображаться справа от основного контента.
мне впадлу разгадывать твой код. <div class="container"> <div class="wide-block"> </div> <div class="small-square"></div> </div> .container { display:flex; flex-direction: column; align-items: end; width: 100%; } .wide-block { стили... } small-square { стили... }
Полковник, бро ну ты ж както написал то что у тя щас есть. тебе надо что бы был общий родитель , и через него задать. или прям ща попробуй для твоего квадратика белого margin-left: auto;