Back Button to go to the previous page

**Update: **
Create a fully customizable button with a ‘go back’ function.

The text of the button is set inside <button>...<Go back></button>

You can play with all the style options (example: to make the button left aligned, change the float to left).
Font weight can be changed with the following values: 100 , 200 , 300 , 400 , 500 , 600 , 700 , 800 , 900. 400 being normal font weight and 700 being bold font weight.

To insert in a custom code block:

<button id="myButton">Go back</button>

<style>
  #myButton {
    width: 120px;
    height: 40px;
    background-color: #000000;
    border-radius: 10px;
    padding: 10px 20px;
    margin: auto;
    font-size: 16px;
    font-family: "Inter", sans-serif;
    font-weight: bold;
    color: #FFFFFF;
    text-align: center;
    float: center;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #myButton:hover {
    background-color: #FFFFFF;
    color: #000000;
  }
</style>

<script>
  document.getElementById("myButton").addEventListener("click", function() {
    window.history.back();
  });
</script>
6 Likes