Jump to content

Need CSS property to get checkboxes vertically closer to each other


co.ador

Recommended Posts

I have the following CSS rule for the HTML code below

 

CSS.

.tercero {
    margin-top:1em;
    width:200px;
    height:240px;
    float:right;
    margin-right:1.5em;
    display:inline;
}

.abajo .primero .tercero ol {
    padding: 0.8em 0em 0 1em;
    list-style: none;
    width:100px;
    border-color:#FFFFFF;
font-size:13px;
}

.abajo .primero .tercero ol li {
   margin:0px;
   line-height:0em;
}

.abajo .primero .tercero ol li input{
margin-right:2px;
margin-top:0px;
margin:0;
}




.abajo .primero .tercero .checkboxes23 {
left:4px;
margin:0;
padding:0;


}

 

HTML

 

   <fieldset class="tercero" style="" >
			<legend>Services</legend>
    <ol> <li class="restaurants-offerings-4">
    <input type="checkbox" name="frmSearch[offerings][]" value="4" id="restaurants-offerings-4">
     <span for="restaurants-offerings-4" class="checkboxes23">Buffet</span>

     </li>
<li class="restaurants-offerings-7">
     <input type="checkbox" name="frmSearch[offerings][]" value="7" id="restaurants-offerings-7">
     <span for="restaurants-offerings-7" class="checkboxes23">Catering</span>
      </li>
<li class="restaurants-offerings-1">
   <input type="checkbox" name="frmSearch[offerings][]" value="1" id="restaurants-offerings-1">
   <span for="restaurants-offerings-1" class="checkboxes23">Delivery</span>
   </li>
<li class="restaurants-offerings-2">
  <input type="checkbox" name="frmSearch[offerings][]" value="2" id="restaurants-offerings-2">

  <span for="restaurants-offerings-2" class="checkboxes23">Eat-in</span>
   </li>
<li class="restaurants-offerings-6">
   <input type="checkbox" name="frmSearch[offerings][]" value="6" id="restaurants-offerings-6">
   <span for="restaurants-offerings-6" class="checkboxes23">Parking</span>
    </li>
<li class="restaurants-offerings-5">
<input type="checkbox" name="frmSearch[offerings][]" value="5" id="restaurants-offerings-5">
   <span for="restaurants-offerings-5" class="checkboxes23">TV</span>

</li>
<li class="restaurants-offerings-8">
  <input type="checkbox" name="frmSearch[offerings][]" value="8" id="restaurants-offerings-8">
<span for="restaurants-offerings-8" class="checkboxes23">Takeout</span>
    </li>
<li class="restaurants-offerings-3">
   <input type="checkbox" name="frmSearch[offerings][]" value="3" id="restaurants-offerings-3">
    <span for="restaurants-offerings-3" class="checkboxes23">Wi-Fi</span>
     </li>               
            
            </ol></fieldset>[/left]

 

The thing here is that the <li></li> tags display the checkboxes kind of apart from each other in compared to the Service field in  www.nyhungry.com

that list the Services and CSS the check boxes close to eachother without a big line-height in between.

 

Thank you.

Link to comment
Share on other sites

Three things:

 

1) The link you gave doesn't work.

2) You can move the li tags closer by giving them smaller top/bottom margins. Start with this and work outwards:

 

li
{
  margin-top:0;
  margin-bottom:0;
}

 

3) All your class names seem to be unique names. If this is the case, then you should use IDs for this, not classes. Classes are used for targeting multiple elements with the same classname. IDs are used for targeting individual elements, and IDs must be unique. It will still work the way you are doing it, but it's not good practice.

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.