<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>6262</bug_id>
          
          <creation_ts>2005-12-27 14:45:36 -0800</creation_ts>
          <short_desc>Centering table within a absolute positioned div does not work</short_desc>
          <delta_ts>2005-12-28 07:07:23 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>420+</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>4860</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Lucas Kruijswijk">L.B.Kruijswijk</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>26829</commentid>
    <comment_count>0</comment_count>
    <who name="Lucas Kruijswijk">L.B.Kruijswijk</who>
    <bug_when>2005-12-27 14:45:36 -0800</bug_when>
    <thetext>Hi All,

I am checking my website with safari, but I can&apos;t in any way center
a table (the whole table) within a div that is positioned absolutely.

This is really irritating, because I can&apos;t find a good work arround.

The code is like this (I am using strict XHTML):

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 
Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;/&gt;
&lt;meta http-equiv=&quot;Expires&quot; content=&quot;0&quot;/&gt;
&lt;meta http-equiv=&quot;Pragma&quot; content=&quot;no-cache&quot;/&gt;
&lt;title&gt;SHODKA TEST&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h4&gt;Test A&lt;/h4&gt;
&lt;div style=&quot;text-align: left; position: absolute; left: 0px; top: 100px&quot;&gt;
&lt;table style=&quot;margin-left: auto; margin-right: auto&quot;&gt;
&lt;tr&gt;&lt;th&gt;c&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;c&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;xxxxxxx&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;

Regards Lucas.
Let me know if there is a workaround.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26835</commentid>
    <comment_count>1</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2005-12-27 14:53:00 -0800</bug_when>
    <thetext>In this case, it shouldn&apos;t matter (as this sounds like a RenderLayer issue), but are you serving this page as 
text/xml or as text/html?  If you&apos;re serving it as html, you&apos;ll go through the HTML parser, even though 
your document is conformant XHTML 1.0.  You can find out which, by pointing http://web-sniffer.net/ at 
your site, or using &quot;curl -I &lt;your url&gt;&quot;  Either will tell you how your server is vending the content.

FYI, it&apos;s also best to attach the test cases as files (instead of comments) in the future.  doing so now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26836</commentid>
    <comment_count>2</comment_count>
      <attachid>5313</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2005-12-27 14:53:50 -0800</bug_when>
    <thetext>Created attachment 5313
Test case as attachement</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26837</commentid>
    <comment_count>3</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2005-12-27 14:55:07 -0800</bug_when>
    <thetext>It&apos;s not clear to me from the test case what we&apos;re suposed to be seeing.  but comparing with firefox, it 
appears our behavior is wrong in this regard.

I bet we already have a bug tracking this somewhere.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26854</commentid>
    <comment_count>4</comment_count>
    <who name="Lucas Kruijswijk">L.B.Kruijswijk</who>
    <bug_when>2005-12-27 15:27:29 -0800</bug_when>
    <thetext>If you remove the &apos;div&apos;, then Safari will center the table.

There are in principle two ways to center a table:
- Set text-align to &apos;center&apos;.
  This is the old way.
- According to CSS it should be 
  as in the test case. Setting margin-left and margin-right
  to &apos;auto&apos;.

Anyway, I spend a whole evening to get it centered within a div
that has an absolute positioning. But Safari wouldn&apos;t listen to me:

I tried:
- Setting text-align in the &apos;div&apos; on &apos;center&apos;.
- Using &apos;&lt;center&gt;&apos; tag.
- Using align=&apos;center&apos;
- Using an additional div
- Using an additional div with fixed width.
- Using content on text/html and text/xml (as suggested in the comments).
- Using a table within a table.

It won&apos;t work. Safari can&apos;t center a table within a div that has position
on absolute.

Therefor, I consider this is bug rather sever.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26991</commentid>
    <comment_count>5</comment_count>
      <attachid>5333</attachid>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2005-12-28 03:35:40 -0800</bug_when>
    <thetext>Created attachment 5333
Testcase

What happens here, is that when firefox has a table within a &lt;div&gt; it
automatically adjusts the div&apos;s width to 100%, even if the table has no width
of it&apos;s own.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26992</commentid>
    <comment_count>6</comment_count>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2005-12-28 03:40:07 -0800</bug_when>
    <thetext>The behavior for the testcase is the same for both firefox and ie.mac. I personally do not agree that this is 
