fontsizes
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec consequat ultricies turpis, at posuere ligula aliquam sit amet.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text Size Buttons with Images</title>
<style>
body {
font-size: 16px; /* Default font size */
}
.big-text {
font-size: 24px; /* Larger font size */
}
.small-text {
font-size: 12px; /* Smaller font size */
}
.btn {
padding: 15px 15px;
border: none;
background-size: cover;
cursor: pointer;
}
#bigBtn {
background-image: url('https://hewscity.s3.ap-south-1.amazonaws.com/mscollege/web/2023/07/big.png');
}
#smallBtn {
background-image: url('https://hewscity.s3.ap-south-1.amazonaws.com/mscollege/web/2023/07/small.png');
}
#resetBtn {
background-image: url('https://hewscity.s3.ap-south-1.amazonaws.com/mscollege/web/2023/07/reset.png');
}
</style>
</head>
<body>
<button id="bigBtn" class="btn" onclick="changeTextSize('big')"></button>
<button id="smallBtn" class="btn" onclick="changeTextSize('small')"></button>
<button id="resetBtn" class="btn" onclick="changeTextSize('reset')"></button>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec consequat ultricies turpis, at posuere ligula aliquam sit amet.
</p>
<script>
function changeTextSize(size) {
const body = document.body;
if (size === 'big') {
body.classList.add('big-text');
body.classList.remove('small-text');
} else if (size === 'small') {
body.classList.add('small-text');
body.classList.remove('big-text');
} else if (size === 'reset') {
body.classList.remove('big-text', 'small-text');
}
}
</script>
</body>
</html>
© 2024 All Rights Reserved Terms of Use and Privacy Policy