change this package box (<a…
- User
change this package box (
<!-- Background Overlay --> <div style=" position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0.5; /* Adjusts the visibility of the overlay */ z-index: 0; /* Places the overlay behind the content */ "></div> <!-- Package Title and Icon --> <div style=" display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; position: relative; /* Ensures content appears above the overlay */ z-index: 1; color: #ffffff; /* Ensures the title and icon text color is white */ "> <span style=" font-size: 20px; font-weight: 400; ">Package 1</span> <!-- External Link Icon --> <img src="https://longevacare.com/wp-content/uploads/2024/08/open_new_page-1.svg" alt="Open New Page Icon" style="width: 24px; height: 24px;"> </div> <!-- Package Description --> <div style=" font-size: 22px; font-weight: 600; position: relative; /* Ensures content appears above the overlay */ z-index: 1; color: #ffffff; /* Ensures the description text color is white */ ">The Diagnostics ) and add more features and looks better and use this style ( :root { --c-gradient: linear-gradient(45deg, #D1C287, #4F3F02); --c-gray: #4a4a4a; --c-light-gray: #f5f5f5; --c-white: white; --c-text-light: #d9d9d9; --c-bg-primary: rgba(43, 43, 43, 0.5); /* #2b2b2b with 0.5 opacity / --c-text-primary: white; --c-gold: #D1C287; --c-accent: #4F3F02; --f-primary: 'Lato', sans-serif; --s-border-radius: 8px; --transition-speed: 0.3s; --container-max-width: 1100px; --fade-in-duration: 0.6s; --gradient-start: #D1C287; --gradient-end: #4F3F02; --section-padding: 20px 0px; / Added default padding */ }
) and type full code and looks great
- Assistant
Certainly! Below is a complete HTML and CSS code snippet for a redesigned package box that utilizes the provided CSS variables. This enhanced version includes additional features such as a hover effect, a feature list, and a call-to-action button to make it more engaging and visually appealing.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Enhanced Package Box</title> <style> :root { --c-gradient: linear-gradient(45deg, #D1C287, #4F3F02); --c-gray: #4a4a4a; --c-light-gray: #f5f5f5; --c-white: white; --c-text-light: #d9d9d9; --c-bg-primary: rgba(43, 43, 43, 0.5); /* #2b2b2b with 0.5 opacity */ --c-text-primary: white; --c-gold: #D1C287; --c-accent: #4F3F02; --f-primary: 'Lato', sans-serif; --s-border-radius: 8px; --transition-speed: 0.3s; --container-max-width: 1100px; --fade-in-duration: 0.6s; --gradient-start: #D1C287; --gradient-end: #4F3F02; --section-padding: 20px 0px; /* Added default padding */ } body { font-family: var(--f-primary); background-color: var(--c-light-gray); margin: 0; padding: 20px; display: flex; justify-content: center; align-items: center; min-height: 100vh; } .package-box { position: relative; display: block; max-width: 1200px; width: 100%; padding: 24px; background: var(--c-gradient); box-shadow: 0px 4px 12px rgba(79, 63, 2, 0.4); border-radius: var(--s-border-radius); text-decoration: none; color: var(--c-text-primary); overflow: hidden; transition: transform var(--transition-speed), box-shadow var(--transition-speed); } .package-box:hover { transform: translateY(-5px); box-shadow: 0px 8px 16px rgba(79, 63, 2, 0.6); } /* Background Overlay */ .package-box::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--c-bg-primary); opacity: 0.5; z-index: 0; transition: opacity var(--transition-speed); } .package-box:hover::before { opacity: 0.3; } /* Content Wrapper */ .package-content { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 16px; } /* Header Section */ .package-header { display: flex; justify-content: space-between; align-items: center; } .package-title { font-size: 24px; font-weight: 700; color: var(--c-white); } .package-icon { width: 24px; height: 24px; transition: transform var(--transition-speed); } .package-box:hover .package-icon { transform: rotate(45deg); } /* Description Section */ .package-description { font-size: 20px; font-weight: 600; color: var(--c-white); } /* Features List */ .package-features { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; } .package-features li { background-color: rgba(255, 255, 255, 0.2); padding: 8px 12px; border-radius: 4px; font-size: 14px; color: var(--c-white); } /* Call to Action Button */ .cta-button { display: inline-block; padding: 12px 24px; background-color: var(--c-accent); color: var(--c-white); border: none; border-radius: var(--s-border-radius); text-decoration: none; font-size: 16px; font-weight: 600; cursor: pointer; transition: background-color var(--transition-speed); } .cta-button:hover { background-color: var(--c-gold); } /* Responsive Design */ @media (max-width: 768px) { .package-header { flex-direction: column; align-items: flex-start; gap: 8px; } .package-features { flex-direction: column; } .package-box { padding: 16px; } .package-title { font-size: 20px; } .package-description { font-size: 18px; } } </style> </head> <body> <a href="https://longevacare.com/what-we-do/packages/diagnostic-packages/" class="package-box"> <div class="package-content"> <!-- Header: Title and Icon --> <div class="package-header"> <span class="package-title">Package 1</span> <!-- External Link Icon --> <img src="https://longevacare.com/wp-content/uploads/2024/08/open_new_page-1.svg" alt="Open New Page Icon" class="package-icon"> </div> <!-- Description --> <div class="package-description"> The Diagnostics </div> <!-- Features List --> <ul class="package-features"> <li>Comprehensive Blood Panel</li> <li>Advanced Imaging</li> <li>Personalized Health Plan</li> <li>24/7 Support</li> </ul> <!-- Call to Action Button --> <a href="https://longevacare.com/what-we-do/packages/diagnostic-packages/" class="cta-button">Learn More</a> </div> </a> </body> </html>Explanation of Enhancements
-
CSS Variables Usage:
- The
:rootselector defines all the necessary CSS variables, ensuring consistency and ease of maintenance.
- The
-
Structure and Semantics:
- The package box is structured semantically with clear sections: header, description, features list, and a call-to-action button.
-
Hover Effects:
- The entire package box lifts slightly (
translateY(-5px)) and the shadow becomes more prominent on hover to create a tactile feel. - The overlay's opacity decreases on hover, making the content more prominent.
- The external link icon rotates to indicate interactivity.
- The entire package box lifts slightly (
-
Feature List:
- A list of features has been added to provide more information about the package, enhancing its value proposition.
-
Call-to-Action Button:
- A prominent button styled with the accent color encourages users to take action.
- The button changes color on hover to provide feedback.
-
Responsive Design:
- Media queries ensure that the package box looks great on all screen sizes, adjusting font sizes and layout for smaller devices.
-
Accessibility:
- Sufficient color contrast is maintained for readability.
- The button and link have clear visual indicators for interactivity.
-
Clean and Maintainable Code:
- CSS classes are used instead of inline styles for better separation of concerns and easier maintenance.
- Consistent naming conventions make the code easier to understand and modify.
Customization Tips
-
Colors and Gradients:
- You can easily change the gradient or accent colors by modifying the corresponding CSS variables in the
:rootsection.
- You can easily change the gradient or accent colors by modifying the corresponding CSS variables in the
-
Content:
- Update the package title, description, features, and links as per your requirements.
-
Icons and Images:
- Replace the external link icon with any other icon that fits your design language.
-
Animations:
- Feel free to tweak the transition speeds or add more animations to enhance the user experience.
This redesigned package box is not only visually appealing but also user-friendly and responsive, ensuring a great experience across different devices.
-