Create beautifull web page with react
- User
Create beautifull web page with react
- Assistant
Okay, here's a beautiful web page built with React, using functional components, styled-components for styling, and a bit of modern React best practices. This example includes a hero section, a features section, and a footer.
1. Project Setup (Create React App)
If you don't have a React project set up, create one using Create React App:
npx create-react-app my-beautiful-page cd my-beautiful-page npm install styled-components2.
src/App.jsimport React from 'react'; import styled from 'styled-components'; import heroImage from './assets/hero.jpg'; // Replace with your image const AppContainer = styled.div` font-family: 'Montserrat', sans-serif; background-color: #f8f8ff; color: #22223b; min-height: 100vh; `; const Header = styled.header` background-color: #6c63ff; color: #fff; padding: 2rem 0; text-align: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); `; const HeaderTitle = styled.h1` font-size: 2.5rem; margin-bottom: 0.5rem; letter-spacing: 2px; `; const HeaderSubtitle = styled.p` font-size: 1.2rem; opacity: 0.9; `; const Container = styled.div` max-width: 900px; margin: 2rem auto; background-color: #fff; border-radius: 18px; box-shadow: 0 4px 24px rgba(108, 99, 255, 0.08); padding: 2.5rem 2rem; `; const HeroSection = styled.section` display: flex; flex-direction: column; align-items: center; gap: 2rem; text-align: center; `; const HeroImage = styled.img` width: 220px; border-radius: 16px; box-shadow: 0 2px 16px rgba(255, 101, 132, 0.08); `; const HeroTitle = styled.h2` font-size: 2rem; color: #6c63ff; margin-bottom: 0.5rem; `; const HeroParagraph = styled.p` font-size: 1.1rem; color: #444; margin-bottom: 1.5rem; `; const HeroButton = styled.a` display: inline-block; background-color: #ff6584; color: #fff; padding: 0.8rem 2rem; border-radius: 30px; text-decoration: none; font-weight: bold; letter-spacing: 1px; transition: background-color 0.2s; &:hover { background-color: #ff3366; } `; const FeaturesSection = styled.section` display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; margin-top: 3rem; `; const FeatureCard = styled.div` background-color: #f0f0f5; padding: 1.5rem; border-radius: 12px; text-align: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03); `; const FeatureTitle = styled.h3` font-size: 1.5rem; color: #6c63ff; margin-bottom: 0.5rem; `; const FeatureParagraph = styled.p` font-size: 1rem; color: #444; `; const Footer = styled.footer` text-align: center; padding: 1.5rem 0; color: #aaa; font-size: 1rem; margin-top: 2rem; `; function App() { return ( <AppContainer> <Header> <HeaderTitle>Welcome to Your Beautiful Web Page</HeaderTitle> <HeaderSubtitle>Modern, clean, and responsive design for your next project.</HeaderSubtitle> </Header> <Container> <HeroSection> <HeroImage src={heroImage} alt="Beautiful Nature" /> <HeroTitle>Stunning Simplicity</HeroTitle> <HeroParagraph> This page is crafted with love and modern web standards. Easily customize it for your portfolio, landing page, or personal site. </HeroParagraph> <HeroButton href="#">Get Started</HeroButton> </HeroSection> <FeaturesSection> <FeatureCard> <FeatureTitle>Responsive Design</FeatureTitle> <FeatureParagraph>Looks great on all devices, from desktops to mobile phones.</FeatureParagraph> </FeatureCard> <FeatureCard> <FeatureTitle>Clean Code</FeatureTitle> <FeatureParagraph>Well-structured and easy to maintain code for long-term projects.</FeatureParagraph> </FeatureCard> <FeatureCard> <FeatureTitle>Customizable</FeatureTitle> <FeatureParagraph>Easily adapt the design and content to match your brand.</FeatureParagraph> </FeatureCard> </FeaturesSection> </Container> <Footer>© 2025 Beautiful Web Page. Crafted with ❤️ by React.</Footer> </AppContainer> ); } export default App;3.
src/assets/hero.jpgPlace an image named
hero.jpgin thesrc/assetsfolder. You can use any image you like. If you don't have one, you can use a placeholder image URL.4.
src/index.jsMake sure your
index.jsfile renders theAppcomponent:import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; // You can add some global styles here if needed import App from './App'; const root = ReactDOM.createRoot(document.getElementById('root')); root.render( <React.StrictMode> <App /> </React.StrictMode> );Key Improvements and Explanations:
- Styled Components: Uses
styled-componentsfor a more maintainable and readable styling approach. Styles are encapsulated within the components. - Functional Components: Uses functional components with hooks (although no hooks are used in this simple example, it's good practice).
- Clear Structure: The code is organized into components (Header, HeroSection, FeaturesSection, Footer) for better readability and reusability.
- Responsive Design: The
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr))in theFeaturesSectionmakes the feature cards responsive. - Image Import: Imports the hero image directly into the component.
- Comments: Includes comments to explain the purpose of different sections.
To Run the App:
npm startThis will start the development server, and you can view the page in your browser at
http://localhost:3000.Customization:
- Colors: Change the color variables in the styled components to customize the color scheme.
- Fonts: Modify the
font-familyproperty to use different fonts. - Content: Update the text and images to reflect your desired content.
- Features: Add or remove feature cards as needed.
- Layout: Adjust the grid layout or flexbox properties to change the page layout.
- Interactivity: Add event handlers and state management to make the page interactive.
This provides a solid foundation for a beautiful and well-structured React web page. Let me know if you'd like me to add more features or customize it further!
- Styled Components: Uses
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.