text-align:center does not render correctly

VERIFIED INVALID

Status

()

VERIFIED INVALID
17 years ago
17 years ago

People

(Reporter: donb, Assigned: asa)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

17 years ago
In this sample HTML, "First Link" is not center justified.  Text should render 
in center of defined 680px wide box.  Width seems to be ignored - "Next Link" 
appears immediately after first link.

<HTML>
<BODY>

<a href="#" style="width:680px;text-align:center">
First Link
</a>

<a href="#">Next Link</a>

</BODY>
</HTML>

Comment 1

17 years ago
Created attachment 71319 [details]
test case

I think that the real point of this bug report is that Don wants the "first
link" to have the width of 680px's?

If so, I can't remember if inline elements should honor width or height. 
Sending over to style system.  I made a new testcase that has an image included
just to show mozilla does honor width and height for styling images.

Comment 2

17 years ago
Don, if your problem with mozilla is that you want to set the width to the
anchor, I would suggest that you change the "Summary" title to can't set width
for anchor...

Again my revised testcase shows that mozilla does not render either width or
height for anchors but does for images.  Also, my testcase shows that IE6
renders just like mozilla 2-24 build for WinXP.
Component: Browser-General → Style System

Comment 3

17 years ago
This is invalid.
the link is an inline element, so you can't set its width. You can do it if you
add this rule to its style: display:block;
Status: UNCONFIRMED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → INVALID

Comment 5

17 years ago
I think that this may be a better explaination why you can't set width for
inline elements instead of text-align... from wc site
(http://www.w3.org/TR/REC-CSS2/visudet.html#propdef-width):

This property does not apply to non-replaced inline-level elements. The width of
a non-replaced inline element's boxes is that of the rendered content within
them (before any relative offset of children).

Alfonso is right you need to set the anchor to block to set its width and center
the text. :-)
You need to log in before you can comment on or make changes to this bug.