prevent line break after a checkbox

This is a discussion on "prevent line break after a checkbox" within the Web Page Design section. This forum, and the thread "prevent line break after a checkbox are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jan 10th, 2008, 12:24
Junior Member
Join Date: Oct 2007
Location: Holland
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
prevent line break after a checkbox

hi,

I have a few checkboxes in a column, with some text next to each one.
However, when the text is a little longer than the division, Firefox and IE show different behavior:
- in FF the whole line goes on a new line, which is ugly
- in IE the line breaks after the first word, and this looks nice

Can you tell me how to keep (at least) the first word always next to the checkbox...

Thanks in advance!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jan 10th, 2008, 12:46
Aso's Avatar
Aso Aso is offline
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,340
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
Re: prevent line break after a checkbox

Is it possible to post your code or a link to it?

It sounds like this is simply down to how IE and FF handle line wraps. Try wrapping the text in an element, and style that element to a set width.
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jan 10th, 2008, 14:13
Junior Member
Join Date: Oct 2007
Location: Holland
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: prevent line break after a checkbox

Code: Select all
<ul class="class1">
   <li>
      <strong>Title</strong>
      <ul>
          <li>
              <label><input class="chbox" type="checkbox" /></label>
              <span>First Second</span>
          </li>
      </ul>
   </li>
</ul>
so, in FF the "First Second" text goes together on the line following the checkbox
Here is my .css:

Code: Select all
 .chbox{
    float:left;
    margin:0;
    padding:0;
    height:15px;
    width:15px;
}

class1 {
    float:left;
    margin-left:5px;
    padding:0;
    width:218px;
}

ul.class1 li{
    float:left;
    margin:0 38px 0 0;
    padding:0 0 15px;
    display:inline;
    width:90px;
    list-style:none;
}
ul.class1 li strong{
    text-align:left;
    margin:0;
    padding:0;
    
}
ul.class1 li ul{
    float:left;
    margin:5px 0 0;
    padding:0;
    width:90px;
}
ul.class1 li ul li{
    text-align: left;
    float:left;
    margin:0;
    padding:0 0 4px;
}
ul.class1 li ul li span{
    float:left;
    margin:0 0 0 5px;
    display:inline;
    font:1.2em/1.2em Arial;
    color:black;
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jan 10th, 2008, 18:15
Reputable Member
Join Date: Jun 2007
Location: uk
Posts: 459
Thanks: 0
Thanked 0 Times in 0 Posts
Re: prevent line break after a checkbox

could you try something like this.

HTML: Select all
  <input class="chbox" type="checkbox" />
              <label>First Second</label>
then add this to your css.

HTML: Select all
 label {
display:block;
font-weight: bold;
display:inline;

}
it may work, it may not.

Pat
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jan 11th, 2008, 01:05
Junior Member
Join Date: Oct 2007
Location: Holland
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: prevent line break after a checkbox

hmm, it didn't work for me.
But why do you write display:.... twice ?!?!?!

I'm already wondering if my problem can be solved in FF at all.
Take a look at this discussion: http://www.webmasterworld.com/forum119/223.htm
...it doesn't seem very optimistic.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Jan 11th, 2008, 10:59
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Re: prevent line break after a checkbox

One of these should sort you out:
<input type="checkbox" style="display:inline"/> Label

OR

<input type="checkbox" style="float:left"/> Label
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Feb 6th, 2008, 05:34
New Member
Join Date: Feb 2008
Location: Seattle
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: prevent line break after a checkbox

Wrap the checkbox INPUT element and the text you want on the same line as the checkbox (perhaps just the first word) in a SPAN with STYLE="white-space:nowrap"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Feb 6th, 2008, 09:34
Junior Member
Join Date: Oct 2007
Location: Holland
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: prevent line break after a checkbox



thanks for the advice. I already solved this issue. Don't remember exactly what I did, some tweaks to make both browsers happy....

cheers!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[solved] I want to insert a line break minute44 PHP Forum 4 Feb 20th, 2008 12:52
Fwrite with new line break problem? meth8200 PHP Forum 2 Feb 4th, 2008 15:23
Line Break DregondRahl Web Page Design 6 Jun 12th, 2007 15:33
prevent refresh in asp simonneaves Classic ASP 2 Oct 10th, 2005 09:04
<div> function without the line break Tim356 Web Page Design 10 Sep 27th, 2004 18:39


All times are GMT. The time now is 12:15.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

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