473,396 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem getting an even spacing between lines

I'm trying to format a table where each row will contain a single line
of text followed by a number of optional icon images (sometimes none).
However, I'm having great difficulty in getting an even spacing
between each row of the table. A much simplified example of the kind
of thing I want to do is shown in the html below:

<html>
<head>
<title>Format Test</title>
<style>
td {line-height: 60px;}
</style>
</head>
<body>
<h1>Format Test</h1>
<hr>
<table border=1>
<tr><td><li>This is line one</tr></td>
<tr><td><li>This is line two <img src="icon.gif" height="30"
width="30"></td></tr>
<tr><td><li>This is line three</tr></td>
<tr><td><li>This is line four <img src="icon.gif" height="30"
width="30"></tr></td>
<tr><td><li>This is line five</tr></td>
</table>
<hr>
</body>
</html>

Viewing in ie6, lines one, three and five (where there is no image
present) space correctly, but as soon as an image is introduced to the
line, the height shrinks to the height of the image and line-height
appears to be ignored. What I want to achieve is the same row height
and spacing as lines one, two and three with the bottom of the image
aligned with the bottom of the text in all cases.

One solution would be to add an invisible image to each of the lines
without images, but this strikes me as clumsy and I would have hoped
there would be a much better solution using css.

I'd be very appreciative of any help anyone might be able to provide.

Phil
Jul 20 '05 #1
2 3569
*Phil K*:

<tr><td><li>This is line one</tr></td>


If you don't use correct HTML, you shouldn't be surprised of unexpected,
inconsistent or "wrong" renderings.

A single column table is usually a list, which you probably want, judging by
the <li>:

<ul>
<li>This is line one</li>
...
</ul>

If you still want a table, nest it correctly:

<tr><td>This is line one</td></tr>

If you want the disc bullet from lists without actually using a list, &bull;
(• or &#x2022) comes close.

--
Useless Fact #12:
The national anthem of Greece has 158 verses. No one in Greece has memorized all
158 verses.
Jul 20 '05 #2
On Sat, 10 Jan 2004 14:44:16 +0100, Christoph Paeper
<ch**************@nurfuerspam.de> wrote:
*Phil K*:

<tr><td><li>This is line one</tr></td>
If you don't use correct HTML, you shouldn't be surprised of unexpected,
inconsistent or "wrong" renderings.


Sorry. The incorrect nesting was introduced while trying to knock out
a simple example of what I'm trying to achieve. It actually makes no
difference to the problem as you can see if you open the html below
where I've corrected the nestling.
A single column table is usually a list, which you probably want, judging by
the <li>:

<ul>
<li>This is line one</li>
...
</ul>

If you still want a table, nest it correctly:

<tr><td>This is line one</td></tr>

If you want the disc bullet from lists without actually using a list, &bull;
(• or &#x2022) comes close.


I do want a table, but a list suffers from *exactly* the same problem
anyway as you'd see if you change the table tags for ul tags and the
row/cells for list items.

<html>
<head>
<title>Format Test</title>
<style>
td {line-height: 60px;}
</style>
</head>
<body>
<h1>Format Test</h1>
<hr>
<table border=1>
<tr><td>This is line one</td></tr>
<tr><td>This is line two <img src="icon.gif" height="30"
width="30"></td></tr>
<tr><td>This is line three</td></tr>
<tr><td>This is line four <img src="icon.gif" height="30"
width="30"></td></tr>
<tr><td>This is line five</td></tr>
</table>
<hr>
</body>
</html>

Phil
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Danny | last post by:
I have a small <div> element which contains two text blocks - one within <h5> tags and the other within <p> tags. I don't want any extra line spacing between elements so use the display:inline...
4
by: fleemo17 | last post by:
Is there a way to tweak the spacing of lines of text (or leading) *specifically* in IE6? I've created a "Quick Search" box in my layout which renders pretty consistently in all the browsers I've...
6
by: shoo | last post by:
Any one know how to do this? thank Write a simple text-formatting program that produces neatly printed output from input text containing embedded command lines that determine how to format the...
10
by: Mark McLellan | last post by:
Dear all Following the oft-repeated advice here and ciwas I have made my site nearly 4.01 strict (working on it). There are some items on which I would appreciate your advice: 1. Hidden...
6
by: shoo | last post by:
Any one know how to do this? thank Write a simple text-formatting program that produces neatly printed output from input text containing embedded command lines that determine how to format the...
3
by: arashamiri | last post by:
Hi, I wrote an auto resizing textarea: function myMax(anumber, another) { if (anumber > another) { return anumber; } return another; }
5
by: Memphis Steve | last post by:
Is is possible to control spacing between two lines when using <br />? I would like to be able to adjust the spacing between the two lines in each link below so that the two lines sit snugly on top...
12
by: Lars Eighner | last post by:
I take this example from a writer in alt.usage.english <news://r3jie3p93s1eaflgcckn2hinf3li4mnfud@4ax.com>, where the question of whether the "and" is required came up strictly as an issue of...
8
by: Red | last post by:
If auto-format is turned off in VS2008, there is apparently no way to indent a line. Under Tools->Options->Text Editor->C#->Formatting, there are three checkboxes. Unchecking those seems to cause...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.