You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@forrest.apache.org by Irrra <ir...@gmail.com> on 2008/09/02 03:38:05 UTC

How to create a table with fixed width (and fixed width of the cells)?

Hi, 

I have a problem. I need to create several tables of the same (fixed width) 
with the fixed widths of columns. What I'm getting are tables of the
different width with the widths of the columns different that the ones I'm
specifying. On the top of that the layout changes when I'm resizing the
window (the width of the table and its columns changes). How to fix it? 

I'm working with pelt skin and trying to use something like this:

<table width="600">
  <tr align="left" valign="top">
    <td width="400">
       <p>test test test test</p>
</td>
    <td width="200" bgcolor="#FFFFFF"> 
../resources/images/Fotolia_7868578_XS.jpg </td>
  </tr>
</table>

<table width="600">
  <tr align="left" valign="top">
    <td width="200" bgcolor="#FFFFFF">
../resources/images/Fotolia_2809691_XS.jpg </td>
    <td width="200" bgcolor="#FFFFFF"><p>test</p>
        <p class="regulartext">test</p></td>
<td> 
        <p>test</p>
    </td>

  </tr>
</table>
-- 
View this message in context: http://www.nabble.com/How-to-create-a-table-with-fixed-width-%28and-fixed-width-of-the-cells%29--tp19262991p19262991.html
Sent from the Apache Forrest - Users mailing list archive at Nabble.com.


Re: How to create a table with fixed width (and fixed width of the cells)?

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Tue, 2008-09-02 at 10:58 -0700, Irrra wrote:
> The problem is still there :(
> 

well, I did not test the css but now I did. In my first response the
display:block was missing. However that is css.

Index: src/documentation/skinconf.xml
===================================================================
--- src/documentation/skinconf.xml	(revision 691565)
+++ src/documentation/skinconf.xml	(working copy)
@@ -186,6 +186,11 @@
       background-color: #f0f0f0;
       font-family: monospace;
     }
+    
+    table.width200{
+      width: 200px;
+      display:block;
+    }
     <!--Example:
         To override the colours of links only in the footer.
     -->
Index: src/documentation/content/xdocs/samples-b/sample.xml
===================================================================
--- src/documentation/content/xdocs/samples-b/sample.xml	(revision
691565)
+++ src/documentation/content/xdocs/samples-b/sample.xml	(working copy)
@@ -339,6 +339,21 @@
             </td>
           </tr>
         </table>
+        <p>
+          And now for a table with a fixed width:
+        </p>
+        <table class="width200">
+          <caption>Table caption</caption>
+          <tr>
+            <th>1</th>
+            <th>2</th>
+            <th>3</th>
+          </tr>
+          <tr>
+            <td>data1</td>
+            <td colspan="2">this data cell spans two columns</td>
+          </tr>
+        </table>

> 
> Thorsten Scherler-3 wrote:
> > 
> > On Mon, 2008-09-01 at 18:38 -0700, Irrra wrote:
> >> Hi, 
> >> 
> >> I have a problem. I need to create several tables of the same (fixed
> >> width) 
> >> with the fixed widths of columns. What I'm getting are tables of the
> >> different width with the widths of the columns different that the ones
> >> I'm
> >> specifying. On the top of that the layout changes when I'm resizing the
> >> window (the width of the table and its columns changes). How to fix it? 
> >> 
> >> I'm working with pelt skin and trying to use something like this:
> >> 
> >> <table width="600">
> > 
> > As you noticed the width attribute is not allowed. You need to use css
> > for it:
> > <table class="width600">
> > 
> > Then add to your skinconf within the <extra-css> block the css
> > definition:
> > table.width600{
> >  width: 600px;
> > }
> > 
> > HTH
> > 
> > salu2
> > 
> >>   <tr align="left" valign="top">
> >>     <td width="400">
> >>        <p>test test test test</p>
> >> </td>
> >>     <td width="200" bgcolor="#FFFFFF"> 
> >> ../resources/images/Fotolia_7868578_XS.jpg </td>
> >>   </tr>
> >> </table>
> >> 
> >> <table width="600">
> >>   <tr align="left" valign="top">
> >>     <td width="200" bgcolor="#FFFFFF">
> >> ../resources/images/Fotolia_2809691_XS.jpg </td>
> >>     <td width="200" bgcolor="#FFFFFF"><p>test</p>
> >>         <p class="regulartext">test</p></td>
> >> <td> 
> >>         <p>test</p>
> >>     </td>
> >> 
> >>   </tr>
> >> </table>
> > -- 
> > Thorsten Scherler                                 thorsten.at.apache.org
> > Open Source Java                      consulting, training and solutions
> > 
> > 
> > 
> 
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: How to create a table with fixed width (and fixed width of the cells)?

