CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   HTML & CSS (http://www.codingforums.com/forumdisplay.php?f=13)
-   -   DIV with fixed width in TD with colspan (http://www.codingforums.com/showthread.php?t=276872)

see613 10-14-2012 12:20 PM

DIV with fixed width in TD with colspan
 
My code:

Code:

<table style="width: 500px;">
        <tr>
            <td colspan="5">
                <div style="width: 500px;">colspan_5</div>
            </td>             
        </tr>
        <tr>
            <td colspan="1">
                <div style="width: 100px;">colspan_1</div>
            </td>
            <td colspan="3">
                <div style="width: 300px;">colspan_3</div>
            </td>               
            <td colspan="1">
                <div style="width: 100px;">colspan_1</div>
            </td>             
        </tr> 
        <tr>
            <td colspan="2">
                <div style="width: 200px;">colspan_2</div>
            </td>
            <td colspan="3">
                <div style="width: 300px;">colspan_3</div>
            </td>               
        </tr>
        <tr>
            <td colspan="5">
                <div style="width: 500px;">colspan_5</div>
            </td>                               
        </tr>
</table>​

But result looks wrong. (jsfiddle_example)

How can I fix it?

aaronhockey_09 10-14-2012 04:36 PM

You need to set the width to your TR not just the div inside of it
Although i do no recommend creating a site like this, with tables or inline css.

aaronhockey_09 10-14-2012 04:36 PM

I mean the width of your TD not TR - sorry about the confusion

see613 10-14-2012 06:08 PM

This table is simplified example for jQuery widget.
Your changes works correctly only in Chrome.
http://jsfiddle.net/uDwa4/10
May be something else?


All times are GMT +1. The time now is 08:08 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.