Forum Moderators: open

Message Too Old, No Replies

The <center> element in XHTML Strict

XHTML Question

         

manicman

5:44 pm on Jul 18, 2006 (gmt 0)

10+ Year Member



Hi,

Iam working on a XHTML quiz and keep getting some questions wrong and can't find the answer anywhere so I thought I would ask here.
1. Is the <center> tage allowed in XHTML?
2. Is the <div align="center"> tag allowed in XHTML?
3. For questions 1 and 2 if the tags are not allowed why not?

Also, I have a couple of questions that I would like to ask to help me make part of my intranet XHTML Strict complient.
Are the <font> and the <u> tags XHTML 1.0 Strict complient?

Any help would be greatly aprechiated, thanks.

manicman

5:49 pm on Jul 18, 2006 (gmt 0)

10+ Year Member



Sorry guys, forgot to add another question I had.

When I validate my page for XHTML Strict is says there is no border="0" attribute.
What attribute do I use instead to remove the border around the image I have on my page or can it be done on my css file if so how?

Thanks again.!

coopster

5:56 pm on Jul 18, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, manicman.

The CENTER [w3.org] element is deprecated as is alternate number 2, the align attribute on the DIV [w3.org] element. The W3 standards pages are valuable reading, be sure to bookmark them!

manicman

7:15 pm on Jul 18, 2006 (gmt 0)

10+ Year Member



Thanks coopster!

So just to make sure I don't get confused (which can happen very easily!) both the <center> and <div align="center"> elements have been replaced by something newer?

So they can still be used but it is best to use the newer element - can anyone tell me what the newer element is.

Thanks.

encyclo

7:23 pm on Jul 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To answer more fully, the
center
and
font
elements as well as the
align
and
border
attributes have been deprecated in XHTML 1.0 Transitional (so they are valid but not recommended), and they have been removed from XHTML 1.0 Strict. The
u
element has been removed entirely.

CSS replaces presentational markup, so you just can use the CSS equivalents in each case.

manicman

8:02 pm on Jul 18, 2006 (gmt 0)

10+ Year Member



Thanks encyclo.

SO is there a tag that I can use in XHTML Strict to replace the border tag which will enable me to remove the border from around my picture?

Thanks,

Ingolemo

8:20 pm on Jul 18, 2006 (gmt 0)

10+ Year Member



Like encyclo said, use CSS.
(specifically
a img {border-width:0;}
)

[edited by: Ingolemo at 8:21 pm (utc) on July 18, 2006]

manicman

8:26 pm on Jul 18, 2006 (gmt 0)

10+ Year Member



Thanks.

Sorry that will teach me to read posts properly! :)

JAB Creations

2:50 pm on Jul 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Horizontally center an inline element...

element.class {
text-align: center;
}

Horizontally center a block element...


element.class {
margin-left: auto;
margin-right: auto;
}

- John