a bug, i think firefox and ie render it wrong. I may be wrong ofcourse :). The fix is shown in the testcase 
though, so reporter: add width:100% to the containg div and you should be ok.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26993</commentid>
    <comment_count>7</comment_count>
      <attachid>5334</attachid>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2005-12-28 03:40:44 -0800</bug_when>
    <thetext>Created attachment 5334
Testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27009</commentid>
    <comment_count>8</comment_count>
    <who name="Lucas Kruijswijk">L.B.Kruijswijk</who>
    <bug_when>2005-12-28 05:17:09 -0800</bug_when>
    <thetext>I do not agree with the comments of Joost.

Although, I got one situation where I could get a table centered within
a div with position on &apos;absolute&apos;, I don&apos;t get it in all situations.

I think there is a rule of thumb:
- Where you can center text, it should be possible to center 
  a table.

This is certainly NOT the case. Safari is very, very persistent in not
centering the table.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27017</commentid>
    <comment_count>9</comment_count>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2005-12-28 07:07:23 -0800</bug_when>
    <thetext>This seems to be harder than i thought. But, as well it is a dupe, namely of 4860. Marking it as such.

*** This bug has been marked as a duplicate of 4860 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>5313</attachid>
            <date>2005-12-27 14:53:50 -0800</date>
            <delta_ts>2005-12-28 03:35:40 -0800</delta_ts>
            <desc>Test case as attachement</desc>
            <filename>center.xhtml</filename>
            <type>application/xhtml+xml</type>
            <size>609</size>
            <attacher name="Eric Seidel (no email)">eric</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBYSFRNTCAxLjAgClN0cmljdC8vRU4i
ICJodHRwOi8vd3d3LnczLm9yZy9UUi94aHRtbDEvRFREL3hodG1sMS1zdHJpY3QuZHRkIj4KPGh0
bWwgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPgo8aGVhZD4KPG1ldGEgaHR0
cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9aXNvLTg4
NTktMSIvPgo8bWV0YSBodHRwLWVxdWl2PSJFeHBpcmVzIiBjb250ZW50PSIwIi8+CjxtZXRhIGh0
dHAtZXF1aXY9IlByYWdtYSIgY29udGVudD0ibm8tY2FjaGUiLz4KPHRpdGxlPlNIT0RLQSBURVNU
PC90aXRsZT4KPC9oZWFkPgo8Ym9keT4KPGg0PlRlc3QgQTwvaDQ+CjxkaXYgc3R5bGU9InRleHQt
YWxpZ246IGxlZnQ7IHBvc2l0aW9uOiBhYnNvbHV0ZTsgbGVmdDogMHB4OyB0b3A6IDEwMHB4Ij4K
PHRhYmxlIHN0eWxlPSJtYXJnaW4tbGVmdDogYXV0bzsgbWFyZ2luLXJpZ2h0OiBhdXRvIj4KPHRy
Pjx0aD5jPC90aD48L3RyPgo8dHI+PHRkPmM8L3RkPjwvdHI+Cjx0cj48dGQ+eHh4eHh4eDwvdGQ+
PC90cj4KPC90YWJsZT4KPC9kaXY+Cgo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>5333</attachid>
            <date>2005-12-28 03:35:40 -0800</date>
            <delta_ts>2005-12-28 03:40:44 -0800</delta_ts>
            <desc>Testcase</desc>
            <filename>centering-issues.html</filename>
            <type>text/html</type>
            <size>636</size>
            <attacher name="Joost de Valk (AlthA)">joost</attacher>
            
              <data encoding="base64">PHA+CglUaGVzZSB0d28gZGl2cyBiZWxvdyBhcmUgdGhlIHNhbWUsIGV4Y2VwdCBmb3Igb25lIHRo
