Lab 4 Web Engineering II
Lab 4 Web Engineering II
Lab : 04
Submitted By:
Submitted To:
<div className='overlay'>
<span style={styles.overlayText}>Boeing Airplane</span>
</div>
</div>
<div style={styles.box}>
<p style={styles.description} className='description'>
Boeing airplanes are renowned for their innovative design
and engineering.
They play a crucial role in global transportation,
connecting people and places around the world.
</p>
</div>
</div>
</div>
);
};
const styles = {
container: {
textAlign: 'center',
padding: '20px',
},
imageContainer: {
margin: '20px 2px',
display: 'inline-block',
transition: 'transform 0.2s',
width: '300px',
},
imageWrapper: {
position: 'relative',
overflow: 'hidden',
},
image: {
width: '100%',
height: 'auto',
borderRadius: '8px',
transition: 'transform 0.2s',
},
overlayText: {
color: '#fff',
fontSize: '20px',
fontWeight: 'bold',
},
box: {
display: 'block',
padding: '10px',
marginTop: '10px',
borderRadius: '8px',
backgroundColor: '#f9f9f9',
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.1)',
transition: 'transform 0.2s, box-shadow 0.2s',
cursor: 'default',
userSelect: 'none',
},
description: {
maxWidth: '300px',
margin: '0 auto',
textAlign: 'left',
},
};
return (
<div style={styles.container}>
<h2>Age Calculator</h2>
<form onSubmit={handleSubmit} style={styles.form}>
<input
type="date"
value={dob}
onChange={(e) => setDob(e.target.value)}
style={styles.input}
required
/>
<button type="submit" style={styles.button}>Calculate
Age</button>
</form>
{age && (
<div style={styles.result}>
<p>Your age is: <strong>{age.years}</strong> years,
<strong>{age.days}</strong> days</p>
</div>
)}
</div>
);
};
const styles = {
container: {
textAlign: 'center',
padding: '20px',
backgroundColor: '#f9f9f9',
borderRadius: '8px',
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.1)',
margin: '20px auto',
maxWidth: '400px',
},
form: {
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
marginBottom: '20px',
},
input: {
padding: '10px',
borderRadius: '4px',
border: '1px solid #ccc',
marginBottom: '10px',
width: '100%',
maxWidth: '300px',
},
button: {
padding: '10px 20px',
borderRadius: '4px',
border: 'none',
backgroundColor: '#007BFF',
color: '#fff',
cursor: 'pointer',
transition: 'background-color 0.3s',
},
result: {
marginTop: '10px',
fontSize: '18px',
},
};
CSS Code:
body {
user-select: none;
}
.imageContainer:hover .image {
transform: scale(1.03);
}
.overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
transition: opacity 0.2s;
user-select: none;
}
.imageContainer:hover .overlay {
opacity: 1;
}
.box:hover {
transform: translateY(-1px);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}
.imageContainer:hover .description {
color: teal;
}
App.js Code:
function App() {
return (
<>
<PicturesWebPage />
<AgeCalculator />
</>
);
}
Output: