Wikia

Harry Potter Wiki

Talk:-

11,885pages on
this wiki

Back to template

Revision as of 16:36, December 3, 2006 by Forerunner (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation

{{-}} contains the markup:

<br clear="all" /><noinclude> {{protected template}} This template "clears" both margins; it is often used before a header to make sure that the header will be the full width of the page. For technical XHTML details see [[Template talk:{{PAGENAME}}]]. [[Category:Templates|{{PAGENAME}}]]

</noinclude>

This causes any previously-established float to clear.

The unusual name of this template is a mnemonic for an imaginary horizontal line, which separates floating elements above from those below. Some editors prefer the mnemonic {{clr}} ("clear"), which simply redirects here.

Usage

{{-}}

Use this template after any floating elements and before elements you do not wish to float together with the first set.

Example

Template:Wrapper (edit talk links history)
starts a table floating right e.g. for an
infobox next to the ToC. For better
examples check out the links. Please
add missing {{-}} where necessary.
 
This ugly table is only a quick example.

First

  • Cute, but less funny if it overlaps the next table or section, causing horizontal scrolling or worse depending on the browser.
Template:Wrapper (edit talk links history)
starts a table floating right e.g. for an
infobox next to the ToC. For better
examples check out the links. Please
add missing {{-}} where necessary.
 
This ugly table is only a quick example.

Second

  • Cute, but
    less funny if it overlaps the next table or section, causing horizontal scrolling or worse depending on the browser.

In the first example {{-}} after the word browser guarantees that the table doesn't float into the second example. In the second example the position of {{-}} should be obvious for visual browsers. Note that it doesn't affect the left margin of the bullet * list, because it's used inside of it.

Template:Wrapper (edit talk links history)
starts a table floating right e.g. for an
infobox next to the ToC. For better
examples check out the links. Please
add missing {{-}} where necessary.
 
This ugly table is only a quick example.

Third

  • Cute, but

less funny if it overlaps the next table or section, causing horizontal scrolling or worse depending on the browser.

Template:Wrapper (edit talk links history)
starts a table floating right e.g. for an
infobox next to the ToC. For better
examples check out the links. Please
add missing {{-}} where necessary.
 
This ugly table is only a quick example.

Fourth

  • Cute, but

less funny if it overlaps the next table or section, causing horizontal scrolling or worse depending on the browser.

The third example has {{-}} after the word browser, and only a new line after the word but. The fourth example has {{-}} and a new line after the word but.

See also

Discussion

Archive: [1]

While it may seem absurd to template this markup, clearing floats is such a common action that this template has proven hugely popular -- over 400 inlinks are shown at time of this writing. This is all the more compelling as so many users substitute the template rather than transclude it, in which case the use is not shown on What links here. — Xiongtalk* 21:51, 2005 August 15 (UTC)

I use this template when pictures hang over the next section just slightly. Deckiller 19:18, 21 January 2006 (UTC)
I would like a version of this that doesn't also insert a line break. Is that implementable? 67.160.10.87 15:36, 9 February 2006 (UTC)
I'm afraid HTML doesn't allow this. Sorry. – Quadell (talk) (bounties) 16:26, 9 February 2006 (UTC)
As per the following discussions maybe {{clear}} does what you want, but certainly not with legacy align="right" or "left" floating. If its dummy <div> isn't allowed where you need it, try to replace it by a dummy <span> - and if that apparently works please report it here, I could check it with my legacy Mozilla 3 monster ;-) Omniplex 04:18, 4 March 2006 (UTC)


Fixed bugs

The old {{subst:-}} expanded into <br style="clear: both" /><tt>.

Inline CSS doesn't work with XHTML BASIC and legacy browsers, the old template didn't have the desired effect there. Please replace old expansions <tt><br style="clear: both" /><tt> by <tt><br clear="all" /><tt>.
Omniplex 18:10, 27 February 2006 (UTC)

So what? Wikipedia does lots of things that older browsers don't support. And the whole point of CSS is that browsers that don't support it will display adequately and not know what they're missing—in this case having a new section start before the bottom of a picture. Unaesthetic, maybe, but there is no content loss and no structural problem. I think you should change it back. /blahedo (t) 03:59, 28 February 2006 (UTC)
So now the page Template:Lw works with my browser, <tt>clear="all" has the required effect. It was completely garbled and unreadable before, dozens of floating infoboxes dragging up the next section. Ignored CSS cannot clear legacy align=right or left. If you're sure to be in a pure CSS context it could be an aesthetical question to use also a pure CSS-clear, but that's not the case for {{-}} as documented, it has to work everywhere. Omniplex 08:18, 28 February 2006 (UTC)
The solution to "this CSS solution doesn't work with old, legacy HTML" should certainly not be "so replace the CSS with more old, legacy HTML", but rather "so let's update the existing old, legacy HTML to CSS". /blahedo (t) 05:50, 1 March 2006 (UTC)
As it is the template works everywhere and generates perfectly valid XHTML transitional. It's almost impossible to replace all {{-}} by <br clear="all"> everywhere manually - just in case, because that's guaranteed to work with all kinds of markup and browsers. In theory a bot could do that. After that global substitution the template and documentation could be updated to say works only for CSS-floating, not legacy floating, with an explanation for normal users what that's supposed to mean for their infoboxes, tables, and other applications of align="right" or "left". Seriously, that can't fly, the template is fine now, and it will take years until all legacy markup requiring a legacy clear vanishes. Omniplex 07:56, 1 March 2006 (UTC)
Maybe we could be redundant and do it both ways. My reading of http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.htm is that
<br clear="all" style="clear:both" />
is legal XHTML, and I believe it would work in older browsers. —Chris Chittleborough 21:11, 25 March 2006 (UTC)
Valid, working, and redundant - the template is quite popular, also available on Meta, mentioned on some project pages, so why transport redundant info, some folks pay by volume. The educational aspect about strict XHTML is covered here. Mixing CSS with legacy markup would still be only valid transitional XHTML. -- Omniplex 23:32, 26 March 2006 (UTC)
You're right. And I agree that we should aim for strict XHTML. —Chris Chittleborough 20:54, 27 March 2006 (UTC)
I disagree. I agree with the separation of presentation from content in general, but the wholesale adoption of XHTML Strict site-wide, or even HTML 4.01 Strict site-wide, would cause features to become unavailable. For instance, W3C deprecated the value attribute of the li element (and removed it entirely from Strict), making it impossible to start an ordered list at any value other than one. For example, it would become impossible to start the listing of tracks on the album Follow the Leadeя by Korn at the correct 13. Until the top two web browsers support CSS counters, we are still in the Transition. --Damian Yerrick () 12:36, 5 October 2006 (UTC)

- versus clear

Why is {{-}} separate from {{clear}}? Doesn't the latter already do what this does? — jdorje (talk) 03:03, 2 March 2006 (UTC)

They are rather different, see previous section. In (X)HTML br is an inline element allowed within other inline elements like span or small, and within block-level elements like p or div. OTOH Template:clear generates <div style="clear: both"></div>, a block level element. Clumsy where that's allowed, and div isn't allowed in many places where br is okay. I've reverted your change. Omniplex 06:40, 2 March 2006 (UTC)
Look at the history of {{clear}}. It was previously a br, and later changed to a div. There are no real situations where you would want to clear in the middle of a paragraph or other inline elements (you usually want to clear just before or just after a block element), and in some obscure situations (which I did encounter) you must use a zero-sized div, because using a br would cause a line break where you don't want it. --cesarb 02:10, 4 March 2006 (UTC)
Quite possible that there are situations where {{clear}} is required, otherwise we could redirect it to this template as it happened with {{clr}}. But they are different for different reasons. (X)HTML <div> allows no legacy clear="all", therefore {{clear}} can't replace {{clr}}. Please add an example of this obscure situation to the {{clear}} docu, curious minds (like me) want to know, e.g. why you didn't use <span> instead of <div>. Omniplex 04:00, 4 March 2006 (UTC)
Well, it's not that obscure, just kind of rare: HTML Tidy moves the br to inside the previous p; if you don't have a p (for instance, between two divs), the result is a new blank line. I did not test with span; using a div always worked fine in all situations, and is exactly what I intended (a zero-sized clearing block element). --cesarb 16:20, 4 March 2006 (UTC)
Got it, you need something that works outside of all block-level elements. Tidy won't let you use inline elements there, if that's not allowed in strict XHTML. I can't tell at the moment, I almost always use transitional XHTML. Tricky, the real problem is the X before {{clear}}, and probably <div> X </div> would be a "cleaner" solution without inline CSS. The same line of arguments also works for {{-}}, they are both kludges. And I'm not up to fixing hundreds of Infoboxes only to get rid of {{-}} on one horrible page... ;-) Omniplex 03:39, 5 March 2006 (UTC)

