469,315 Members | 1,795 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,315 developers. It's quick & easy.

How to center content in div tag?

In HTML, I could use <div align="center">.

How do I center everything contained in a <div> tag using XHTML 1.1?

Are there any newsgroup for XHTML authoring?

Olav
Jul 23 '05 #1
11 66481
On Thu, 9 Dec 2004 19:52:06 +0100, "Olav Tollefsen" <x@y.com> wrote:
In HTML, I could use <div align="center">.
In pre-HTML 4 you could (and in HTML 4 Transitional, but unless you
have a time machine there's no need to be worrying about the
transition from pre-1997 code).
How do I center everything contained in a <div> tag using XHTML 1.1?
Same way you would in any of the versions of (x)HTML that actually
work on the www.

Inline content is centered via the CSS property text-align: center;
applied to the div itself.
Block level children are centered via the CSS properties margin-left:
auto; and margin-right: auto; applied to the child elements.

IE6 needs to be in Standards mode for the latter to work. IE5 doesn't
support the latter but does, incorrectly, center block levele children
if text-align: center; was set on the parent.
Are there any newsgroup for XHTML authoring?


This one.

Steve

Jul 23 '05 #2
"Steve Pugh" <st***@pugh.net> wrote in message
news:74********************************@4ax.com...
On Thu, 9 Dec 2004 19:52:06 +0100, "Olav Tollefsen" <x@y.com> wrote:
How do I center everything contained in a <div> tag using XHTML 1.1?


Same way you would in any of the versions of (x)HTML that actually
work on the www.

Inline content is centered via the CSS property text-align: center;
applied to the div itself.
Block level children are centered via the CSS properties margin-left:
auto; and margin-right: auto; applied to the child elements.


So, it's no direct equivalent in the XHTML 1.1 strict <div> tag to <div
align="center">?

Olav
Jul 23 '05 #3
On Thu, 9 Dec 2004 20:52:02 +0100, Olav Tollefsen <x@y.com> wrote:
"Steve Pugh" <st***@pugh.net> wrote in message
news:74********************************@4ax.com...
On Thu, 9 Dec 2004 19:52:06 +0100, "Olav Tollefsen" <x@y.com> wrote:
How do I center everything contained in a <div> tag using XHTML 1.1?


Same way you would in any of the versions of (x)HTML that actually
work on the www.

Inline content is centered via the CSS property text-align: center;
applied to the div itself.
Block level children are centered via the CSS properties margin-left:
auto; and margin-right: auto; applied to the child elements.


So, it's no direct equivalent in the XHTML 1.1 strict <div> tag to <div
align="center">?


If you have to ask that, why, if I may ask, are you going to use XHTML 1.1
strict?
--
Weblog | <http://home.wanadoo.nl/b.de.zoete/_private/weblog.html>
Webontwerp | <http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html>
Zweefvliegen | <http://home.wanadoo.nl/b.de.zoete/html/vliegen.html>
Jul 23 '05 #4
Olav Tollefsen <x@y.com> wrote:
So, it's no direct equivalent in the XHTML 1.1 strict <div> tag to <div
align="center">?

Barbara de Zoete <b_********@hotmail.com> wrote: If you have to ask that, why, if I may ask, are you going to use XHTML 1.1
strict?


And FWIW, it's just XHTML 1.1. XHTML 1.0 was the last recommendation with
the Transitional-Strict-Frameset triad.
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

aquapella /"a-kw&-'pe-l&/ adj. sung in the shower
Jul 23 '05 #5
On Thu, 9 Dec 2004 20:52:02 +0100, "Olav Tollefsen" <x@y.com> wrote:
"Steve Pugh" <st***@pugh.net> wrote in message
news:74********************************@4ax.com.. .
On Thu, 9 Dec 2004 19:52:06 +0100, "Olav Tollefsen" <x@y.com> wrote:
How do I center everything contained in a <div> tag using XHTML 1.1?


Same way you would in any of the versions of (x)HTML that actually
work on the www.

Inline content is centered via the CSS property text-align: center;
applied to the div itself.
Block level children are centered via the CSS properties margin-left:
auto; and margin-right: auto; applied to the child elements.


So, it's no direct equivalent in the XHTML 1.1 strict <div> tag to <div
align="center">?


There's no such thing as XHTML 1.1 Strict.

No, presentation has been moved from HTML to CSS ever since HTML 4 in
1997.

Steve

Jul 23 '05 #6
"Olav Tollefsen" <x@y.com> wrote:
using XHTML 1.1?


Oh dear, time to read this:
http://www.spartanicus.utvinternet.ie/no-xhtml.htm

--
Spartanicus
Jul 23 '05 #7
Olav Tollefsen wrote:
In HTML, I could use <div align="center">.

How do I center everything contained in a <div> tag using XHTML 1.1?
You don't, that's the job of CSS.
http://dorward.me.uk/www/centre/
Are there any newsgroup for XHTML authoring?


This one.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #8
Steve Pugh wrote:
There's no such thing as XHTML 1.1 Strict.


Better phrased is that: XHTML 1.1 in itself is "Strict". There is only
one DocType.

--
Gus
Jul 23 '05 #9
"Spartanicus" <me@privacy.net> wrote in message
news:o2********************************@news.spart anicus.utvinternet.ie...
"Olav Tollefsen" <x@y.com> wrote:
using XHTML 1.1?


Oh dear, time to read this:
http://www.spartanicus.utvinternet.ie/no-xhtml.htm


I'm a bit confused by the different HTML-related standards.

What standard is the "recommended" for writing new applications to target
the most current browsers (I don't care about IE 5 etc.)?

Olav
Jul 23 '05 #10
"Olav Tollefsen" <x@y.com> wrote:
using XHTML 1.1?


Oh dear, time to read this:
http://www.spartanicus.utvinternet.ie/no-xhtml.htm


I'm a bit confused by the different HTML-related standards.

What standard is the "recommended" for writing new applications to target
the most current browsers (I don't care about IE 5 etc.)?


HTML 4.01 Strict

--
Spartanicus
Jul 23 '05 #11

Olav Tollefsen wrote:
"Steve Pugh" <st***@pugh.net> wrote in message
news:74********************************@4ax.com...
On Thu, 9 Dec 2004 19:52:06 +0100, "Olav Tollefsen" <x@y.com> wrote:
How do I center everything contained in a <div> tag using XHTML
1.1?
Same way you would in any of the versions of (x)HTML that actually
work on the www.

Inline content is centered via the CSS property text-align: center;
applied to the div itself.
Block level children are centered via the CSS properties margin-left: auto; and margin-right: auto; applied to the child elements.
So, it's no direct equivalent in the XHTML 1.1 strict <div> tag to

<div align="center">?

Olav


There is no equivalent because all presentational aspects have been
removed from XHTML 1.1. (That's why, as other posters have indicated,
the term 'strict' is redundant and unnecessary when referring to that
specification.)

If you want to use XHTML for whatever reason (fetish for the
bleeding-edge perhaps) you must accept that all presentation will be
done through CSS only.

Jul 23 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Unknown User | last post: by
3 posts views Thread by SamMan | last post: by
13 posts views Thread by Pablo | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.