<!-- :disabled -->
<section class="example-cntr disabled">
<h1>CSS <code>:disabled</code> pseudo-class</h1>
<p>The <code>:disabled</code> pseudo-class targets a form element in the disabled state. An element in a disabled state can’t be selected, checked, activated or gain focus.</p>
<p>As you can see none of these form elements can be used. Notice the <code>disabled</code> attribute in the HTML.</p>
<form class="flex-ctnr">
<div>
<h3>Text Field</h3>
<input type="text" disabled>
</div>
<div>
<h3>Radio Button</h3>
<input type="radio" disabled>
</div>
<div>
<h3>Check Box</h3>
<input type="checkbox" disabled>
</div>
<div>
<h3>Text Area</h3>
<textarea cols="30" rows="10" disabled></textarea>
</div>
</form>
</section>
//:disabled
.disabled {
text-align: left;
:disabled {
opacity: .2;
}
}
//Styling stuff not needed for demo
body { text-align: left; }
.example-cntr {
max-width: 800px;
margin: auto;
padding: 20px 50px;
box-shadow: 0 1px 2px rgba(black,.3);
background: rgba(black,.15);
}
h1 {
text-transform: none;
border-bottom: #636363 1px dotted;
code {
display: inline-block;
margin-bottom: 10px;
color: $y;
background: none;
box-shadow: none;
}
}
code { font-size: 1em; }
form {
width: 100%;
margin: 40px auto 20px;
padding: 20px 10px;
border-radius: 2px;
font-size: 1.2em;
text-align: center;
background: rgba(black,.2);
}
input, label { cursor: pointer; }
input {
width: 34px; height: 34px;
vertical-align: middle;
outline: none;
}
input[type=text],
input[type=email] { width: 100%; }
textarea {
width: 100%;
height: 50px;
}
label {
padding: 3px 8px 5px;
border-radius: 2px;
border: transparent 1px solid;
transition: .5s;
&:hover {
border: rgba(white,.2) 1px solid;
}
}
h3 { font: italic 1em Georgia; }
.flex-ctnr {
display: flex;
justify-content: space-between;
div { margin: 0 .5%; }
}
View Compiled
This Pen doesn't use any external JavaScript resources.