Posted by Irrra <ir...@gmail.com>.
The problem is still there :(


Thorsten Scherler-3 wrote:
> 
> On Mon, 2008-09-01 at 18:38 -0700, Irrra wrote:
>> Hi, 
>> 
>> I have a problem. I need to create several tables of the same (fixed
>> width) 
>> with the fixed widths of columns. What I'm getting are tables of the
>> different width with the widths of the columns different that the ones
>> I'm
>> specifying. On the top of that the layout changes when I'm resizing the
>> window (the width of the table and its columns changes). How to fix it? 
>> 
>> I'm working with pelt skin and trying to use something like this:
>> 
>> <table width="600">
> 
> As you noticed the width attribute is not allowed. You need to use css
> for it:
> <table class="width600">
> 
> Then add to your skinconf within the <extra-css> block the css
> definition:
> table.width600{
>  width: 600px;
> }
> 
> HTH
> 
> salu2
> 
>>   <tr align="left" valign="top">
>>     <td width="400">
>>        <p>test test test test</p>
>> </td>
>>     <td width="200" bgcolor="#FFFFFF"> 
>> ../resources/images/Fotolia_7868578_XS.jpg </td>
>>   </tr>
>> </table>
>> 
>> <table width="600">
>>   <tr align="left" valign="top">
>>     <td width="200" bgcolor="#FFFFFF">
>> ../resources/images/Fotolia_2809691_XS.jpg </td>
>>     <td width="200" bgcolor="#FFFFFF"><p>test</p>
>>         <p class="regulartext">test</p></td>
>> <td> 
>>         <p>test</p>
>>     </td>
>> 
>>   </tr>
>> </table>
> -- 
> Thorsten Scherler                                 thorsten.at.apache.org
> Open Source Java                      consulting, training and solutions
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-create-a-table-with-fixed-width-%28and-fixed-width-of-the-cells%29--tp19262991p19275246.html
Sent from the Apache Forrest - Users mailing list archive at Nabble.com.


Re: How to create a table with fixed width (and fixed width of the cells)?

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Mon, 2008-09-01 at 18:38 -0700, Irrra wrote:
> Hi, 
> 
> I have a problem. I need to create several tables of the same (fixed width) 
> with the fixed widths of columns. What I'm getting are tables of the
> different width with the widths of the columns different that the ones I'm
> specifying. On the top of that the layout changes when I'm resizing the
> window (the width of the table and its columns changes). How to fix it? 
> 
> I'm working with pelt skin and trying to use something like this:
> 
> <table width="600">

As you noticed the width attribute is not allowed. You need to use css
for it:
<table class="width600">

Then add to your skinconf within the <extra-css> block the css
definition:
table.width600{
 width: 600px;
}

HTH

salu2

>   <tr align="left" valign="top">
>     <td width="400">
>        <p>test test test test</p>
> </td>
>     <td width="200" bgcolor="#FFFFFF"> 
> ../resources/images/Fotolia_7868578_XS.jpg </td>
>   </tr>
> </table>
> 
> <table width="600">
>   <tr align="left" valign="top">
>     <td width="200" bgcolor="#FFFFFF">
> ../resources/images/Fotolia_2809691_XS.jpg </td>
>     <td width="200" bgcolor="#FFFFFF"><p>test</p>
>         <p class="regulartext">test</p></td>
> <td> 
>         <p>test</p>
>     </td>
> 
>   </tr>
> </table>
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: How to create a table with fixed width (and fixed width of the cells)?

Posted by "Rashmi.Patel" <ra...@unistal.com>.
Hi,

Please try out this.This will certainly work.
-------------------------------------------
<table width="100%" border="1" style="table-layout:fixed">
  <tr>
    <td width="30%" valign="top">Something goes here</td>    
	<td width="30%" valign="top">Something goes here</td>
    <td width="40%" valign="top">Something goes here</td>
  </tr>
</table>

-------------------------------------------



Irrra wrote:
> 
>  I need to create several tables of the same fixed width with the fixed
> widths of columns. What I'm getting are tables of the different width with
> the widths of the columns different that the ones I'm specifying. On the
> top of that the layout changes when I'm resizing the window (the width of
> the table and its columns changes). How to fix it? 

-- 
View this message in context: http://www.nabble.com/How-to-create-a-table-with-fixed-width-%28and-fixed-width-of-the-cells%29--tp19262991p20513411.html
Sent from the Apache Forrest - Users mailing list archive at Nabble.com.