Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Default leading for paragraphs

Reply
Thread Tools

Default leading for paragraphs

 
 
City Dweller
Guest
Posts: n/a
 
      04-06-2006
Hi all,

Does anyone here know how browsers calculate the leading (vertical distance
between base lines) in a paragrap?

For example, consider this HTML code:

LINE1<P>LINE2

How is the vertical difference between the baselines of LINE1 and LINE2
calculated? I am writing an HTML rendering application and can't figure it
out. Apparently it depends on the font size and metrics, but how exactly?

Thanks in advance.

-- Abe


 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      04-06-2006
"City Dweller" <(E-Mail Removed)> wrote:

> Does anyone here know how browsers calculate the leading (vertical
> distance between base lines) in a paragrap?


_In_ a paragraph?

> For example, consider this HTML code:
>
> LINE1<P>LINE2


It's poor code. The <P> tag is the start tag of a paragraph. Why would you
use it between _lines_?

> How is the vertical difference between the baselines of LINE1 and LINE2
> calculated?


This gets more and more confusing. Such a vertical distance depends on many
factors, but I'm afraid you cannot understand the issue before you understand
the basics of HTML.

> I am writing an HTML rendering application


Oh my.

By the way, what makes you think you should imitate web browsers? They do not
imitate the rendering principles of traditional typography. If you don't want
to just use a web browser (and perhaps tune the rendering with a style
sheet), why don't you start designing a _good_ layout engine? But you'll need
to learn HTML first.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
 
 
 
Toby Inkster
Guest
Posts: n/a
 
      04-06-2006
City Dweller wrote:

> For example, consider this HTML code:
>
> LINE1<P>LINE2


I'd rather consider this code:

<P>Line 1</P>
<P>Line 2</P>

The vertical gap between the two paragraphs is the sum of the lengths of
the following CSS properties as applied to the paragraphs in question:

padding-bottom of the top paragraph
border-bottom of the top paragraph
margin-bottom of the top paragraph
margin-top of the bottom paragraph
border-top of the bottom paragraph
padding-top of the bottom paragraph

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      04-06-2006
To further the education of mankind, "City Dweller" <(E-Mail Removed)>
declaimed:

> Hi all,
>
> Does anyone here know how browsers calculate the leading (vertical
> distance between base lines) in a paragrap?
>
> For example, consider this HTML code:
>
> LINE1<P>LINE2


LINE1 and LINE2 aren't in a (-the same) paragraph...

> How is the vertical difference between the baselines of LINE1 and
> LINE2 calculated? I am writing an HTML rendering application and can't
> figure it out. Apparently it depends on the font size and metrics, but
> how exactly?


Normal vertical line distance can be adjusted by the css line-height
property. I've noticed that the default is not the same in all browsers
(but when I've set it, it _appeared_ to match.)

--
Neredbojias
Infinity can have limits.
 
Reply With Quote
 
Jim Moe
Guest
Posts: n/a
 
      04-06-2006
City Dweller wrote:
>
> Does anyone here know how browsers calculate the leading (vertical distance
> between base lines) in a paragrap?
>

See "10.8.1 Leading and half-leading" of the CSS2 spec.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
 
Reply With Quote
 
City Dweller
Guest
Posts: n/a
 
      04-06-2006
Wow, what an asshole! Thanks for nothing, ****er.

-- Abe


"Jukka K. Korpela" <(E-Mail Removed)> wrote in message
news:Xns979DD261A67F6jkorpelacstutfi@193.229.4.246 ...
> "City Dweller" <(E-Mail Removed)> wrote:
>
>> Does anyone here know how browsers calculate the leading (vertical
>> distance between base lines) in a paragrap?

>
> _In_ a paragraph?
>
>> For example, consider this HTML code:
>>
>> LINE1<P>LINE2

>
> It's poor code. The <P> tag is the start tag of a paragraph. Why would you
> use it between _lines_?
>
>> How is the vertical difference between the baselines of LINE1 and LINE2
>> calculated?

>
> This gets more and more confusing. Such a vertical distance depends on
> many
> factors, but I'm afraid you cannot understand the issue before you
> understand
> the basics of HTML.
>
>> I am writing an HTML rendering application

>
> Oh my.
>
> By the way, what makes you think you should imitate web browsers? They do
> not
> imitate the rendering principles of traditional typography. If you don't
> want
> to just use a web browser (and perhaps tune the rendering with a style
> sheet), why don't you start designing a _good_ layout engine? But you'll
> need
> to learn HTML first.
>
> --
> Yucca, http://www.cs.tut.fi/~jkorpela/
> Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
>
>



 
Reply With Quote
 
City Dweller
Guest
Posts: n/a
 
      04-06-2006
It's easy when CSS is in use, what what if it isn't? All major browsers seem
to agree on a default gap. I am trying to find out what formula they use.

Thanks for responding.

-- Abe

"Toby Inkster" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)5n.co.uk...
> City Dweller wrote:
>
>> For example, consider this HTML code:
>>
>> LINE1<P>LINE2

