Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for select, radio and checkbox #19

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions concrete.css
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ input[type="text"],
input[type="url"],
textarea,
select {
-webkit-appearance: none; /* 1 */
-moz-appearance: none; /* 1 */
appearance: none; /* 1 */
box-shadow: none; /* 1 */
box-sizing: inherit; /* 1 */
Expand All @@ -254,15 +252,50 @@ select {
background-color: var(--bg); /* 2 */
border: .1rem solid var(--fg); /* 2 */
border-radius: 0; /* 2 */
font-family: Helvetica, Arial, sans-serif; /* 3 */
}

/**
* Set margin for form elements.
* Set margin and font-family for form elements.
*/

fieldset, input, select, textarea {
margin: 0 0 .8rem 0;
font-family: Helvetica, Arial, sans-serif;
}

select:not([multiple]) {
background-image: linear-gradient(90deg, transparent 50%, var(--fg) 50%),
linear-gradient(90deg, var(--fg) 50%, transparent 50%);
background-position: calc(100% - .8rem), calc(100% - .8rem);
background-size: .8rem .8rem, .8rem .8rem;
background-repeat: no-repeat;
}

input[type="checkbox"] + label, input[type="radio"] + label {
display: inline-block;
margin-bottom: .4rem;
}

label + label {
padding-top: .4rem;
}

input[type="radio"], input[type="checkbox"] {
appearance: none;
margin: -.1rem .2rem 0rem .2rem;
display: inline-block;
width: .8rem;
height: .8rem;
border-radius: 0%;
border: .1rem solid var(--fg);
}

input[type="radio"] {
border-radius: 100%;
}

input[type="radio"]:checked, input[type="checkbox"]:checked {
background-color: var(--fg);
}

/**
Expand Down Expand Up @@ -370,8 +403,6 @@ pre > code {
*/

progress {
-moz-appearance: none; /* 1 */
-webkit-appearance: none; /* 1 */
display: block; /* 1 */
height: .5rem; /* 1 */
overflow: hidden; /* 1 */
Expand Down
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ <h2>Forms</h2>
<form>
<fieldset>
<legend>Please enter your information</legend>

<div class="row">
<div class="column">
<label for="firstname">First Name</label>
Expand All @@ -225,13 +226,29 @@ <h2>Forms</h2>
<input type="text" name="lastname" id="lastname">
</div>
</div>

<label for="os">Operating System</label>
<select name="os" id="os">
<option value="GNU/Linux">GNU/Linux</option>
<option value="MacOS">MacOS</option>
<option value="Windows">Windows</option>
<option value="Other">Other</option>
</select>

<label>Browser</label>
<input type="radio" id="firefox" name="browser" value="F">
<label for="firefox">Firefox</label><br/>
<input type="radio" id="chrome" name="browser" value="C">
<label for="chrome">Chrome</label><br/>
<input type="radio" id="safari" name="browser" value="S">
<label for="safari">Safari</label><br/>
<input type="radio" id="other" name="browser" value="O">
<label for="other">Other</label>

<label>Do you agree?</label>
<input type="checkbox" id="chbx" name="agree" value="Yes!">
<label for="chbx">I agree</label>

<label for="comment">Comment</label>
<textarea name="comment" id="comment" placeholder="Please leave a comment..."></textarea>
<input type="submit" value="Send">
Expand Down