473,387 Members | 3,787 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,387 software developers and data experts.

seamless images tables in xhtml strict and css

The XHTML file below creates a 2x2 matrix of square images. There is
always some space at the bottom borders of the cells (when rendered
with Gecko and KHTML, not with IE) and I've found no way so far to
make it disappear. If I use XHTML 1.0 Transitional instead of Strict
the extra space below the cells disappears.

Is it impossible to create seamless images tables in XHTML Strict?

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
table.puzzle{
border-collapse: collapse;
border: 1px solid red;
}
.puzzle td {
padding: 0;
}
img {
}
</style>
</head>
<body>
<table class="puzzle">
<tr>
<td><img src="p00.jpg" /></td>
<td><img src="p10.jpg" /></td>
</tr>
<tr>
<td><img src="p01.jpg" /></td>
<td><img src="p11.jpg" /></td>
</tr>
</table>
</body>
</html>

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 24 '05 #1
16 7505
Peter Maas <pe***@somewhere.com> wrote:
The XHTML file below creates a 2x2 matrix of square images.
Don't post code to the group, post a url of a minimized example that
demonstrates the issue.
There is
always some space at the bottom borders of the cells (when rendered
with Gecko and KHTML, not with IE)


Just a guess since your code would be useless to demonstrate the issue:
img{vertical-align:text-bottom} or another appropriate value.

Note that this is a style issue and should thus have been posted to
ciwas.

--
Spartanicus
Jul 24 '05 #2
Peter Maas <pe***@somewhere.com> wrote:
The XHTML file below creates a 2x2 matrix of square images. There is
always some space at the bottom borders of the cells (when rendered
with Gecko and KHTML, not with IE) and I've found no way so far to
make it disappear. If I use XHTML 1.0 Transitional instead of Strict
the extra space below the cells disappears.

Is it impossible to create seamless images tables in XHTML Strict?


Yes. This issue has nothing at all to do with XHTML Strict. The same
bahaviour can be seen if you used HTML Transitional with a doctype
that triggers standards mode.

In standards mode the browsers apply the CSS formating correctly. This
means that the image sits on the text baseline regardless of whether
there is any other text present or not. Some space must always be left
below the baseline.

To fix it make images block level elements. i.e. in your case
..puzzle img {display: block;}

Of course one has to ask why you are using XHTML Strict and what very
much seems to be a layout table. But the issue above will occur with
any element not just table cells so even when you move onto a
tableless layout you will still need to remember this.

Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 24 '05 #3
Peter Maas wrote:
....
Is it impossible to create seamless images tables in XHTML Strict?

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


...and the presence of the xml prolog will cause WinIE to go into
quirks mode. {Probably not what you want.)

http://www.quirksmode.org/css/quirksmode.html
about halfway down the page:

"Explorer Windows special: the xml prolog

In Explorer 6 Windows, Microsoft implemented one extra rule: if a
doctype that triggers strict mode is preceded by an xml prolog, the
page shows in quirks mode. This was done to allow web developers to
achieve valid pages (which require a doctype) but nonetheless stay in
quirks mode."

I wonder about that last sentence, though. <g> Was it really intentional?

--
-bts
-This space intentionally left blank.
Jul 24 '05 #4
Spartanicus schrieb:
The XHTML file below creates a 2x2 matrix of square images.

Don't post code to the group, post a url of a minimized example that
demonstrates the issue.


Sorry. I tried to make the code as small as possible. It is now
594 byte on 30 lines, about 18 sec download time on a 300 baud
acoustic coupler ;)
There is
always some space at the bottom borders of the cells (when rendered
with Gecko and KHTML, not with IE)

Just a guess since your code would be useless to demonstrate the issue:


It is a working example. If you talk about the images: one can grab any
local image and refer to it four times. Not that I intended anybody
to do this - I simply wanted to give a complete problem descrition.
img{vertical-align:text-bottom} or another appropriate value.
That does the trick, thanks!
Note that this is a style issue and should thus have been posted to
ciwas.