Using subst for this template

Template:Clear usage says to use subst instead of including it. Why is Template:- not supposed to be substituted? Does the code change on a regular basis? --Squilibob 01:55, 4 May 2006 (UTC)

A code change is unlikely for some years. When all legacy align="right" floating died out - which would be a bad idea at the moment, but this will change - then a legacy clear="all" could be replaced by style="clear: both". And then it could make sense to change the code.
Back to reality, of course you can subst it. It could be also protected, there's nothing that can be improved at the moment. IMHO a wiki source with {{-}} is better readable than <br clear="all" />. Some folks would also try to "improve" the latter, add CSS / replace CSS / remove the space / remove the slash / ..., and any such move would break with different browsers under certain conditions. Therefore propagating {{ subst:- }} could backfire. The users depending on {{-}} as is are minorities, the normal Wiki "self-healing" won't work for a subst'ed and mutilated {{-}}. -- Omniplex 17:51, 4 May 2006 (UTC)
I've protected this as high risk template. — xaosflux Talk 03:17, 11 May 2006 (UTC)

Free advice

And you know what they say about that. ;-) This is certainly a useful template, which I don't dispute. But I have seen it abused as a means of jam-packing more images into an article than are typically needed. If you have one specific place you need this, that's probably all right. If you're using it two or three times in an article, that is probably a sign that you have too many images and should move some to a gallery. Pick the best panorama, and some of the most interesting details, and then stick the rest into the gallery so people only have to load thumbnails. Be a photo editor, not just a copy editor. --Dhartung | Talk 22:11, 9 August 2006 (UTC)

Around Wikia's network

Random Wiki