<h1>Change my outline</h1>
<select name="" id="select">
<option value="none">none</option>
<option value="dotted">dotted</option>
<option value="dashed">dashed</option>
<option value="solid">solid</option>
<option value="double">double</option>
<option value="groove">groove</option>
<option value="ridge">ridge</option>
<option value="inset">inset</option>
<option value="outset">outset</option>
</select>
<input type="range" max="40" step="1" value="20">
<pre class="code-container">
<span class="token-selector">h1</span> {
<span class="token-property">outline-width</span>: <span class="token-function width">20px</span>;
<span class="token-property">outline-style</span>: <span class="token-function style">solid</span>;
}
</pre>
* {
box-sizing: border-box;
}
body {
font-family: system-ui;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 32px;
padding: 40px;
min-height: 100vh;
background-image: linear-gradient(135deg, #ff7a18, #af002d);
}
h1 {
display: block;
font-size: 2em;
color: #fff;
padding: 4em 2em;
outline: 20px solid #fff;
}
select {
display: block;
width: 200px;
border: 1px solid #fff;
background: transparent;
color: #fff;
padding: 16px;
outline: 0;
}
option {
display: block;
padding: 16px;
color: #333;
}
input {
width: 200px;
}
output {
display: block;
}
.code-container {
width: 375px;
max-width: 100%;
overflow-x: auto;
text-align: initial;
background-color: #272822;
padding: 1.5em 0;
border-radius: 3px;
color: #F8F8F2;
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
font-family: Consolas, Monaco, 'Andale Mono', monospace;
}
.token-property {
color: #F92672;
}
.token-function {
color: #E6DB74;
}
.token-selector {
color: #a6e22e;
}
var text = document.querySelector('h1'),
slider = document.querySelector('input');
slider.addEventListener('input', function () {
text.style.outlineWidth = this.value + 'px';
document.querySelector('.width').textContent = this.value + 'px';
}, false);
var select = document.querySelector('#select');
select.addEventListener("change", function (e) {
text.style.outlineStyle = e.target.value;
document.querySelector('.style').textContent = e.target.value;
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.