> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Marcel Stör > Sent: Friday, August 22, 2008 10:41 AM > To: css-d@lists.css-discuss.org > Subject: [css-d] Trouble with line-height and <div> overflow:hidden > > What I need to achieve: > A CMS template provides a fix-sized <div> (height and width are px- > based) in which I need to display arbitrary text entered by > the user. > Hence, if the full text doesn't fit into the <div> it needs > to be cut off i.e. invisible. So, the <div> style will > contain overflow:hidden. > However, since the last line of visible text in the <div> > must not be cut off horizontally I need to tinker with the > line-attribute, right? > > The inherited font-size for the <div> is 1em. I played around > with the line-height value in 'em' until I could make sure > that no pixel of the last visible line of text in the <div> > is cut off. Then I switched browser/OS and got totally > different results - line-heigths are always different. > > Am I using the wrong approach here? Is it even possible to > achieve in CSS what the design folks require in their > Photoshop layouts?
Suggest instead that you get them away from designing in Photoshop - because Photoshop is not dynamic about its presentation but is static - the opposite of the web. I'd set the box height in ems, because then you've got a measure that's connected with the font size used. You can set your line height indepently of units, so you can calculate a box height to hold X number of lines - I'd think that if you're using 1em font size and a line height of 1.4, a box to hold 10 lines of text would be 10x1.4 = 14 ems. I've not tested this, but I think that would make the 10th line of text be right at the bottom of the box, not partially cut off by falling outside the fixed height of the box. Plus the box height would still be usable for visitors who've increased or decreased their font size (another feature of the web that makes Photoshop a poor design choice). David Jones, Content Coordinator, Customer Relations Information and Technology Management - KL PS, (808) 948-5830 "MMS <hmsa.com>" made the following annotations. ------------------------------------------------------------------------------ This electronic message is not an offer to contract, the acceptance of an offer to contract, or in any other way intended to contractually obligate HMSA; neither is it intended to change the terms of any existing contract unless specifically so stated. The information contained in this electronic message (or attached hereto) is intended only for the individual or entity to which it is addressed and may contain information that is confidential and protected by law. If you are not the intended recipient of this e-mail, you are cautioned that use of its contents in any way is prohibited and may be unlawful. If you have received this communication in error, please notify the sender immediately by e-mail or telephone and return the original message by e-mail to the sender or to [EMAIL PROTECTED] We will reimburse you for any cost you incur in notifying us of the errant e-mail. Thank you. · ============================================================================== ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/