473,895 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 66676
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.c om...
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.c om...
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_********@hot mail.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****@stanford alumni.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
"Spartanicu s" <me@privacy.net > wrote in message
news:o2******** *************** *********@news. spartanicus.utv internet.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 "recommende d" for writing new applications to target
the most current browsers (I don't care about IE 5 etc.)?

Olav
Jul 23 '05 #10

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

Similar topics

10
10370
by: Unknown User | last post by:
Yet another question about vertical centering: How can I center a page vertically? I have searched on Google and didn't find anything that works at least on IE, Opera and Mozilla: http://milov.nl/code/css/verticalcenter.html Or using a table: http://www.quirksmode.org/css/centering.html Is there a way to do it and that works in Opera, IE and Mozilla? Thanks,
1
3391
by: dumblede | last post by:
Hello fellows, i would like to center a 800px wide 600px high content area without using frames. I have "come up" with the following solution so far. It works under IE 6.0, Firefox 1 (under Windows and Linux) but not under Konqueror (could not test Safari, but they have the rendering engine in common (see www.kde.org)): <pre>
3
4868
by: SamMan | last post by:
A few months ago, I recalled reading somewhere the way to center content in Mozilla-based browsers was like this... body { margin: 0px auto; text-align: center; /*for IE*/ } My memory recalls this working, but now upon revisiting, it is not. What is the proper way to center content?
2
11416
by: joey.powell | last post by:
Make Firefox Center Content in a div Or td Tag By Using CSS? Does anyone know how to do this. IE works great with text-align:center; but Firefox just always left-aligns...
4
6293
by: Joey | last post by:
Does anyone know how to center this sample webpage in Firefox? If so, will you provide the example as it applies to this sample webpage? I have read numerous posts and articles on how to center content with CSS...none are working for me. The best I can do at this point is the "text-align: center" for my div tag, but that only works in IE. I want to be able to center all the content within the div (effectively center the site content) for...
13
2794
by: Pablo | last post by:
Hi at all I'ld like to center a table crossbrowser therefore I wrote: <sryle> table {width:80%;margin-left:auto;margin-right:auto;} </style> firefox work fine but MSIE set the margin to zero Thank in advance
4
3203
pradeepjain
by: pradeepjain | last post by:
Hii, I have a 3 column layout for which base i have taken is http://www.cssplay.co.uk/layouts/3cols.html how to make the browser scroll bar scroll the #center content only ? we can get rid of the right sidebar also if it is effecting it. Is there any example which i can see and learn.
1
2030
mickey0
by: mickey0 | last post by:
Hello, I would like to center 'Savi' but align=center seems dont' work on it. Any hints? thanks <html> <body> <table border="1"> <tr> <th align="center">Savi</th> </tr> <tr> <td>January</td>
3
13442
by: Dfresh | last post by:
I have searched several postings with similar questions but have not found a response that works. You would think that it would be fairly simple to center the content of a form on the screen (regardless of size and resolution) but that does not seem to be the case. Auto Center set to Yes does not work. I am running XP and Access 2007. Any help would be most appreciated. Thanks!
0
9990
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11249
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10937
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9651
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5865
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4693
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4288
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3298
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.