aW5nLCB0aGUgZmlyc3QgZGl2IGlzIGdpdmVuIAoJPHR0PndpZHRoOiAxMDAlOzwvdHQ+LCB0aGUg
c2Vjb25kIGhhcyBubyB3aWR0aC4gRmlyZWZveCBnaXZlcyBib3RoIGEgMTAwJSB3aWR0aCwKCVNh
ZmFyaSBqdXN0IHRoZSBmaXJzdCBvbmUuIElmIHlvdSBjaGFuZ2UgdGhlIHRhYmxlcyBpbnNpZGUg
dGhlIGRpdiBpbnRvIGEgCglwYXJhZ3JhcGgsIHRoZSBwcm9ibGVtIGlzIGdvbmUuCjwvcD4KPGRp
diBzdHlsZT0idGV4dC1hbGlnbjogY2VudGVyOyBwb3NpdGlvbjogYWJzb2x1dGU7IGxlZnQ6IDBw
eDsgdG9wOiAxMDBweDsgYm9yZGVyOiAxcHggc29saWQgIzAwMDsgd2lkdGg6IDEwMCU7Ij4KCTx0
YWJsZSBzdHlsZT0ibWFyZ2luOiAwIGF1dG87Ij48dHI+PHRkPlRlc3Q8L3RkPjwvdHI+PC90YWJs
ZT4KPC9kaXY+CjxkaXYgc3R5bGU9InRleHQtYWxpZ246IGNlbnRlcjsgcG9zaXRpb246IGFic29s
dXRlOyBsZWZ0OiAwcHg7IHRvcDogMjAwcHg7IGJvcmRlcjogMXB4IHNvbGlkICMwMDA7Ij4KCTx0
YWJsZSBzdHlsZT0ibWFyZ2luOiAwIGF1dG87Ij48dHI+PHRkPlRlc3Q8L3RkPjwvdHI+PC90YWJs
ZT4KPC9kaXY+
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>5334</attachid>
            <date>2005-12-28 03:40:44 -0800</date>
            <delta_ts>2005-12-28 03:40:44 -0800</delta_ts>
            <desc>Testcase</desc>
            <filename>centering-issues.html</filename>
            <type>text/html</type>
            <size>596</size>
            <attacher name="Joost de Valk (AlthA)">joost</attacher>
            
              <data encoding="base64">PHA+CglUaGVzZSB0d28gZGl2cyBiZWxvdyBhcmUgdGhlIHNhbWUsIGV4Y2VwdCBmb3Igb25lIHRo
aW5nLCB0aGUgZmlyc3QgZGl2IGlzIGdpdmVuIAoJPHR0PndpZHRoOiAxMDAlOzwvdHQ+LCB0aGUg
c2Vjb25kIGhhcyBubyB3aWR0aC4gRmlyZWZveCBnaXZlcyBib3RoIGEgMTAwJSB3aWR0aCwKCVNh
ZmFyaSBqdXN0IHRoZSBmaXJzdCBvbmUuIElmIHlvdSBjaGFuZ2UgdGhlIHRhYmxlcyBpbnNpZGUg
dGhlIGRpdiBpbnRvIGEgCglwYXJhZ3JhcGgsIHRoZSBwcm9ibGVtIGlzIGdvbmUuCjwvcD4KPGRp
diBzdHlsZT0icG9zaXRpb246IGFic29sdXRlOyBsZWZ0OiAwcHg7IHRvcDogMTAwcHg7IGJvcmRl
cjogMXB4IHNvbGlkICMwMDA7IHdpZHRoOiAxMDAlOyI+Cgk8dGFibGUgc3R5bGU9Im1hcmdpbjog
MCBhdXRvOyI+PHRyPjx0ZD5UZXN0PC90ZD48L3RyPjwvdGFibGU+CjwvZGl2Pgo8ZGl2IHN0eWxl
PSJwb3NpdGlvbjogYWJzb2x1dGU7IGxlZnQ6IDBweDsgdG9wOiAyMDBweDsgYm9yZGVyOiAxcHgg
c29saWQgIzAwMDsiPgoJPHRhYmxlIHN0eWxlPSJtYXJnaW46IDAgYXV0bzsiPjx0cj48dGQ+VGVz
dDwvdGQ+PC90cj48L3RhYmxlPgo8L2Rpdj4=
</data>

          </attachment>
      

    </bug>

</bugzilla>