Sorry again. I thought that CSS and HTML are closely related. Is it
really necessary to split HTML related topics between separate news-
groups? This group seems to have about 40 postings/day, same in ciwas.
In comp.lang.python we have 160 postings/day and nobody talks about
splitting.

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 24 '05 #5
In article <d3**********@swifty.westend.com>,
Peter Maas <pe***@somewhere.com> wrote:
The XHTML file below creates a 2x2 matrix of square images. There is
always some space at the bottom borders of the cells (when rendered
with Gecko and KHTML, not with IE) and I've found no way so far to
make it disappear.


http://www.mozilla.org/docs/web-developer/faq.html#gaps

--
Henri Sivonen
hs******@iki.fi
http://hsivonen.iki.fi/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html
Jul 24 '05 #6
Beauregard T. Shagnasty schrieb:
..and the presence of the xml prolog will cause WinIE to go into quirks
mode. {Probably not what you want.)


Thanks for the hint.

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 24 '05 #7
Henri Sivonen schrieb:
http://www.mozilla.org/docs/web-developer/faq.html#gaps


Thanks for the URL. Please don't think that I didn't do some searches
before posting here but I never used the word "gap" so I didn't find
this one :)

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 24 '05 #8
Steve Pugh schrieb:
Is it impossible to create seamless images tables in XHTML Strict?

Yes. This issue has nothing at all to do with XHTML Strict. The same
bahaviour can be seen if you used HTML Transitional with a doctype
that triggers standards mode.


I noticed that that I could switch this behaviour on/off by enabling
XHTML Strict/Transitional. So this *has* something to do with XHTML
Strict. I never claimed that his happens *only* with XHTML Strict :)
To fix it make images block level elements. i.e. in your case
.puzzle img {display: block;}
Thanks, this works! Henri Sivonen gave me an interesting URL with
some details about this behaviour.
Of course one has to ask why you are using XHTML Strict and what very
much seems to be a layout table.


Tables have been abused for years to solve layout problems they
weren't invented for. So I can understand that there is a sentiment
against using them. But I see no point in doing table-less HTML
just for the sake of itself. There are situations when a grid layout
is appropriate (e.g. to visualize relations) and the HTML tool for
this is the table tag.

I was creating a grid puzzle game so that tables were the natural
choice. I also tried a div based layout with absolute cell positio-
ning but this was clumsy because I had to hard-wire table dimensions
in CSS.

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 24 '05 #9
On Tue, 19 Apr 2005, Peter Maas wrote:
Steve Pugh schrieb:
Of course one has to ask why you are using XHTML Strict and what
very much seems to be a layout table.
Tables have been abused for years to solve layout problems they
weren't invented for. So I can understand that there is a sentiment
against using them. But I see no point in doing table-less HTML
just for the sake of itself.


Or to put it another way, I can understand that there's a sentiment in
favour of doing things the bad old way - but then why would one want
to move to Strict XHTML "just for the sake of itself"? One of the
aims of "Strict" (and that means HTML/4.01 Strict just as much as it
means XHTML Strict) was to get rid of presentational clutter from the
logical markup. So you got yourself a new dog but you're still
barking like the old one yourself, it seems.
There are situations when a grid layout is appropriate (e.g. to
visualize relations) and the HTML tool for this is the table tag.
I think you've got that back to front. The table is the tool to
*mark up* the logical relations. The "grid layout" follows naturally,
for presentation in the visual domain. But tables can be rendered in
other domains too, ones for which logical relations are important, but
visual layout is not (speaking browser, maybe some kinds of bot...)
I was creating a grid puzzle game so that tables were the natural
choice.


