Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 18th, 2005, 10:55 PM
Andrey Tarasevich
Guest
 
Posts: n/a
Default Clearing floats without introducing a new line. How?

Hello

Consider the following HTML code sketch

<div>
<img src="..." style="float: left">
<p>Paragraph text</p>
</div>
<hr>

If the <p> text is short, the <hr> element will be squeezed between the floating
image and the right edge of the viewport. I need the <hr> element to sit below
the bottom edge of the image. According to what I read on the Net, I can easily
achieve that by first clearing the floaters through a <br> element with a
'clear' attribute

<div>
<img src="..." style="float: left" width=... height=...>
<p>Some text</p>
<br clear="all">
</div>
<hr>

This works, but unfortunately the <br> element has an unwanted side effect - it
introduces a line break, i.e. an extra empty line. This is not noticeable when
the height of the <p> paragraph is small. However, once this height gets close
to the height of the image, the extra blank line starts to appear below the
image and above <hr> element. If the paragraph height is greater than the height
of the image the extra vertical space will exist under the bottom of the paragraph.

This is not acceptable in my case. Hence the question: how can I issue a
directive to clear all floaters without taking up any vertical space? Is there a
"zero-height way" to do that?

Best regards,
Andrey

  #2  
Old August 19th, 2005, 01:05 AM
Andrey Tarasevich
Guest
 
Posts: n/a
Default Re: Clearing floats without introducing a new line. How?

Andrey Tarasevich wrote:[color=blue]
> ...[/color]

Problem solved. Instead of using <br> is should've just added 'clear' property
to <hr>.

--
Best regards,
Andrey
  #3  
Old August 19th, 2005, 01:45 AM
Spartanicus
Guest
 
Posts: n/a
Default Re: Clearing floats without introducing a new line. How?

Andrey Tarasevich <andreytarasevich@hotmail.com> wrote:
[color=blue]
>Hello[/color]

Please don't multipost.

--
Spartanicus
 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles