how to make fixed header for mobile phone
- User
how to make fixed header for mobile phone
- Assistant
Creating a fixed header for a mobile website involves using HTML and CSS. The goal is to make sure the header stays at the top of the viewport regardless of scrolling. Here's a basic example to help you get started:
HTML
Create the basic structure for your webpage with a header:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Fixed Header Example</title> <link rel="stylesheet" href="styles.css"> </head> <body> <header class="fixed-header"> <h1>My Fixed Header</h1> </header> <main> <div class="content"> <!-- Your content here --> <p>Lorem ipsum dolor sit amet...</p> <!-- Repeat or add more content to test scrolling --> </div> </main> </body> </html> - User
tailwind
- Assistant
- User
react
- Assistant
- User
- Assistant
- User
- Assistant
- User
import PopUpItem from "./PopUpItem/PopUpItem";
interface Scrolled { isScrolled: boolean; clickAnime: string; } export default function PopUp({ isScrolled, clickAnime }: Scrolled) { return ( <div className={
flex fixed w-96 h-4/5 bg-white right-0 z-50 flex-col border-l-4 border-[#0e7fdf] border-b-4 shadow-2xl${ isScrolled ?top-10 duration-500 ease-out:inset-y-24 duration-500 ease-out} ${ clickAnime === "left" ?animate-slideOutLeft:animate-slideInRight}} ><div className="flex mt-auto w-full h-16 justify-center items-center"> <div className="flex bg-[#0e7fdf] w-3/4 h-14 justify-center items-center"> <a href="#" className="text-2xl"> Оплатить </a> </div> </div> </div>); } Адаптируй с помощью tailwind
- Assistant