<header>
<h2 class="title">element.style.borderRightWidth</h2>
<p class="description">Задає ширину правої рамки елемента.</p>
</header>
<main>
<div class="result">
<div id="myElement" style="padding: 20px; border-right: 2px solid black;">Текст з правою рамкою</div>
<!-- Повзунок для вибору ширини правої рамки -->
<form id="borderForm">
<label for="borderWidth">Ширина правої рамки (px):</label>
<input type="range" id="borderWidth" name="borderWidth" min="0" max="20" value="2" oninput="updateBorderWidth()">
<span id="borderWidthValue">2px</span>
</form>
</div>
</main>
body {
font-size: 16px;
line-height: 1.5;
font-family: monospace;
}
header {
background-color: #f1f1f1;
margin-bottom: 25px;
padding: 15px;
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
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;
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
}
#myElement {
margin-top: 15px;
transition: border-right-width 0.3s;
}
function updateBorderWidth() {
let element = document.getElementById('myElement');
let borderWidthSlider = document.getElementById('borderWidth');
let borderWidthValue = document.getElementById('borderWidthValue');
let width = borderWidthSlider.value + 'px';
element.style.borderRightWidth = width;
borderWidthValue.textContent = width;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.