To create a stylish webpage to present the article “Get Fit in 90 Days: A Comprehensive Guide” using CSS and JavaScript, I’ll guide you through a step-by-step process. We’ll use HTML5 for structuring the content, CSS3 for styling, and JavaScript for interactive elements.
### **Step 1: Structure the Content**
Create an HTML file (`index.html`) and add the following code:
“`html
Get Fit in 90 Days: A Comprehensive Guide
Phase 1: Setting Up for Success (Days 1-14)
…
Phase 2: Building Momentum (Days 15-42)
…
Phase 3: Maintaining Progress (Days 43-90)
…
Additional Tips for Success
- Track Your Progress
- Find Accountability
- Be Patient
Conclusion
…
“`
### **Step 2: Style the Content**
Create a CSS file (`styles.css`) and add the following code:
“`css
/* Global Styles */
* {
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 0;
padding: 0;
}
header {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
}
h1 {
margin-top: 0;
}
main {
max-width: 800px;
margin: auto;
padding: 20px;
}
section {
background-color: #f7f7f7;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
padding: 20px;
}
h2 {
color: #333;
font-weight: bold;
margin-top: 0;
}
p {
color: #666;
}
ul {
list-style: none;
margin: 0;
padding: 0;
}
li {
margin-bottom: 10px;
}
/* Responsive Design */
@media (max-width: 768px) {
main {
width: 100%;
padding: 10px;
}
}
“`
### **Step 3: Add Interactive Elements**
Create a JavaScript file (`script.js`) and add the following code:
“`javascript
// Get all sections
const phase1 = document.getElementById(‘phase-1’);
const phase2 = document.getElementById(‘phase-2’);
const phase3 = document.getElementById(‘phase-3’);
// Hide phases by default
[phase1, phase2, phase3].forEach(phase => {
phase.style.display = ‘none’;
});
// Add event listeners to toggles sections
document.querySelectorAll(‘.toggle-phase’).forEach(toggle => {
toggle.addEventListener(‘click’, () => {
const sectionId = toggle.dataset.section;
[phase1, phase2, phase3].forEach(phase => {
if (phase.id === sectionId) {
phase.style.display = ‘block’;
} else {
phase.style.display = ‘none’;
}
});
});
});
“`
### **Step 4: Add Toggle Buttons**
Add the following code to your HTML file:
“`html
“`
That’s it! You’ve created a comprehensive guide using HTML5, CSS3, and JavaScript. You can now customize the design and add more interactive elements as needed.
**Example Use Case:**
* Create a dashboard for tracking progress through each phase.
* Add an “expert mode” with advanced tips and resources.
* Integrate a timer to track time spent in each phase.
Remember to always follow accessibility guidelines when designing interactive content. Happy coding!