<header>
<h2 class="title">element.style.borderLeftColor</h2>
<p class="description">Задає або змінює колір лівої рамки елемента.</p>
</header>
<main>
<div class="result">
<div id="shape" class="shape"></div>
<form id="borderColorForm">
<label for="borderColorInput">Choose Left Border Color:</label>
<input type="color" id="borderColorInput" name="borderColorInput" value="#000000">
</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);
}
.shape {
width: 200px;
height: 200px;
background-color: #4CAF50;
border-left: 10px solid #000;
margin-bottom: 15px;
}
form {
display: flex;
flex-direction: column;
}
label {
margin: 5px 0;
}
input[type="color"] {
padding: 5px;
width: 100%;
}
let element = document.getElementById('shape');
let colorInput = document.getElementById('borderColorInput');
colorInput.addEventListener('input', () => {
let selectedColor = colorInput.value;
element.style.borderLeftColor = selectedColor;
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.