gist: 1794 Download_button fork
public
Description:
Trying to get a columnar list with CSS
Public Clone URL: git://gist.github.com/1794.git
test.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
form label {
  display: inline-block;
  line-height: 1.8;
  vertical-align: top;
  width: 11em; }
  form label.required:after {
    content: "*";
    color: red; }
form fieldset {
  margin-bottom: 10px;
  border: none; }
  form fieldset legend {
    padding: 0 0.4em 0.2em 0;
    font-weight: bold; }
  form fieldset ol {
    margin: 0;
    padding: 0; }
    
    /* This is the part I need help with */
    /* Switched to floats, thanks Tom */
    form fieldset ol.columned li {
      float: left;
    }
      form fieldset ol.columned li label {
        width: 6em;
      }
    
    /* This works in Opera and Safari */
    form fieldset ol.columned li:nth-child(3n+1) {
      clear: left;
      padding-right: 0;
    }
    form fieldset ol.columned li:last-child {
      clear: left;
    }
      form fieldset ol.columned li:last-child label {
        width: 11em;
        text-align: left;
      }
    /* End area need help with */
    
    form fieldset ol li {
      list-style: none;
      padding: 5px;
      margin: 0; }
form input {
  font-size: 1em;
  padding: 0.2em; }
  form input[type=text], form input[type=password], form input[type=checkbox] {
    border: 1px solid #555555; }
  form input[type=radio] {
    vertical-align: top; }
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
  <title>Form Test</title>
  <link href="test.css" type="text/css" />
</head>
<body>
 
<form action="#" method="get">
  <fieldset>
    <legend>Type of Animal</legend>
    <ol class='columned'>
      <li>
        <label for="animal_anteater">Anteater</label>
        <input id="animal_anteater" name="animal" type="radio" value="anteater" />
      </li>
      <li>
        <label for="animal_cat">Cat</label>
        <input id="animal_cat" name="animal" type="radio" value="cat" />
      </li>
      <li>
        <label for="animal_dog">Dog</label>
        <input id="animal_dog" name="animal" type="radio" value="dog" />
      </li>
      <li>
        <label for="animal_emu">Emu</label>
        <input id="animal_emu" name="animal" type="radio" value="emu" />
      </li>
      <li>
        <label for="animal_gecko">Gecko</label>
        <input id="animal_gecko" name="animal" type="radio" value="gecko" />
      </li>
      <li>
        <label for="animal_rabbit">Rabbit</label>
        <input id="animal_rabbit" name="animal" type="radio" value="rabbit" />
      </li>
      <li>
        <label for="animal_ram">Ram</label>
        <input id="animal_ram" name="animal" type="radio" value="ram" />
      </li>
      <li>
        <label for="animal_salamander">Salamander</label>
        <input id="animal_salamander" name="animal" type="radio" value="salamander" />
      </li>
      <li>
        <label for="animal">Not listed?</label>
        <input id="animal" name="animal" size="10" type="text" />
      </li>
    </ol>
  </fieldset>
  <p>
    <input type="submit" name="commit" value="Save" id="commit"/>
  </p>
</form>
</body>
</html>

Owner

geoffgarside

Revisions