You are here: Re: How to indent a line after <br /> « HTML « IT news, forums, messages
Re: How to indent a line after <br />

Posted by Alan Cole on 03/14/06 15:52

In article <1142343802.575667.201960@i40g2000cwc.googlegroups.com>,
"tintagel" <carey.alan@gmail.com> wrote:

> Hi everyone, I've just joined your group!
>
> I'm pretty new to HTML etc. Here's my problem:
>
> I'm attached to the idea of keeping content separate from formatting
> information, so I like putting content in a .xml document and then
> making a stylesheet for it.
>
> At the moment I'm working on a lot of prose-style text, and having to
> enclose everything in double-sided <xyz></xyz> tags in order to get any
> kind of indentation between blocks is not so convenient. This is
> especially true when formatting dialogue in fiction, where you need
> line breaks and indentation for lots of very short, consecutive lines
> of text.
>
> The approach I'm currently pursuing is to put an emtpy node called <br
> /> in the .xml source where I need a line break, and then use .xsl and
> .css stylesheets to instuct the browser to interpret this as "do a line
> break, but indent the first character of the next line".
>
> The only way to do this that I've currently found is a rather inelegant
> 'cheat' using the zero width non-joiner &zwnj; (&#8204;), thus
> (extracting from the stylesheet):
>
> <xsl:template match="br">
> <br />
> <span id="indent">&zwnj;</span>
> </xsl:template>
>
> where "indent" pads on the left by 1em.
>
> (De-confuser: the matched "br" is the empty node that lives in the .xml
> source.)
>
> This works o.k., and doesn't upset the "text-align: justify" which is
> in effect throughout the document (and which for example, if I
> substitute the <span></span> expression with &emsp, leaves the indented
> text misaligned as the space character is factored into the
> justification). I guess it's an o.k. work-around, but it's still a
> misuse of an entity (&zwnj;), which can't be good practice and leaves a
> bitter taste in the mouth.
>
> Is there a way of achieving the same result in a more concrete manner
> using CSS? Or is there a safer 'placeholder entity' I can use instead
> of &zwnj; to put inside the <span> so it actually indents the following
> character? A crucial consideration here seems to be the justified text,
> and how to avoid mucking it up.
>
> I'd really appreciate any advice on this!
>
> Best wishes,
>
> T.

I'm probably missing something here, but wouldn't it be simpler to
replace the <br />tag with </p><p> and then simply indent the first line
of the paragraph??

Al.

--
Alan Cole. E-mail: justal at lineone dot net
http://www.forces-of-nature.co.uk [Coastal Sports]
http://www.pixelwave.co.uk [Website Design, hosting and promotion]

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация