Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Re: float moan

Reply
Thread Tools

Re: float moan

 
 
Gus Richter
Guest
Posts: n/a
 
      04-20-2012
On 4/20/2012 11:20 AM, Tim Streater wrote:
> I wanted to have a fixed size scrollable area within a table cell, and
> googling threw this up:
>
>
> .scrollarea
> {
> width: 300px; height: 276px;
> padding-left: 5px;
> padding-right: 5px; border-color: #6699CC;
> border-width: 1px; border-style: solid;
> float: left; overflow: auto;
> }
>
> I use it like this:
>
> <tr id='glist'>
>
> <td style="vertical-align: top; padding-right: 15px;">Group List:</td>
>
> <td style="vertical-align: top; background-color: #F0F0FF; padding:
> 3px;"><span class='scrollarea' id='group_list'></span></td>
>
> </tr>
>
>
> It's unlikely I could have come up with the scrollarea class by myself,
> but it seems to do the job I wanted it to: a fixed area within a table
> cell that I can write stuff into and which will have a vertical scroll
> bar when necessary.
>
> However I am at a loss to understand what the float:left does other than
> make it work. I tried removing it and the <span> content overflowed the
> table cell, and every line of the content appeared to be underlined or
> possibly have a border. Why does the float have this effect?



Because of the SPAN the scrollarea is inline, the border is around the
inline text and inline does not take dimension properties, therefore the
width and height are ignored and the scrollarea extends to the end of
the viewport.
Adding the float property turns the scrollarea into a block which then
takes the dimension properties and places the border around it.

I would do it with a DIV instead of SPAN and the float would not be
needed at all.

--
Gus

 
Reply With Quote
 
 
 
 
Tim Streater
Guest
Posts: n/a
 
      04-20-2012
In article <jms406$219$(E-Mail Removed)>,
Gus Richter <(E-Mail Removed)> wrote:

> On 4/20/2012 11:20 AM, Tim Streater wrote:


> > However I am at a loss to understand what the float:left does other than
> > make it work. I tried removing it and the <span> content overflowed the
> > table cell, and every line of the content appeared to be underlined or
> > possibly have a border. Why does the float have this effect?

>
> Because of the SPAN the scrollarea is inline, the border is around the
> inline text and inline does not take dimension properties, therefore the
> width and height are ignored and the scrollarea extends to the end of
> the viewport.
> Adding the float property turns the scrollarea into a block which then
> takes the dimension properties and places the border around it.
>
> I would do it with a DIV instead of SPAN and the float would not be
> needed at all.


OK. I did think about <div> but assumed I couldn't put one inside a
table cell. Thanks again.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      04-20-2012
Tim Streater wrote:
> In article <jms406$219$(E-Mail Removed)>,
> Gus Richter <(E-Mail Removed)> wrote:
>
>> On 4/20/2012 11:20 AM, Tim Streater wrote:

>
>> > However I am at a loss to understand what the float:left does other

>> than
>> > make it work. I tried removing it and the <span> content overflowed the
>> > table cell, and every line of the content appeared to be underlined or
>> > possibly have a border. Why does the float have this effect?

>>
>> Because of the SPAN the scrollarea is inline, the border is around the
>> inline text and inline does not take dimension properties, therefore
>> the width and height are ignored and the scrollarea extends to the end
>> of the viewport.
>> Adding the float property turns the scrollarea into a block which then
>> takes the dimension properties and places the border around it.
>>
>> I would do it with a DIV instead of SPAN and the float would not be
>> needed at all.

>
> OK. I did think about <div> but assumed I couldn't put one inside a
> table cell. Thanks again.
>


Well if you are in doubt you can always look it up:

"<!ELEMENT (TH|TD) - O (%flow* -- table header cell, table data
cell-->"

<http://www.w3.org/TR/html401/struct/tables.html#edef-TD>

A TD element can contain "flow" elements and if you click flow

"<!ENTITY % flow "%block; | %inline;">"

<http://www.w3.org/TR/html401/sgml/dtd.html#flow>