As far as I'm concerned, this is a discussion about theory. I'm
commenting on the discussion - not on your particular choice of markup
(sorry, I haven't time to see it in that much detail). If its the
right choice then please, feel free to go ahead. I'm just unhappy with
the cart-before-the-horse way in which you seem to be presenting the
principles of it.

Jul 24 '05 #10
Alan J. Flavell schrieb:
Or to put it another way, I can understand that there's a sentiment in
favour of doing things the bad old way - but then why would one want
to move to Strict XHTML "just for the sake of itself"? One of the
aims of "Strict" (and that means HTML/4.01 Strict just as much as it
means XHTML Strict) was to get rid of presentational clutter from the
logical markup.
That's why I'm using XHTML.
So you got yourself a new dog but you're still barking like the old
one yourself, it seems.
You can't tell how I bark because you don't know what I'm doing.
There are situations when a grid layout is appropriate (e.g. to
visualize relations) and the HTML tool for this is the table tag.

I think you've got that back to front. The table is the tool to
*mark up* the logical relations.


You are right. I shouldn't have used the word "layout" when talking
about HTML. But I'm creating a 2D board game so layout was on my mind.
The board layout is done with CSS. The table related tags have only
class attributes.
As far as I'm concerned, this is a discussion about theory.


As far as I'm concerned, I wanted to solve a practical problem with
XHTML. I could have easily solved it with messy HTML but I didn't
want to. Thanks for your help.

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 24 '05 #11
Alan J. Flavell schrieb:
I think you've got that back to front. The table is the tool to
*mark up* the logical relations.


Formally you are right. But HTML was created solely for presentational
purposes and this is still true for XHTML. If you only cared about
logic then you would't need (X)HTML at all. You would create an XML
file representing the special logic of your document and format it
with CSS. (X)HTML is only useful because there are browsers with
default stylesheets for HTML tags otherwise nobody would use HTML.
So your understanding of presentation-free HTML may be theoretically
interesting but is practically useless.

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 24 '05 #12
On Wed, 20 Apr 2005 11:55:43 +0200, Peter Maas <pe***@somewhere.com>
wrote:
If you only cared about
logic then you would't need (X)HTML at all. You would create an XML
file representing the special logic of your document


You can't represent "logic" in XML alone. XML goes no further than
Infoset (a very crude data model), it doesn't have any implied
semantics. If you want to communicate semantics with XML, then as a
minimum you need to use a schema that's pre-agreed by both parties.

A convenient schema to use in this case would be that of (X)HTML. You
could just as well use DocBook, but you have to use _something_ if
there's to be any notion of "meaning". As such, then you might as well
use one of these pre-established schema.

It's also not possible to practically render XML by using CSS alone -
CSS' output is restricted to static rendering, so no <img> or <a>

--
Cats have nine lives, which is why they rarely post to Usenet.
Jul 24 '05 #13
On Wed, 20 Apr 2005, Peter Maas wrote:
Alan J. Flavell schrieb:
Or to put it another way, I can understand that there's a
sentiment in favour of doing things the bad old way - but then why
would one want to move to Strict XHTML "just for the sake of
itself"? One of the aims of "Strict" (and that means HTML/4.01
Strict just as much as it means XHTML Strict) was to get rid of
presentational clutter from the logical markup.
That's why I'm using XHTML.


I hear what you say, but this seems to be the wrong category.

Here's a broad-brush analysis:
Transitional: Strict:

HTML: Presentational clutter Content/presentation split

XHTML: Presentational clutter Content/presentation split
Now tell me again, why should one choose XHTML rather than HTML
on *that* basis?

You say you want to avoid presentational clutter. So I say you should
choose Strict.

By all means choose XHTML if you know why you want to choose XHTML,
but this isn't the reason.
So you got yourself a new dog but you're still barking like the
old one yourself, it seems.


You can't tell how I bark because you don't know what I'm doing.


We can all read what you -say- you are doing - and that's the basis
for discussion here. If you're not telling the truth about what
you're really doing, then who cares what it is that you're really
doing?
As far as I'm concerned, this is a discussion about theory.


As far as I'm concerned, I wanted to solve a practical problem with
XHTML.


Welcome to usenet. I responded in the course of discussion. If that
happens to solve your original problem, that's fine too. But I don't
treat usenet as my personal help desk, and neither should you. IMHO as
a long-time usenet participant, that is.
I could have easily solved it with messy HTML


You *could* equally have solved it with messy XHTML Transitional, if
you had been happy with a Transitional solution. Whether you are or
aren't willing to do that, has rather little to do with the direct
choice of HTML versus XHTML, but a great deal to do with your choice
of Strict over Transitional.

