472,145 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

How to avoid padding around content when using "DOCTYPE .. html4/strict.dtd" ?

I have a table with a cell on the bottom right with an image to create a
rounded corner effect:

<table cellpadding="0" cellspacing="0" border="1">
<tr><td rowspan="2">asdfsadf</td>

<td align="right" valign="top">asdfsaf</td></tr>

<tr><td align="right" valign="bottom">
<img src="images/corner.gif" width="11" height="11"></td>
</tr></table>

With the old-fashioned method as the above would work just fine, however,
as soon as I include at the top of the doc: ..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

... a vertical padding, spacing or margin is created above and below the
image or/and the text elements. Is there a way to avoid this?
Aug 13 '05 #1
4 2774
timmy wrote:
I have a table with a cell on the bottom right with an image to create a
rounded corner effect:
Don't do that.
http://www.allmyfaqs.com/faq.pl?Tableless_layouts
http://css-discuss.incutio.com/?page=RoundedCorners
With the old-fashioned method as the above would work just fine, however,
as soon as I include at the top of the doc: ..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

.. a vertical padding, spacing or margin is created above and below the
image or/and the text elements.


Inline images have, by default, a vertical alignment that causes them to sit
on the baseline. There is space below the baseline for descenders (which
you find on the letters f, g, j and p but not a, b, c or d). Adjusting the
vertical alignment of the images, or cause them to display as something
other than inline will cause the gap to vanish.

That isn't the solution in this case though, but is worth remembering for
when you have tabular data that includes images.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Aug 13 '05 #2
timmy wrote:
I have a table with a cell on the bottom right with an image to create a
rounded corner effect:

<table cellpadding="0" cellspacing="0" border="1">
<tr><td rowspan="2">asdfsadf</td>

<td align="right" valign="top">asdfsaf</td></tr>

<tr><td align="right" valign="bottom">
<img src="images/corner.gif" width="11" height="11"></td>
</tr></table>

With the old-fashioned method as the above would work just fine, however,
as soon as I include at the top of the doc: ..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

.. a vertical padding, spacing or margin is created above and below the
image or/and the text elements. Is there a way to avoid this?


I agree with David about the better approach. A direct answer to your
"what happened?" question is to eliminate the line break in your code
between the opening TD tag and the IMG tag. I think that will help.
Aug 14 '05 #3
On Sat, 13 Aug 2005, Harlan Messinger wrote:
A direct answer to your "what happened?" question is to eliminate
the line break in your code between the opening TD tag and the IMG
tag. I think that will help.


Plus the fact that the vertical positioning of img by default is the
font baseline (which leaves room for descenders below), so use CSS to
change the position to "bottom" instead if that's what you want.
This particularly shows up in a browser's standards mode (as opposed
to quirks mode).

Aug 14 '05 #4
Thanks for all the valuable answers!

I have another question:

Is it possible to place a <div> e.g. a navbar, at the bottom of the browser
screen, below scrollable or non-scrollable content? This happens anyway if
text or other content is causing the window to scroll.

But if there's less content than a screenfull, is there a way to push the
div down exactly to the bottom of the screen, rather than having it
floating just below the last text line? For example:

---------------------------------------
| |
| Heading |
| |
| text text text |
| text text |
| |
| |
| |
| |
| |
| |
|-----------------------------------|
| bla | blabla | bla |
-------------------------------------


Aug 14 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Tom Eldridge | last post: by
reply views Thread by Saiars | last post: by

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.