Omegq

Untitled

Aug 6th, 2025 (edited)
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 7.07 KB | Source Code | 0 0
  1. HTML:
  2.  
  3. <!DOCTYPE html>
  4. <html lang="en">
  5.     <head>
  6.         <meta charset="UTF-8">
  7.         <meta name="viewport" content ="width=device-width, initial-scale=1.0">
  8.         <title>Homepage</title>
  9.         <link rel="stylesheet" href="style.css">
  10.         <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
  11.     </head>
  12.     <body>
  13.         <header>
  14.             <nav>
  15.                 <ul>
  16.                     <li><a href="#home">Home</a></li>
  17.                     <li><a href="#models">Models</a></li>
  18.                     <li><a href="#features">Features</a></li>
  19.                     <li><a href="#contact">Contact</a></li>
  20.                 </ul>
  21.             </nav>
  22.         </header>
  23.  
  24.         <section id="home" class="parallax parallax1">
  25.  
  26.         </section>
  27.  
  28.         <section id="models" class="content">
  29.             <h2>Our models</h2>
  30.             <p>Discover our range of high-performance vehicles</p>
  31.             <div class="car-models">
  32.                 <div class="car-model">
  33.                     <img src="./assets/car1.jpg">
  34.                     <h3>Luxury cars</h3>
  35.                 </div>
  36.                     <div class="car-model">
  37.                     <img src="./assets/car2.jpg">
  38.                     <h3>Sports cars</h3>
  39.                 </div>
  40.                     <div class="car-model">
  41.                     <img src="./assets/car3.jpg">
  42.                     <h3>Regular cars</h3>
  43.                 </div>
  44.             </div><!--end car-models div-->
  45.         </section>
  46.  
  47.         <section id="home" class="parallax parallax2">
  48.  
  49.         </section>
  50.  
  51.         <section id="home" class="content">
  52.             <h2>Why choose us</h2>
  53.             <ul class="features-list">
  54.                 <li>Advanced safety systems</li>
  55.                 <li>Advanced driving assistance</li>
  56.                 <li>Eco-friendly engines</li>
  57.                 <li>Premium interior confort</li>
  58.             </ul>
  59.         </section>
  60.  
  61.         <section id="home" class="parallax parallax3">
  62.  
  63.         </section>
  64.  
  65.         <footer>
  66.             <p>&copy; 2024 Luxury vehicles Co. All rights reserved</p>
  67.         </footer>
  68.  
  69.     </body>
  70. </html>
  71.  
  72.  
  73.  
  74.  
  75. CSS :
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82. body, html{
  83.     margin: 0;
  84.     padding:0;
  85.     font-family:"Roboto","Arial";
  86.     height: 100%;
  87.     color: #333;
  88.     scroll-behavior: smooth;
  89.     line-height: 1.4;
  90. }
  91.  
  92. header{
  93.     position: fixed;
  94.     top: 0;
  95.     width: 100%;
  96.     background-color: rgba(26,13,27,0.7);
  97.     z-index: 1000;  /*This sets the z-order of the positioned element*/
  98.  
  99.     /*transition: property name | duration | easing function | delay*/
  100.     transition: background-color 0.3s ease;
  101. }
  102. header:hover{
  103.     background-color: rgba(26,13,27,0.8);
  104. }
  105.  
  106. nav ul{
  107.     list-style-type: none;  /*does not show the list bullets*/
  108.     padding: 0;
  109.     margin:0;
  110.     display: flex;  /*uses the flexbox model. By default the elements are inserted using the "row" setting*/
  111.     /*Note that the "nav ul" is the flex container while the "nav ul li" and "nav ul li a" contains the elements*/
  112.  
  113.     justify-content: center;    /*defines the alignmenta alonf the main axis. In this case the elements
  114.     are centered along the line*/
  115. }
  116.  
  117. /*List entry*/
  118. nav ul li{
  119.     margin: 0 20px;
  120. }
  121.  
  122. /*Content of the list entry (an anchor tag <a>)*/
  123. nav ul li a{
  124.     color:white;
  125.     text-decoration: none;
  126.     padding: 20px 0;
  127.     /*the element generated a block box that generated line breaks before and after the box.
  128.      The box is kept inline (in the same line as the other content).*/
  129.     display: inline-block;  
  130.     font-weight: 500;
  131.     transition: color 0.3s ease;
  132.     text-shadow: 1px 1px 2px rgb(0,0,0,0.5);
  133. }
  134.  
  135. nav ul li a:hover{
  136.     color: #3498db;
  137. }
  138.  
  139. /*the sections contain mainly photos and the "product cards" that are in the middle of the page*/
  140. /*
  141. The sections consitute flexbox containers
  142. */
  143. section{
  144.     width:100%;
  145.     margin-right: 0px;
  146.     position: relative;
  147.     min-height: 100vh;
  148.     display:flex;   /*This sets the display method for the cards: flexbox row by default */
  149.     justify-content: center; /*The cards are then justified by centering them along the main line*/
  150.     align-items: center;
  151.     text-align: center;
  152. }
  153. /*Parallaxes contain pictures of products*/
  154. .parallax{
  155.     width:100%;
  156.     background-attachment: fixed;
  157.     background-size: cover;
  158.     background-position: center;
  159. }
  160. /*different parallaxes have different backgrounds*/
  161. .parallax1{
  162.     background-image: url(./assets/car1.jpg);
  163. }
  164.  
  165. .parallax2{
  166.     background-image: url(./assets/car2.jpg);
  167. }
  168.  
  169. .parallax3{
  170.     background-image: url(./assets/car3.jpg);
  171. }
  172.  
  173. /*content is a flexbox container. its elements are displayed using row ()*/
  174. .content{
  175.     display:flex;
  176.     flex-direction: column;
  177.     background-color: #ffffff;
  178.     color: #333;
  179.     /**Padding: top | right | bottom | left */
  180.     padding: 40px 0px 40px 0px/*TODO*/;
  181.     margin-top: 20px;
  182. }
  183.  
  184. h2{
  185.     font-weight: 700;
  186.     margin-bottom:15px;
  187.     position: relative;
  188.     z-index: 1;
  189.     color: #3c3e50;
  190.     font-size: 3em;
  191. }
  192.  
  193. p{
  194.     max-width: 800px;
  195.     margin: 0 auto 40px;
  196.     line-height:1.8;
  197.     font-size: 1.1em;
  198. }
  199.  
  200. .car-models{
  201.     display:  flex;
  202.     justify-content: space-around;
  203.     flex-wrap: wrap;
  204.     margin-top: 60px;
  205. }
  206.  
  207. .car-model{
  208.     flex-basis: calc(33.33% - 40px);
  209.     margin: 20px;
  210.     background-color: #ffffff;
  211.     box-shadow: 0 10px 20px rgba(0,0,0,0.1);
  212.     border-radius: 12px;
  213.     overflow: hidden;
  214.     transition: transform 0.3s ease, box-shadow 0.3s ease;
  215. }
  216.  
  217. .car-model:hover{
  218.     transform: translateY(-10px);
  219.     box-shadow: 0 15px 30px rgba(0,0,0,0.15);
  220. }
  221.  
  222. .car-model img{
  223.     width:100%;
  224.     height: auto;
  225.     transition: transform 0.3s ease;
  226. }
  227.  
  228. .car-model img:hover{
  229.     transform: scale(1.05);
  230. }
  231.  
  232. .car-model h3{
  233.     padding: 25px;
  234.     margin: 0;
  235.     font-weight: 600;
  236.     font-size: 1.4em;
  237.     color: #2c3e50;
  238. }
  239.  
  240. .features-list{
  241.     list-style: none;
  242.     padding: 0;
  243.     display: flex;
  244.     flex-wrap: wrap;
  245.     justify-content: center;
  246. }
  247.  
  248. .features-list li{
  249.     flex-basis: calc(50% - 40px);
  250.     margin: 20px;
  251.     padding: 30px;
  252.     background-color: #ffffff;
  253.     box-shadow: 0 10px 20px rgba(0,0,0,0.15);
  254.     border-radius: 12px;
  255.     font-weight: 400;
  256.     transition: transform 0.3s ease, box-shadow 0.3s ease;
  257. }
  258.  
  259. .features-list li:hover{
  260.     transform: translateY(-5px);
  261.     box-shadow: 0 15px 30px rgba(0,0,0,0.15);
  262. }
  263.  
  264. footer{
  265.     width:100%;
  266.     margin-right: 0px;
  267.     background-color: #2c3e50;
  268.     color: white;
  269.     text-align: center;
  270.     padding: 1em;
  271. }
  272.  
  273. @media(max-width: 900px){
  274.    
  275.     html, body{
  276.         width: 100%;
  277.         height: 100%;
  278.         margin: 0;
  279.         padding:0;
  280.         overflow-x: hidden;
  281.     }
  282.    
  283.     .car-model,
  284.     .features-list li{
  285.         flex-basis: 100%;
  286.     }
  287.  
  288.     header{
  289.         padding: 15px 0;
  290.     }
  291.  
  292.     nav ul li{
  293.         margin: 0 15px;
  294.     }
  295.     .content{
  296.         padding: 80px 20px;
  297.     }
  298.  
  299.     h2{
  300.         font-size: 2.5em;
  301.     }
  302.  
  303. }
  304.  
  305. /*TODO: white border on right side visible on mobile*/
Tags: CSS
Advertisement
Add Comment
Please, Sign In to add comment