473,799 Members | 3,224 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Aug 18 '05 #1
2 2298
Andrey Tarasevich wrote:
...


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

--
Best regards,
Andrey
Aug 19 '05 #2
Andrey Tarasevich <an************ **@hotmail.com> wrote:
Hello


Please don't multipost.

--
Spartanicus
Aug 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5033
by: Charles Blaquière | last post by:
While noodling around, looking for a good layout for an "events calendar" page, I came upon a problem that has me stymied. Have a look at http://kpuc.org/events/upcoming-2.html . The basic structure of each event is: Event div Left-floated image Event header div
18
8089
by: Niels | last post by:
Hi group, I have some problems with clearing floated divs. My usual method works fine in Konqueror, but not in Firefox. Here's an example: <html><body> <div id='left' style='float:left; border:1px solid red;'>Floated left</div> <div id='right' style='float:right; border:1px solid blue;'>Floated right</div>
6
3643
by: Michael Rozdoba | last post by:
I want to set a background colour on one level of headings, but have their width span only the text & a small amount of padding. I was styling display to inline to achieve this. Then I realised I need to have clear: left, to keep the headings against the lefthand side, should they come near floats. I can't see how to do this without having to introduce unpleasant extra markup.
4
2405
by: LB | last post by:
Apologies if this sounds like a very newbie question. I'm putting together a 3 column layout at the moment, the left 2 columns are effectively menus and the third one is the 'content'. Now, the content within the third column is brought in via a database, and the problem I'm having is if an image file is 'taller' than the text, the following article also wraps around the image. What I would like to do is have that article, and its...
0
1342
by: U S Contractors Offering Service A Non-profit | last post by:
" I saw your report " Tom Cruise " I liked it Look at this one if you will..." Inbox U S Contractors Offering Service A Non-profit More options 3:50 pm (9 minutes ago) " I saw your report " Tom Cruise " I liked it Look at this one if you will..." U S Contractors Offering Service A Non-profit <csomerford@gmail.com> Wed, Oct 18, 2006 at 1:56 PM
2
2043
by: listerofsmeg01 | last post by:
I have the following code to align some form controls: <style type="text/css"> ..label {float:left; width:50%} ..input {width:40%} </style> <div> <div class="label">Enter your username:</div> <input type="text" name="username"/> </div>
13
2344
by: yb | last post by:
Hi, Is there a CSS method to clear a float such that it aligns with the left content edge. For example: X X X X X X X X
6
2757
by: Hendrik Maryns | last post by:
Hi, There is a little problem with the header on the page I recently converted from frames to proper HTML+CSS. The top part with the navigation used to be the top frame but is now included via SSI. On a broad screen, it looks good, but if you make the viewport small, the slogan text in the middle overlaps with the navigation buttons. http://www.weltladen-tuebingen.de/
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9538
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10470
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10247
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10214
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7561
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5459
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2935
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.