Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [HTML] Keeping text from running up beside a table (https://thetfp.com/tfp/tilted-technology/99541-html-keeping-text-running-up-beside-table.html)

digby 01-05-2006 10:35 PM

[HTML] Keeping text from running up beside a table
 
I'm just starting to learn HTML/CSS, and I'm trying to figure out how to deal with tables that aren't the full width of my document. If I have another <p> section below the table, the first part of the text starts to the side of the top of the aforementioned table whenever I have the table aligned to the left or right.

I made a quick example to show you what I'm talking about.

Is there a way to align my table to one side or the other without the text wrapping around it?

Chamaeleontidae 01-06-2006 06:49 AM

Don't putting the alignment in the table tag. Leave the table tag without alignment, and then align the table as you would align text. Here is a link with some good information for you...

Code:

<p align="left">
<table border="1px" width="500">
        <tr>
                <td align="left" width="250"> Cell One</td>
                <td align="left" width="250"> Cell Two</td>
        </tr>
        <tr>
                <td align="left" width="250"> Cell Three</td>
                <td align="left" width="250"> Cell Four</td>
        </tr>
</table>
</p>


digby 01-06-2006 08:04 AM

Ah. I had tried the <p> tags around the paragraph, but it didn't work. That link however gave me what I was looking for:

Code:

<div align="right">
<table border="1px" width="500">
        <tr>
                <td align="left" width="250"> Cell One</td>
                <td align="left" width="250"> Cell Two</td>
        </tr>
        <tr>
                <td align="left" width="250"> Cell Three</td>
                <td align="left" width="250"> Cell Four</td>
        </tr>
</table>
</div>

That's what I wanted. Thanks!

A follow-up question: Is that usage of the <div> tag allowed in XHTML, or should I have defined that in CSS?

Chamaeleontidae 01-06-2006 09:37 AM

I am not sure if the div tag is ok for XHTML 1.0 Strict Specification. The follow code is happy in the transitional spec...


Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
</head>
<body>
<p>Hi there</p>
    <div style="text-align: right">
        <table border="1px" width="500" style="">
                <tr>
                        <td align="left" width="250" style="height: 23px"> Cell One</td>
                        <td align="left" width="250" style="height: 23px"> Cell Two</td>
                </tr>
                <tr>
                        <td align="left" width="250" style="height: 23px"> Cell Three</td>
                        <td align="left" width="250" style="height: 23px"> Cell Four</td>
                </tr>
        </table>
    </div>
<p>How are things going</p>
</body>
</html>


theFez 01-09-2006 09:42 PM

div is fine in xhtml, even encouraged.

<edit>oh, now i understand, is adding the alignment parameter allowed. not sure, but i would keep it in the css.</edit>


All times are GMT -8. The time now is 11:54 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73