Inline label : label « Form « HTML / CSS






Inline label

   

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
.states label {
  display:inline-block;
  width:24.5%;/* rounding error */
  margin:0;
  padding:0;
  white-space:nowrap;
}
html>body label{display:inline;float:left}
p {  white-space:nowrap;margin:0 0 1em 0;padding:0}

</style>
</head>
<body>
<div class="states">
<p>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
</p>

<p>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>

  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
</p>

<p>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>

  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
</p>

<p>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>

  <label for="al"><input id="al" name="al" type="checkbox" value="Y">A</label>
</p>
</div>

</body>
</html>

   
    
  








Related examples in the same category

1.'label' creates a label and associates it with another element
2.label:after
3.Using the label for element
4.Set style for form label
5.Set font for label
6.Use different font for label and other form controls
7.Set margin-top and display style for label
8.Set label control for right text alignment, padding right 20px
9.Set label after style
10.Set color, background color and font for a label control
11.Set Label padding and text transformation
12.Set label font family and font size
13.Label style text-align: right
14.label background-color: pink;
15.label color: black;
16.label font-weight: bold;
17.label padding: 4px;
18.label text-transform: uppercase;
19.label font-family: Verdana, Arial, Helvetica, sans-serif;
20.label font-size: xx-small;
21.Positioning labels
22.Label above
23.label display: block;
24.label font-weight:bold;
25.label margin:5px 0;
26.label font-weight:bold;
27.label font-family: "Trebuchet MS", Verdana, Halvetica, Arial;
28.label font-size: 12px;
29.label color: #040507;
30.label display: block;
31.label text-align: right;
32.label width: 100px;
33.Adding underline for labels
34.Place label on the top of a field
35.label text-align: left; text-align: center;
36.Labelled fields
37.Using the label element
38.Implicit labels
39.label float:left; width:100px;
40.Fieldsets and labels
41.Aligning labels with List
42.Block-level labels
43.Top-positioned Text Labels
44.Left-aligned Text Labels