Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HTML:
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content ="width=device-width, initial-scale=1.0">
- <title>Homepage</title>
- <link rel="stylesheet" href="style.css">
- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
- </head>
- <body>
- <header>
- <nav>
- <ul>
- <li><a href="#home">Home</a></li>
- <li><a href="#models">Models</a></li>
- <li><a href="#features">Features</a></li>
- <li><a href="#contact">Contact</a></li>
- </ul>
- </nav>
- </header>
- <section id="home" class="parallax parallax1">
- </section>
- <section id="models" class="content">
- <h2>Our models</h2>
- <p>Discover our range of high-performance vehicles</p>
- <div class="car-models">
- <div class="car-model">
- <img src="./assets/car1.jpg">
- <h3>Luxury cars</h3>
- </div>
- <div class="car-model">
- <img src="./assets/car2.jpg">
- <h3>Sports cars</h3>
- </div>
- <div class="car-model">
- <img src="./assets/car3.jpg">
- <h3>Regular cars</h3>
- </div>
- </div><!--end car-models div-->
- </section>
- <section id="home" class="parallax parallax2">
- </section>
- <section id="home" class="content">
- <h2>Why choose us</h2>
- <ul class="features-list">
- <li>Advanced safety systems</li>
- <li>Advanced driving assistance</li>
- <li>Eco-friendly engines</li>
- <li>Premium interior confort</li>
- </ul>
- </section>
- <section id="home" class="parallax parallax3">
- </section>
- <footer>
- <p>© 2024 Luxury vehicles Co. All rights reserved</p>
- </footer>
- </body>
- </html>
- CSS :
- body, html{
- margin: 0;
- padding:0;
- font-family:"Roboto","Arial";
- height: 100%;
- color: #333;
- scroll-behavior: smooth;
- line-height: 1.4;
- }
- header{
- position: fixed;
- top: 0;
- width: 100%;
- background-color: rgba(26,13,27,0.7);
- z-index: 1000; /*This sets the z-order of the positioned element*/
- /*transition: property name | duration | easing function | delay*/
- transition: background-color 0.3s ease;
- }
- header:hover{
- background-color: rgba(26,13,27,0.8);
- }
- nav ul{
- list-style-type: none; /*does not show the list bullets*/
- padding: 0;
- margin:0;
- display: flex; /*uses the flexbox model. By default the elements are inserted using the "row" setting*/
- /*Note that the "nav ul" is the flex container while the "nav ul li" and "nav ul li a" contains the elements*/
- justify-content: center; /*defines the alignmenta alonf the main axis. In this case the elements
- are centered along the line*/
- }
- /*List entry*/
- nav ul li{
- margin: 0 20px;
- }
- /*Content of the list entry (an anchor tag <a>)*/
- nav ul li a{
- color:white;
- text-decoration: none;
- padding: 20px 0;
- /*the element generated a block box that generated line breaks before and after the box.
- The box is kept inline (in the same line as the other content).*/
- display: inline-block;
- font-weight: 500;
- transition: color 0.3s ease;
- text-shadow: 1px 1px 2px rgb(0,0,0,0.5);
- }
- nav ul li a:hover{
- color: #3498db;
- }
- /*the sections contain mainly photos and the "product cards" that are in the middle of the page*/
- /*
- The sections consitute flexbox containers
- */
- section{
- width:100%;
- margin-right: 0px;
- position: relative;
- min-height: 100vh;
- display:flex; /*This sets the display method for the cards: flexbox row by default */
- justify-content: center; /*The cards are then justified by centering them along the main line*/
- align-items: center;
- text-align: center;
- }
- /*Parallaxes contain pictures of products*/
- .parallax{
- width:100%;
- background-attachment: fixed;
- background-size: cover;
- background-position: center;
- }
- /*different parallaxes have different backgrounds*/
- .parallax1{
- background-image: url(./assets/car1.jpg);
- }
- .parallax2{
- background-image: url(./assets/car2.jpg);
- }
- .parallax3{
- background-image: url(./assets/car3.jpg);
- }
- /*content is a flexbox container. its elements are displayed using row ()*/
- .content{
- display:flex;
- flex-direction: column;
- background-color: #ffffff;
- color: #333;
- /**Padding: top | right | bottom | left */
- padding: 40px 0px 40px 0px/*TODO*/;
- margin-top: 20px;
- }
- h2{
- font-weight: 700;
- margin-bottom:15px;
- position: relative;
- z-index: 1;
- color: #3c3e50;
- font-size: 3em;
- }
- p{
- max-width: 800px;
- margin: 0 auto 40px;
- line-height:1.8;
- font-size: 1.1em;
- }
- .car-models{
- display: flex;
- justify-content: space-around;
- flex-wrap: wrap;
- margin-top: 60px;
- }
- .car-model{
- flex-basis: calc(33.33% - 40px);
- margin: 20px;
- background-color: #ffffff;
- box-shadow: 0 10px 20px rgba(0,0,0,0.1);
- border-radius: 12px;
- overflow: hidden;
- transition: transform 0.3s ease, box-shadow 0.3s ease;
- }
- .car-model:hover{
- transform: translateY(-10px);
- box-shadow: 0 15px 30px rgba(0,0,0,0.15);
- }
- .car-model img{
- width:100%;
- height: auto;
- transition: transform 0.3s ease;
- }
- .car-model img:hover{
- transform: scale(1.05);
- }
- .car-model h3{
- padding: 25px;
- margin: 0;
- font-weight: 600;
- font-size: 1.4em;
- color: #2c3e50;
- }
- .features-list{
- list-style: none;
- padding: 0;
- display: flex;
- flex-wrap: wrap;
- justify-content: center;
- }
- .features-list li{
- flex-basis: calc(50% - 40px);
- margin: 20px;
- padding: 30px;
- background-color: #ffffff;
- box-shadow: 0 10px 20px rgba(0,0,0,0.15);
- border-radius: 12px;
- font-weight: 400;
- transition: transform 0.3s ease, box-shadow 0.3s ease;
- }
- .features-list li:hover{
- transform: translateY(-5px);
- box-shadow: 0 15px 30px rgba(0,0,0,0.15);
- }
- footer{
- width:100%;
- margin-right: 0px;
- background-color: #2c3e50;
- color: white;
- text-align: center;
- padding: 1em;
- }
- @media(max-width: 900px){
- html, body{
- width: 100%;
- height: 100%;
- margin: 0;
- padding:0;
- overflow-x: hidden;
- }
- .car-model,
- .features-list li{
- flex-basis: 100%;
- }
- header{
- padding: 15px 0;
- }
- nav ul li{
- margin: 0 15px;
- }
- .content{
- padding: 80px 20px;
- }
- h2{
- font-size: 2.5em;
- }
- }
- /*TODO: white border on right side visible on mobile*/
Advertisement
Add Comment
Please, Sign In to add comment