So in can house both inline AND block elements. So yes, a TD can have a
DIV inside...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Tim Streater
Guest
Posts: n/a
 
      04-20-2012
In article <jmsfe7$b5k$(E-Mail Removed)>,
"Jonathan N. Little" <(E-Mail Removed)> wrote:

> Tim Streater wrote:
> > In article <jms406$219$(E-Mail Removed)>,
> > Gus Richter <(E-Mail Removed)> wrote:
> >
> >> On 4/20/2012 11:20 AM, Tim Streater wrote:

> >
> >> > However I am at a loss to understand what the float:left does other
> >> than
> >> > make it work. I tried removing it and the <span> content overflowed the
> >> > table cell, and every line of the content appeared to be underlined or
> >> > possibly have a border. Why does the float have this effect?
> >>
> >> Because of the SPAN the scrollarea is inline, the border is around the
> >> inline text and inline does not take dimension properties, therefore
> >> the width and height are ignored and the scrollarea extends to the end
> >> of the viewport.
> >> Adding the float property turns the scrollarea into a block which then
> >> takes the dimension properties and places the border around it.
> >>
> >> I would do it with a DIV instead of SPAN and the float would not be
> >> needed at all.

> >
> > OK. I did think about <div> but assumed I couldn't put one inside a
> > table cell. Thanks again.
> >

>
> Well if you are in doubt you can always look it up:


Trouble was I wasn't in doubt in that particular instance although I
am most of the time so I do, in fact, look a lot of stuff up.

> "<!ELEMENT (TH|TD) - O (%flow* -- table header cell, table data
> cell-->"
>
> <http://www.w3.org/TR/html401/struct/tables.html#edef-TD>
>
> A TD element can contain "flow" elements and if you click flow
>
> "<!ENTITY % flow "%block; | %inline;">"
>
> <http://www.w3.org/TR/html401/sgml/dtd.html#flow>
>
> So in can house both inline AND block elements. So yes, a TD can have a
> DIV inside...


Yes - thanks - and now I have. That has to be the easiest change I've
ever made to simplify things with no untoward effects. Change the span
to a div and remove the float. Result - no change.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      04-20-2012
In article <jmsfe7$b5k$(E-Mail Removed)>,
"Jonathan N. Little" <(E-Mail Removed)> wrote:

> a TD can have a
> DIV inside...


Indeed. A TD is like a dog that will eat anything at all, even
something that looks for all the world like it's grandma.

<table><tr><td><table>...</table></td> ...

--
dorayme
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      04-20-2012
In article <(E-Mail Removed)>,
Tim Streater <(E-Mail Removed)> wrote:

> Yes - thanks - and now I have. That has to be the easiest change I've
> ever made to simplify things with no untoward effects. Change the span
> to a div and remove the float. Result - no change.


I agree with your decision to use a DIV but mainly, in this case,
because it then requires no styling by you with respect to the display
property. Generally easier work practice to not do something than to
do something.

A DIV has a default style of 'display: block'. You are relying on the
default provided by others (the browser maker). It is not part of its
nature in these modern times. A SPAN, on the other hand has a default
of 'display: inline', also not part of its nature really.

DIVs and SPANs, in fact, have an almost deliberate lack of nature.
They are the taxis, they will take anyone anywhere, they have no wills
of their own, no desires, they are really quite contemptible. I use
them all the time and laugh!

They are not even as natureful as most shop window dummies, these have
a sex at least. You can verify this you know. By lurking about these
windows after seasonal fashions end to catch the moment before the
next.

--
dorayme
 
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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: float moan dorayme HTML 9 04-22-2012 12:04 AM
float to string to float, with first float == second float Carsten Fuchs C++ 45 10-08-2009 09:47 AM
where's Firefox 1.5 for British-English ? ( whinge, moan, whinge) falsename Firefox 13 12-07-2005 11:58 AM
test...don't moan!! fredcromer Computer Support 5 04-29-2004 11:33 PM
Re: float->byte->float is same with original float image. why float->ubyte->float is different??? bd C Programming 0 07-07-2003 12:09 AM



Advertisments