A Pen by Gary Smith

This awesome code was written by scopevale, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright scopevale ©
  • HTML
<!DOCTYPE html>
<html lang="en" >

  <meta charset="UTF-8">
  <title>A Pen by  Gary Smith</title>


<p id="myP">This is a p element.</p>

<button type="button" onclick="myFunction1()">display none</button>

<button type="button" onclick="myFunction2()">display inherit</button>

<button type="button" onclick="myFunction3()">Visibility hidden</button>

<button type="button" onclick="myFunction4()">Visibility visible</button>

function myFunction1() {
    document.getElementById("myP").style.display = "none";
function myFunction2() {
    document.getElementById("myP").style.display = "inherit";

function myFunction3() {
    document.getElementById("myP").style.visibility = "hidden";
function myFunction4() {
    document.getElementById("myP").style.visibility = "visible";