Skip to content

Instantly share code, notes, and snippets.

@ltackett
Created December 21, 2010 20:52
Show Gist options
  • Select an option

  • Save ltackett/750582 to your computer and use it in GitHub Desktop.

Select an option

Save ltackett/750582 to your computer and use it in GitHub Desktop.
<label for="first_name">First Name</label>
<div class="input text">
<input type="text" id="first_name" />
</div>
<label for="last_name">Last Name</label>
<div class="input text">
<input type="text" id="last_name" />
</div>
<label for="email">Email Address</label>
<div class="input text">
<input type="text" id="email" />
</div>
<div class="input text">
<label for="first_name">First Name</label>
<input type="text" id="first_name" />
</div>
<div class="input text">
<label for="last_name">Last Name</label>
<input type="text" id="last_name" />
</div>
<div class="input text">
<label for="email">Email</label>
<input type="text" id="email" />
</div>
<label for="first_name">First Name</label>
<input type="text" id="first_name" />
<label for="last_name">Last Name</label>
<input type="text" id="last_name" />
<label for="email">Email Address</label>
<input type="text" id="email" />
/* A container to wrap just the text input */
/* ==================================================================================== */
input[type="text"]:container {
background-color: #EEE;
border: 1px solid #999;
padding: 1.5em 1em;
}
/* put both the label and the text input in the same :container using sibling selectors */
/* ==================================================================================== */
label+input[type="text"]:container {
margin-bottom: 0.75em;
padding-bottom: 0.75em;
border-bottom: 1px solid #999;
}
/* now let's wrap the input within the label/input :container in its own :container */
label+input[type="text"]:container input:container {
background-color: #EEE;
border: 1px solid #999;
padding: 1.5em 1em;
}
#header:container {
background-color: #F00;
}
#header {
width: 960px;
margin: 0 auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment