You are here: Re: center/shrink to fit redux. « HTML « IT news, forums, messages
Re: center/shrink to fit redux.

Posted by fred.haab@gmail.com on 06/02/06 16:52

mbstevens wrote:
> dorayme wrote:
>
> > Actually, I better keep out of this. Seems easy enough to centre
> > a list? But there is obviously more going on.
>
> Yes, tables were seeming to display centered <ul>s better than CSS for a
> minute there. It wasn't so much just centering as doing it as well as
> a table.
>

To be honest, I still don't think the word "seeming" is appropriate...
the table method still works under all but the most bizarre
circumstances. I agree that using "em" and potentially calculating the
width on the fly (in the PHP) is a solution... but it's a lot more work
than just using a table to center the list.

Moreover, now your list items won't wrap at all... if they get wider,
you end up with a horizontal scroll bar, whereas the table would
wrap...

The thing is, in a list, you don't want to wrap when there's enough
whitespace to avoid it. Using a table, the table exapands in width up
to the maximum size before wrapping... but it does wrap if it has to.

So here's what happens with your latest solution (in a general case,
using some server side calculated data, whether it's PHP or some other
back end system).

1. Get the results of some query (let's say five things).
2. Find the length of the longest line.
3. Set the style width to that length in EM.
4. Create the list markup.

However, if one of those lines happens to be very long, then you are
going to be stuck with horizontal scrolling instead of wrapping.

So you might try something like:

2.5 if the length is larger than some reasonable maximum, then use the
reasonable maximum.

Well, that's great... but what is the reasonable maximum? It depends
on the users window and font sizes! But your back-end scripting has no
idea about those values.

Moreover, not only doesn't it work in a general case, you're doing all
this extra work simply to avoid using "table" for presentation because
someone else decided it was bad, and you'll be ridiculed on
alt.html.critique because, regardless of how good your page looks, even
when resized and font-zoomed for the visually impaired, people will
mock you because you used a table for presentation.

So I agree with the philosophy to avoid using markup for presentation,
but when you can simplify things (and look, in this case it's a simple
one row, one column table, pretty hard to mess up) and have it work
right EVERY TIME, and know that it will be supported in the future
(unlike other markup that has been obsoleted by CSS presentation), then
I'm failing to see the problem.

Now, like I've been saying, ideally someone can show me a generic,
always works solution that is less cumbersome than tables... but I
simply haven't seen that yet. I want to see it, I really do. I don't
want to be a troll that just opened this debate to complain about it, I
want to see the "right" way that always works.

In other words, you see how UL works with no other presentation or
markup:
..
..
..
<body>
<ul>
<li>Item one.</li>
<li>item two.</li>
</ul>
</body>
</html>

All I want, if this list is less than the maximum width of the window,
that it be centered. Othewise, it should behave exactly as the list
shown above does when the user makes the window really small (in this
case it doesn't matter, but add a longer list item), or makes the font
big, or a combination of both...

The table handles it quite nicely with very little work.

Again, I'm not talking about a million of these on a page, I'm talking
about presentation (is there an alt.css newsgroup? I suppose I should
try there). It's a simple concept to have something like this centered
on the page and have it work for arbitrary cases of amount of text,
window size, and font size.

And no one has answered my lazy question, so just to ask again, if
anybody knows...

Is there anything the w3c is doing to address this? "Float: center"
would probably put the use of tables as presentation to an end rather
quickly.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация