<header>
  <h2 class="title">element.style.borderRadius</h2>
  <p class="description">Змінює або задає радіус закруглення кутів рамки елемента.</p>
</header>
<main>
  <div class="result">
    <div id="shape" class="shape"></div>
    <form id="borderRadiusForm">
      <label for="topLeft">Top-left radius:</label>
      <input type="text" id="topLeft" name="topLeft" placeholder="10px"><br>
      <label for="topRight">Top-right radius:</label>
      <input type="text" id="topRight" name="topRight" placeholder="10px"><br>
      <label for="bottomRight">Bottom-right radius:</label>
      <input type="text" id="bottomRight" name="bottomRight" placeholder="10px"><br>
      <label for="bottomLeft">Bottom-left radius:</label>
      <input type="text" id="bottomLeft" name="bottomLeft" placeholder="10px"><br>
      <button type="button" id="applyButton">Apply</button>
    </form>
  </div>
</main>
body {
  font-size: 16px;
  line-height: 1.5;
  font-family: monospace;
}

header {
  background-color: #f1f1f1;
  margin-bottom: 25px;
  padding: 15px;
  -webkit-box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
  -moz-box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
  box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
}

header h2.title {
  padding-bottom: 15px;
  border-bottom: 1px solid #999;
}

header p.description {
  font-style: italic;
  color: #222;
}

.result {
  background-color: #f8f8f8;
  padding: 15px;
  -webkit-box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
  -moz-box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
  box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
}

.shape {
  width: 200px;
  height: 200px;
  background-color: #4CAF50;
  margin-bottom: 15px;
}

form {
  display: flex;
  flex-direction: column;
}

label {
  margin: 5px 0;
}

input {
  margin-bottom: 10px;
  padding: 5px;
}

button {
  padding: 10px;
  background-color: #4CAF50;
  color: white;
  border: none;
  cursor: pointer;
}

button:hover {
  background-color: #45a049;
}
document.getElementById('applyButton').addEventListener('click', () => {
  let shape = document.getElementById('shape');
  let topLeft = document.getElementById('topLeft').value || '0';
  let topRight = document.getElementById('topRight').value || '0';
  let bottomRight = document.getElementById('bottomRight').value || '0';
  let bottomLeft = document.getElementById('bottomLeft').value || '0';
  
  shape.style.borderRadius = `${topLeft} ${topRight} ${bottomRight} ${bottomLeft}`;
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.