473,796 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what is the best way to continue flow?

after using float, I know it is needed to continue the flow if we want
the enclosing div to include the whole thing (with the obj being
floated)... so i know of

<br style="clear: both" />

or

<div style="clear: both" />

and some even say it is best to

<div style="clear: both; height: 1px" />

is there a standard way to do it, especially with all the browsers
being different?

Jun 19 '07 #1
5 2179
Scripsit Su************@ gmail.com:
after using float, I know it is needed to continue the flow if we want
the enclosing div to include the whole thing (with the obj being
floated)... so i know of

<br style="clear: both" />
Apart from the pointless XMLism, the slash, that's usually acceptable. On
the other hand, if you want to use <brto stop floating, you could just as
well use <br clear="all">. And on the third hand, you could do the logical
thing and assign clear: both to the first element after the elements that
you float. After all, there's really no need to introduce artificial
markup - except in rare cases where some external force prevents you from
knowing what comes next (e.g., the floated stuff is a fragment of code that
is included in different contexts on different pages).
<div style="clear: both" />
That's a pointless risk, since the XMLism _should not_ (by XML specs) be
used for elements other than those with EMPTY declared content, in any
context where the document might be processed by XML-ignorant software
(effectively, legacy web browsers and relatives).
and some even say it is best to

<div style="clear: both; height: 1px" />
That's even worse, even though the extra 1px vertical spacing probably
doesn't cause a catastrophe.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 19 '07 #2
On 19 Jun, 06:07, Summercooln...@ gmail.com wrote:
after using float, I know it is needed to continue the flow if we want
the enclosing div to include the whole thing (with the obj being
floated)... so i know of

<br style="clear: both" />
<bris inline rather than block, so it's really the wrong element to
use here. Personally I use <hr>, and with CSS to either hide it, or to
make it into a decorative fleuron. You can use <divinstead though
(or <p>, or almost anything, with varying levels of semantic
appropriateness )

If you do this

<body>
<div>...</div>
<br>
<div>...</div>
</body>

That's actually invalid in a Strict doctype.

<div style="clear: both" />
As a totally separate issue, you're now concerned about XHTML empty
elements.

This is reasonable for XHTML as pure-XML, but that's not a good idea
for web use and you should be using Appendix C XHTML instead -- or
else just HTML 4 and not XHTML at all.

An empty <brelement should be <br /in XHTML Appendix C, as should
other tags that are defined as EMPTY in the HTML DTD (i.e. <hr>)

An empty <div></divelement should be <div></divin XHTML Appendix
C, as should other tags that aren't defined as empty (i.e. <div>,
<span>, <petc.)
<div style="clear: both; height: 1px" />
Clear is clear, there's no need (AFAIK) to have a non-zero height. If
there's some obscure case where this is useful, perhaps someone could
cite a clear instance.
Jun 19 '07 #3
On 2007-06-19, Andy Dingley <di*****@codesm iths.comwrote:
On 19 Jun, 06:07, Summercooln...@ gmail.com wrote:
>after using float, I know it is needed to continue the flow if we want
the enclosing div to include the whole thing (with the obj being
floated)... so i know of

<br style="clear: both" />

<bris inline rather than block, so it's really the wrong element to
use here.
Yes, exactly, and technically speaking browsers should ignore
'style="clear: both"' on <brunless you also change it to display:
block. But none of them do, they all treat it as equivalent to <br
clear="all">
Jun 19 '07 #4
On 19 Jun, 12:51, Ben C <spams...@spam. eggswrote:
<bris inline rather than block, so it's really the wrong element to
use here.

Yes, exactly, and technically speaking browsers should ignore
'style="clear: both"' on <brunless you also change it to display:
block.
That's CSS 2.* behaviour. In CSS 1 it was applicable to all elements.
It's still discussed in CSS 2.1 in terms of how a renderer might
choose to process it, should it be encountered on an inline element
(i.e. they don't advise setting it when authoring inlines, but (for
backwards compatibility) they suggest not simply ignoring it as
inapplicable)

Jun 19 '07 #5
Also sprach Su************@ gmail.com:

[Force an element to enclose all its floated children]
<br style="clear: both" />
is there a standard way to do it, especially with all the browsers
being different?
Here's what I do:

HTML:
....
<head>
...
<link rel="stylesheet " href="common.cs s">
<!-- The following is a "conditiona l comment" - M$ proprietary stuff -
will be read by IE only -->
<!--[if IE]><link rel="stylesheet " href="ie.css">< ![endif]-->
</head>
<body>
...
<div class="enclose" ... Floated content ... </div>
...
</body>
....
common.css:
....

/*
For standards compliant browsers supporting the "content" property (IE
doesn't):
Insert a dot "." at the end of the container and style it so that it is
invisible and clears the float.
*/

..enclose:after
{
display: block;
content: ".";
height: 0;
visibility: hidden;
clear: both;
}
....
ie.css:
....

/*
IE doesn't support the "content" property, but encloses everything if the
container has a proprietary internal property called "layout" which it can
gain either by setting an explicit height or using the - proprietary - zoom
property. As IE handles height as min-height (which in turn it doesn't
support), the container will still expand to hold all its contents even if
height is set to 1px. IE7, however, seems to implement height correctly, so
that cannot be used for this browser version. "zoom", on the other hand, is
not supported by IE5.0. So we set both and set height back to "auto" for IE
browsers 5 (IE5.0 will choke on the backslash character in he\ight thus
ignoring the auto value and retaining the 1px).
*/

..enclose
{
height: 1px;
he\ight: auto;
zoom: 1;
}
....
Greetings,
Thomas
Jun 19 '07 #6

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

Similar topics

5
2543
by: Ann | last post by:
I have trouble sometimes figuring out where break and continue go to. Is there some easy way to figure it out, or a tool? TIA Ann
125
14860
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
1
4671
by: ori | last post by:
Hi, I'm facing a problem when trying to continue normal execution flow within a HttpHandler ProcessRequest method. In my application we currently have a custom HttpHandler registered which validates a user against some Authentication method and then allows him to continue his request if successfully authenticated or denies him access if not. We use a handler to do this authentication and we'd like to continue normal execution if...
669
26240
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10465
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
10242
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...
0
10021
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...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6800
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5453
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...
1
4127
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2931
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.