Button size should not increase on zoom. While zooming, the image is not zooming but only the button size is increasing or decreasing.
HTML:
<code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Task 3</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<img src="image.jpg" alt="image" class="responsive-image">
<button class="click-me-button">Click Me</button>
</div>
</body>
</html>
</code>
<code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Task 3</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<img src="image.jpg" alt="image" class="responsive-image">
<button class="click-me-button">Click Me</button>
</div>
</body>
</html>
</code>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Task 3</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<img src="image.jpg" alt="image" class="responsive-image">
<button class="click-me-button">Click Me</button>
</div>
</body>
</html>
CSS:
<code>@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,100..700;1,100..700&family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Playwrite+FR+Moderne&display=swap');
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
width: 100%;
height: 100%;
}
.container {
text-align: center;
width: 50%;
position: absolute;
left: 25%;
right: 25%;
top: 10%;
bottom: 10%;
}
.responsive-image {
max-width: 100%;
height: auto;
display: block;
margin-top: 0;
margin-bottom: auto;
}
.click-me-button {
font-family: "Playwrite FR Moderne", cursive;
font-weight: 400;
width: 100%;
padding: 15px 0;
background: linear-gradient(to right, #ffcc00, #33cc33);
border: none;
font-size: 20px;
font-weight: bold;
color: white;
cursor: pointer;
border-radius: 0;
margin-top: auto;
}
.click-me-button:hover {
background: linear-gradient(to right, #ffcc00, #33cc33);
transform: scale(1.02);
}
</code>
<code>@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,100..700;1,100..700&family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Playwrite+FR+Moderne&display=swap');
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
width: 100%;
height: 100%;
}
.container {
text-align: center;
width: 50%;
position: absolute;
left: 25%;
right: 25%;
top: 10%;
bottom: 10%;
}
.responsive-image {
max-width: 100%;
height: auto;
display: block;
margin-top: 0;
margin-bottom: auto;
}
.click-me-button {
font-family: "Playwrite FR Moderne", cursive;
font-weight: 400;
width: 100%;
padding: 15px 0;
background: linear-gradient(to right, #ffcc00, #33cc33);
border: none;
font-size: 20px;
font-weight: bold;
color: white;
cursor: pointer;
border-radius: 0;
margin-top: auto;
}
.click-me-button:hover {
background: linear-gradient(to right, #ffcc00, #33cc33);
transform: scale(1.02);
}
</code>
@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,100..700;1,100..700&family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Playwrite+FR+Moderne&display=swap');
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
width: 100%;
height: 100%;
}
.container {
text-align: center;
width: 50%;
position: absolute;
left: 25%;
right: 25%;
top: 10%;
bottom: 10%;
}
.responsive-image {
max-width: 100%;
height: auto;
display: block;
margin-top: 0;
margin-bottom: auto;
}
.click-me-button {
font-family: "Playwrite FR Moderne", cursive;
font-weight: 400;
width: 100%;
padding: 15px 0;
background: linear-gradient(to right, #ffcc00, #33cc33);
border: none;
font-size: 20px;
font-weight: bold;
color: white;
cursor: pointer;
border-radius: 0;
margin-top: auto;
}
.click-me-button:hover {
background: linear-gradient(to right, #ffcc00, #33cc33);
transform: scale(1.02);
}
The button size sholud not increase when zooming. Overflow and Flex shouldn’t be used. Please fix this issue, I am new to coding.
New contributor
Temp Account is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.