HighDots Forums  

How to set line height in a paragraph (line-height not working)

HTML Writing HTML for the Web (comp.infosystems.www.authoring.html)


Discuss How to set line height in a paragraph (line-height not working) in the HTML forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Test
 
Posts: n/a

Default How to set line height in a paragraph (line-height not working) - 11-04-2009 , 03:16 AM






I usualle set line height something like below

<p style="line-height: 12px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras varius imperdiet
nunc. Donec eu nibh a odio sodales viverra et non purus.
</p>

It works ok.

But if I have an image the line height is the images height.

<p style="line-height: 12px;">
Lorem ipsum dolor sit amet, <img src="test.jpg">. Cras varius imperdiet nunc.
Donec eu nibh a odio sodales viverra et non purus.
</p>

My "test.img" is higher than 12px and causes the line height to expand.

What can I do?

Reply With Quote
  #2  
Old   
dorayme
 
Posts: n/a

Default Re: How to set line height in a paragraph (line-height not working) - 11-04-2009 , 04:05 AM






In article <lod2f5t8ofoej6vmjsac16q5gtbh1isoum (AT) 4ax (DOT) com>,
Test <test@.nil.invalid.com> wrote:

Quote:
I usualle set line height something like below

It is a bad idea for a number of reasons.

Quote:
p style="line-height: 12px;"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras varius imperdiet
nunc. Donec eu nibh a odio sodales viverra et non purus.
/p

It works ok.

How can it work if the line height really was 12px but the user ups his
text to 16 or 18px or more?

Quote:
But if I have an image the line height is the images height.

Just as if you were to stick in a big letter.

Quote:
p style="line-height: 12px;"
Lorem ipsum dolor sit amet, <img src="test.jpg">. Cras varius imperdiet nunc.
Donec eu nibh a odio sodales viverra et non purus.
/p

My "test.img" is higher than 12px and causes the line height to expand.

What can I do?
If God Himself told you must under no conditions let the image affect
the height of the line, then do this:

<img style="height:8px;src="..." alt="">

Perhaps you might find this helpful:

See the red text on

<http://netweaver.com.au/floatHouse/page2.php>

and maybe even look at

<http://netweaver.com.au/floatHouse/appendices/page6_1.php>

Pictures act like big letters, room is naturally made for them. Perhaps
you need to supply a URL so people can advise how else to construct the
relevant part of your page.

--
dorayme

Reply With Quote
  #3  
Old   
dorayme
 
Posts: n/a

Default Re: How to set line height in a paragraph (line-height not working) - 11-04-2009 , 04:16 AM



In article <doraymeRidThis-E956B7.20052804112009 (AT) news (DOT) albasani.net>,
dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote:

Quote:
img style="height:8px;src="..." alt=""
<img style="height:8px" src="..." alt="">

--
dorayme

Reply With Quote
  #4  
Old   
rf
 
Posts: n/a

Default Re: How to set line height in a paragraph (line-height not working) - 11-04-2009 , 04:45 AM



Test wrote:
Quote:
I usualle set line height something like below

p style="line-height: 12px;"
Why? What a terrible thing to do. What if my font size is 18 pixels. The
text will overlap. Badly.

The best thing to do with line-height is to ignore that it has ever existed
unless you know exactly what it does. And *never* specify it in pixels.
Something dimensionless like 1.2 or 1.3 is far far better.

Quote:
But if I have an image the line height is the images height.
Of course. What else did you expect for an inline (replaced) element. It
lives on a line so if it is bigger than the other things on that line then
line height *must* increase. That is how line boxes work.

Quote:
What can I do?
What do you want to do? Have the text wrap around the image? If so then
explore float. Have the image sit in the middle of the page you can do in,
say, MS Word? Nope.

Reply With Quote
  #5  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: How to set line height in a paragraph (line-height not working) - 11-08-2009 , 02:10 PM



Test wrote:

Quote:
p style="line-height: 12px;"
You have been duly flamed for the 12px.

Now please receive some additional flames for posting a CSS question to an
HTML newsgroup.

Quote:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras varius
imperdiet nunc. Donec eu nibh a odio sodales viverra et non purus.
As an extra bonus, you receive complimentary flames for using monkey Latin
pseudo-dummy text in a context where it is manifestly a bad test string. For
line height considerations, diacritic marks (as in Å, ç, É for example) as
well as different types of ascenders (as in j and þ in addition to p and g)
matter a lot. You should actually test even with characters with multiple
(stacked) diacritic marks and various special symbols (like telephone
symbols, mathematical symbols, arrows etc.), if you want to be on the safe
side.

Quote:
Lorem ipsum dolor sit amet, <img src="test.jpg">. Cras varius
Using a photograph as inline image? Strange.

ObHTML: Your HTML markup is invalid and presents a fundamental accessibility
problem.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.