>
> I'd rather consider this code:
>
> <P>Line 1</P>
> <P>Line 2</P>
>
> The vertical gap between the two paragraphs is the sum of the lengths of
> the following CSS properties as applied to the paragraphs in question:
>
> padding-bottom of the top paragraph
> border-bottom of the top paragraph
> margin-bottom of the top paragraph
> margin-top of the bottom paragraph
> border-top of the bottom paragraph
> padding-top of the bottom paragraph
>
> --
> Toby A Inkster BSc (Hons) ARCS
> Contact Me ~ http://tobyinkster.co.uk/contact
>



 
Reply With Quote
 
City Dweller
Guest
Posts: n/a
 
      04-06-2006
Actually IE and Opera agree remarkably well, so they must use the same rule

-- Abe



"Neredbojias" <http://www.neredbojias.com/fliam.php?cat=alt.html> wrote in
message news:Xns979D72E13CFB1httpwwwneredbojiasco@208.49.8 0.251...
> To further the education of mankind, "City Dweller" <(E-Mail Removed)>
> declaimed:
>
>> Hi all,
>>
>> Does anyone here know how browsers calculate the leading (vertical
>> distance between base lines) in a paragrap?
>>
>> For example, consider this HTML code:
>>
>> LINE1<P>LINE2

>
> LINE1 and LINE2 aren't in a (-the same) paragraph...
>
>> How is the vertical difference between the baselines of LINE1 and
>> LINE2 calculated? I am writing an HTML rendering application and can't
>> figure it out. Apparently it depends on the font size and metrics, but
>> how exactly?

>
> Normal vertical line distance can be adjusted by the css line-height
> property. I've noticed that the default is not the same in all browsers
> (but when I've set it, it _appeared_ to match.)
>
> --
> Neredbojias
> Infinity can have limits.



 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      04-06-2006
City Dweller wrote:

> It's easy when CSS is in use, what what if it isn't? All major browsers
> seem to agree on a default gap. I am trying to find out what formula
> they use.


They use CSS (even if you don't!)

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      04-07-2006
In article <w1fZf.21196$(E-Mail Removed)-nyc.rr.com>,
"City Dweller" <(E-Mail Removed)> wrote:

> Wow, what an asshole! Thanks for nothing, ****er.
>
> -- Abe


Now that is extremely rude, Abe. I want that you should go wash
your mouth out with a strong soap. When you come back, I want
that you should not top post, that you should think about what
Toby Inkster has said, that you should get hold of Firefox, get
its developer extensions and get to see what css is actually
being used in various browsers (as default) and go learn the
Christian religion (I pick this particular one, having studied
very closely your remarks and concluded it would be the best for
you).

--
dorayme
 
Reply With Quote
 
 
 
Reply

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie: css & "removing blank line between paragraphs" Jeff HTML 3 04-13-2010 09:27 AM
All leading tabs or all leading spaces - why isn't that enforced? John Nagle Python 4 08-07-2007 04:05 PM
RE: All leading tabs or all leading spaces - why isn't that enforced? Delaney, Timothy (Tim) Python 0 08-07-2007 03:50 AM
Collapsable paragraphs... Rlrcstr ASP .Net 7 05-17-2005 12:34 AM
"left floated" paragraphs and images using CSS? jersie0 HTML 0 11-23-2003 02:43 AM



Advertisments