document.querySelector(".btn-eng").addEventListener('click', function () {
document.querySelector(".eng").classList.add("active");
document.querySelector(".french").classList.remove("active");
document.querySelector(".italian").classList.remove("active");
});
document.querySelector(".btn-french").addEventListener('click', function () {
document.querySelector(".french").classList.add("active");
document.querySelector(".eng").classList.remove("active");
document.querySelector(".italian").classList.remove("active");
});
document.querySelector(".btn-italian").addEventListener('click', function () {
document.querySelector(".italian").classList.add("active");
document.querySelector(".eng").classList.remove("active");
document.querySelector(".french").classList.remove("active");
});
*{
font-size: 1rem;
}
.container {
margin: auto;
height: 100px;
width: 250px;
}
.flex {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
height: 100%;
width: 100%;
}
.eng,
.french,
.italian {
display: none;
}
.active {
display: block;
}
<div class="container">
<div class="flex">
<div class="section">
<p class="eng active">Hello Developers out there!</p>
<p class="french">Bonjour les développeurs là-bas!</p>
<p class="italian">Ciao sviluppatori là fuori!</p>
</div>
<div class="button">
<button class="btn-eng">English</button>
<button class="btn-french">French</button>
<button class="btn-italian">Italian</button>
</div>
</div>
</div>