Jump to content

Having trouble styling radio buttons and check boxes


raydona

Recommended Posts

Hi,

I am having trouble styling the radio buttons and check boxes on this form.

I want to reduce the gap between the label Sex and the radio buttons so that

the buttons sit underneath 'T' in IT, also wish to reduce the gaps between the buttons and the words Male and Female.

I wish to do the same for the check boxes.

Would be very grateful for your help.

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Temporary</title>
<style type="text/css">
body
{  margin: 0; 
   padding:0; 
}
p
{  margin: 0 0 10px 0;
   padding:0;
}
form
{  font: 13px Georgia, "Times New Roman", Times, serif;
   background: #eee;
   margin: 20px;
   padding: 10px 20px;
   width: 330px;
}
form ol
{  list-style: none;
   margin: 0;
   padding: 0;
}
form li
{  padding: 6px;
   background: #e1e1e1;
   margin-bottom: 1px;
}
form label
{  float: left;
   width: 70px;
   text-align: right;	
   margin-right: 7px;
   color: #0066CC;
   line-height: 23px;
}
form input
{  padding: 4px;
   font: 13px Georgia, "Times New Roman", Times, serif;
   border: 1px solid #999999;
   width: 200px;
}
form input:focus
{  border: 1px solid #666;
   background: #e3f1f1;
}
</style>
</head>

<body>

  <form>

    <p>Upload your educational and employment details:</p>

      <ol>
        
        <li>
        	<label for="name">Name</label>
        	<input type="text" name="name" id="name" />
        </li>
        
        <li>
        	<label for="email">Email</label>
        	<input type="text" name="email" id="email" />
        </li>
        
        <li>
        	<label for="jobs">Job Sought</label>
                <select name="jobs">
                  <option value="clerical">Clerical</option>
                  <option value="teaching">Teaching</option>
                  <option value="computer" selected="selected">IT</option>
                  <option value="driver">Driver</option>
                  <option value="building">Construction</option>
                </select>
        </li>
        
        <li>
        	<label for="sex">Sex</label>
                <input type="radio" name="sex" value="male" /> Male<br />
                <input type="radio" name="sex" value="female" /> Female
        </li>

        <li>
        	<label for="education">Education</label>
                <input type="checkbox" name="education" 
                       value="school" /> Secondary School<br />
                <input type="checkbox" name="education" 
                       value="college" /> Further Education College<br />
                <input type="checkbox" name="education" 
                       value="university" /> Higher Education
        </li>

      </ol>

    </form>

</body>
</html>

Link to comment
Share on other sites

 

In your css you have:

form input
{  padding: 4px;
   font: 13px Georgia, "Times New Roman", Times, serif;
   border: 1px solid #999999;
   width: 200px;
}

 

Take the width off there. But then you are left with some of the inputs and labels dropping down a line... which i'm guessing is what you were trying to fix to start with...

 

To get all the labels in one column and the other stuff in another you will need to either nest lists within you existing lists, or just use a table.. as what your trying to do is layout you stuff in a table fashion..

 

<table>
            <tr>
                <td class="label">Name</td>
                <td class="inputs"><input type="text" name="name" id="name" /></td>
            </tr>
            
            ... etc etc

 

 

Now just style accordingly with your css

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.