Bye for now.
Jul 24 '05 #14
On Wed, 20 Apr 2005, Peter Maas wrote:
But HTML was created solely for presentational
purposes and this is still true for XHTML.
You're remarkably stubborn.

I was aware of the early life of HTML at the time. I know that you
will find some evidence which supports your claim. I also know that
you are, in principle and on balance, quite wrong. HTML was motivated
from the start by the need to present content on widely diverse
presentation devices. They were different then than the devices we
use today, but they were nevertheless widely diverse.

Consequently, the idea of HTML specifying details of the presentation
(as promoted by the Mosaic/Netscape axis) was an ultimately doomed
digression, if the original intentions of HTML were ever to be
realised.
If you only cared about logic then you would't need (X)HTML at all.
You would create an XML file representing the special logic of your
document and format it with CSS.
When the structural elements of HTML are so totally inappropriate as
to be useful for the purpose, then naturally some other markup is
needed. MathML, music markup, whatever. I don't see how that relates
to our discussion of transitional (x)html versus strict (x)html.
(X)HTML is only useful because there are browsers with default
stylesheets for HTML tags otherwise nobody would use HTML.
I don't disagree with what you say - but I don't see what light it
throws on the points that we were discussing.
So your understanding of presentation-free HTML
I'd rather say "HTML free of unnecessary presentational detail".
may be theoretically interesting but is practically useless.


CSSzengarden.

Jul 24 '05 #15
On Wed, 20 Apr 2005 11:55:43 +0200, Peter Maas <pe***@somewhere.com>
wrote:
Alan J. Flavell schrieb:
I think you've got that back to front. The table is the tool to
*mark up* the logical relations.


Formally you are right. But HTML was created solely for presentational
purposes and this is still true for XHTML.


That's not true:
The specific incentive that TBL had for his "invention" of HTML (and
HTTP) was to make it possible to access information in a uniform way
regardless of where that information was stored and/or produced.

It still holds today, as it does not matter what kind of hardware or
filing system you have at each end of an HTTP transaction.

Mind you also that the browser that TBL wrote to demonstrate his idea,
and to get funds to realize it, _did_ have its presentational aspect
controlled by a separate style sheet.

The first history of HTML/HTTP is available at the W3 site if you would
find it interesting to read up on it.

--
Rex
Jul 24 '05 #16
Alan J. Flavell schrieb:
But HTML was created solely for presentational
purposes and this is still true for XHTML.

You're remarkably stubborn.


I surrender.

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 24 '05 #17

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

Similar topics

24
by: Firas D. | last post by:
http://www.firasd.org/scrapbook/poetry/robinson-edwin/minivercheevy.html This is probably wishful thinking, but it's worth a shot.. is there a way to put four different images on the corners of...
13
by: DM | last post by:
If I put three images next to each other (each within an anchor tag) they all line up horizontally as expected with no space between them. I.e., they're sitting flush up against each other. ...
20
by: Roberto | last post by:
Hallo, I'm building a page that wants to respect XHTML 1.0 strict and CSS2 specifics. In this page I have to present thumbnails arranged to cover the entire width of the window, but there are...
16
by: Woodmon | last post by:
I want to flow text in an "irregular" column on the left and place a large image at the top of an "irregular" column to the right. Then after the bottom of the large image I want the text column on...
3
by: arbeizaf | last post by:
Hi: I am using CSS instead of tables for the layout of a webpage but I don't know how to do something. I need to place three images with the same distance among them and the border of the...
0
by: Jeb Hunter | last post by:
Well, how can I describe this succinctly? I have a page with DIVs that us background images to produce a border effect. It works perfectly well, but I want to make up (for now) 3 different...
7
by: DesertPrince | last post by:
I like making pages with the XHTML strict doctype. So I was building a page where I have two images that need to be next to each other, one on top of the other, so the colors match up. In Firefox...
19
by: marckatsambis | last post by:
Hi, I'm struggling to find answers on the problem I'm having, and I desperately need some closure :) I have a bunch of background-images in a css file that are visible locally, but when I...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.