<div class="content">
  <div class="buttons">
  <button class="button" onclick="dotted()">dotted</button> 
  <button class="button" onclick="dashed()">dashed</button>  
  <button class="button" onclick="solid()">solid</button> 
  <button class="button" onclick="double()">double</button>  
  <button class="button" onclick="groove()">groove</button> 
  <button class="button" onclick="ridge()">ridge</button> 
  <button class="button" onclick="inset()">inset</button> 
  <button class="button" onclick="outset()">outset</button>
  <button class="button" onclick="hiddenFunction()">hidden</button>
  <button class="button" onclick="none()">none</button>
          
          
  </div>
<div id="border-style">Click on the button to change the border-style.</div>
  <div class="col"><h2>CSS Code:</h2><p id="code">CSS code</p>
</div>
</div>
body {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.content {
  position: relative;
}

#border-style {
  padding: 20px;
  border-style: solid;
  border-width: 5px;
}

.buttons {
  left:-40%;
  position: absolute;
  top:-100px;
  z-index:1;
}

button {
  background-color: #333;
  color: white;
  border: none;
  display: block;
  padding:5px;
  width: 100px;
  margin:5px;
  transition: .2s;
  font-weight: bold;
}

button:hover {
  background-color: white;
  color: #333;
}

.col {
  position: absolute;
  font-weight: bold;
  font-size:15px;
  width: 100%;
  left:450px;
  top:-15px;
}
function dotted() {
  document.getElementById("border-style").style.borderStyle="dotted" 
  
  var x = document.getElementById("code");
  if (x.innerHTML === "border-style: dotted;") {
    x.innerHTML = "border-style: dotted;";
  } else {
    x.innerHTML = "border-style: dotted;";
  }
}

function dashed() {
  document.getElementById("border-style").style.borderStyle="dashed" 
  
  var x = document.getElementById("code");
  if (x.innerHTML === "border-style: dashed;") {
    x.innerHTML = "border-style: dashed;";
  } else {
    x.innerHTML = "border-style: dashed;";
  }
}

function solid() {
  document.getElementById("border-style").style.borderStyle="solid" 
  
  var x = document.getElementById("code");
  if (x.innerHTML === "border-style: solid;") {
    x.innerHTML = "border-style: solid;";
  } else {
    x.innerHTML = "border-style: solid;";
  }
}

function double() {
  document.getElementById("border-style").style.borderStyle="double" 
  
  var x = document.getElementById("code");
  if (x.innerHTML === "border-style: double;") {
    x.innerHTML = "border-style: double;";
  } else {
    x.innerHTML = "border-style: double;";
  }
}

function groove() {
  document.getElementById("border-style").style.borderStyle="groove" 
  
  var x = document.getElementById("code");
  if (x.innerHTML === "border-style: groove;") {
    x.innerHTML = "border-style: groove;";
  } else {
    x.innerHTML = "border-style: groove;";
  }
}

function ridge() {
  document.getElementById("border-style").style.borderStyle="ridge" 
  
  var x = document.getElementById("code");
  if (x.innerHTML === "border-style: ridge;") {
    x.innerHTML = "border-style: ridge;";
  } else {
    x.innerHTML = "border-style: ridge;";
  }
}

function inset() {
  document.getElementById("border-style").style.borderStyle="inset" 
  
  var x = document.getElementById("code");
  if (x.innerHTML === "border-style: inset;") {
    x.innerHTML = "border-style: inset;";
  } else {
    x.innerHTML = "border-style: inset;";
  }
}

function outset() {
  document.getElementById("border-style").style.borderStyle="outset" 
  
  var x = document.getElementById("code");
  if (x.innerHTML === "border-style: outset;") {
    x.innerHTML = "border-style: outset;";
  } else {
    x.innerHTML = "border-style: outset;";
  }
}

function hiddenFunction() {
  document.getElementById("border-style").style.borderStyle="hidden" 
  
  var x = document.getElementById("code");
  if (x.innerHTML === "border-style: hidden;") {
    x.innerHTML = "border-style: hidden;";
  } else {
    x.innerHTML = "border-style: hidden;";
  }
}

function none() {
  document.getElementById("border-style").style.borderStyle="none" 
  
  var x = document.getElementById("code");
  if (x.innerHTML === "border-style: none;") {
    x.innerHTML = "border-style: none;";
  } else {
    x.innerHTML = "border-style: none;";
  }
}



Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.