مثال عن اخفاء/اظهار عنصر:
This is a visible heading
This is a hidden heading
Notice that the hidden heading still takes up space.
مثال عن تغيير طريقة عرض عنصر من بلوك إلى سطري:
These two paragraphs generates inline boxes, and it results in
no distance between the two elements.
مثال عن تغيير طريقة عرض عنصر من سطري إلى بلوك:
A display property with a value of "block" results in a line break between the two elements.
مثال عن تغيير طريقة عرض عنصر باستخدام جافاسكربت:
Click to show panel
This panel contains a div element, which is hidden by default (display: none).
It is styled with CSS and we use JavaScript to show it (display: block).
How it works: Notice that the p element with class="flip" has an onclick attribute attached to it. When the user clicks on the p element, a function called myFunction() is executed, which changes the style of the div with id="panel" from display:none (hidden) to display:block (visible).
You will learn more about JavaScript in our JavaScript Tutorial.