On Fri, 28 Apr 2006 00:27:31 +0000 (UTC) axlq <ax**@spamcop.n et> wrote:
| In article <4b************ *@news.dfncis.d e>,
| Oliver Block <ol**********@e post.de> wrote:
|>what is the most elegent way to center an
|>image inside a web page.
|
| "Most elegant" would be "simplest" to me -- but that also happens to
| be non-compliant with HTML Strict and doesn't use CSS.
|
| So the next best way is:
|
| (CSS) .imgcenter { display: inline; text-align: center; border: 0; }
|
| (HTML) <img class="imgcente r" src="...." ...>
|
| The display:inline is needed so that the image gets treated like
| text, which can then be centered with text-align:center.
In the principle of separation of content and style, the centering of the
images would be style. So of course specifying it in CSS would be right.
It's the class name that I would object to, because it implys the style
being coded in the HTML. Why not a class name like "randomimag e", instead?
Then you can later change the style and align it differently without any
conflict in implied naming semantics.
--
-----------------------------------------------------------------------------
| Phil Howard KA9WGN |
http://linuxhomepage.com/ http://ham.org/ |
| (first name) at ipal.net |
http://phil.ipal.org/ http://ka9wgn.ham.org/ |
-----------------------------------------------------------------------------