EN

Search
Close this search box.

موستانگ، وحشیِ دوست داشتنی

0
0

How to hide or show an element with css?

  • شما باید برای ارسال دیدگاه شوید
0
0

use display:none to hide and display:block to show an element (display has values other than block):

In the code bellow, “you have to accept the registration rules” is hidden and is show when the “details” button is clicked:

<!DOCTYPE html>
<html>
<head>
<style>
#panel, .flip {
  font-size: 16px;
  padding: 10px;
  text-align: center;
  background-color: #4CAF50;
  color: white;
  border: solid 1px #a6d8a8;
  margin: auto;
}

#panel {
  display: none;
}
</style>
</head>
<body>

<p class="flip" onclick="myFunction()">details</p>

<div id="panel">
  <p>you have to accept the registration rules</p>
  
</div>

<script>
function myFunction() {
  document.getElementById("panel").style.display = "block";
}
</script>

</body>
</html>

* You can also use visibility:hidden to make an element hidden.

  • شما باید برای ارسال دیدگاه شوید
نمایش 1 نتیجه
پاسخ شما
اگر قبلاً حساب کاربری دارید با پر کردن فیلد های زیر یا به عنوان مهمان ارسال کنید.
نام*
ایمیل*
وب سایت