/    Sign up×
Community /Pin to ProfileBookmark

align table inside a table

Hi Y’all, sorry I haven’t been here in a while.

I’ve recently started studying CSS and I’m trying to get the hang of it.
I’m so used to the old html method it’s hard to break.

I have a table inside a table, and I can align right using the old method,
but I cannot seem to align right using CSS.

old method, (and still works)

[CODE]
<table><tr><td align=”right”>
<table><tr><td> text </td></tr></table>
</td></tr></table>
[/CODE]

new method

[CODE]
<table><tr><td style=”text-align:right”>
<table><tr><td> text </td></tr></table>
</td></tr></table>
[/CODE]

I have tried as many ways as I could to get it to work,
just short of banging on the monitor.

to post a comment
CSS

8 Comments(s)

Copy linkTweet thisAlerts:
@anothenauthorJun 16.2014 — sorry, I think I found it

styles="float:right"

it's not working as I wanted, but I think I can make due.
Copy linkTweet thisAlerts:
@deathshadowJun 16.2014 — My question would be why do you have a table inside a table? Are you using tables for layout like it's still 1997 or something?

Really that's something you shouldn't even have in your markup in the first place if you are using tables for tabular data... It's almost as silly as making tables where there are only one TD per TR. (or one TR for the whole table for that matter).

Though if it IS tabular data, without seeing a sample OF that data it's hard to say what the proper markup OR proper CSS would be.
Copy linkTweet thisAlerts:
@anothenauthorJun 16.2014 — nope, it's not working right.
Copy linkTweet thisAlerts:
@anothenauthorJun 16.2014 — My question would be why do you have a table inside a table? Are you using tables for layout like it's still 1997 or something?

Really that's something you shouldn't even have in your markup in the first place if you are using tables for tabular data... It's almost as silly as making tables where there are only one TD per TR. (or one TR for the whole table for that matter).

Though if it IS tabular data, without seeing a sample OF that data it's hard to say what the proper markup OR proper CSS would be.[/QUOTE]


I have code from years ago and all of it was assembled using tables.

I wanted to convert all of it to CSS so I could learn CSS.

Most all of it is calculating numbers so alignment is critical.

If you think I should move away from tables, I probably could.

Just about the time I learned html 4.01, several generations have

passed me by.

http://www.anothenservices.com/calculator/wallcalc.html
Copy linkTweet thisAlerts:
@deathshadowJun 16.2014 — Ok, looking at what you have, the INNER tables are sufficiently 'tabular' I'd say sure, use a table on that... but your OUTER tables, and in fact most of the tables on your page serve NO legitimate purpose. The table around the H1? Pointless. The table around the other tables? Pointless.

Of course, your original has two doctypes, so that's kinda funny.

Sadly, when most people "learned" HTML 4.01 they never actually learned HTML... there were so many bad practices and pointless coding methods still in circulation, nobody back then was able to even learn what HTML is or how to use it right; a trend that sadly continues to this day.

One of the keys to learning to use CSS is rethinking how your HTML is built... particularly if you learned the -- what we now call sloppy and bad -- method of building sites with endless "table for nothing".

... even using tables -- you seem to have multiple tables doing the job of one table -- you have no relationship between the rows, they're multiple tables side-by-side for... well, I don't know what for. If everything is on a row, put them in a TR, if that means empty TD, so be it. Empty TD is certainly better than trying to make multiple side-by-side-by-side tables line up with each-other.

Even back then, you've got a whole slew of markup for nothing, and most of it is tables for nothing; that page should have -- by my reckoning -- six tables for the actual tabular data; there should be no tables inside tables, H1 inside tables -- hell if you're going to use tables the heading text for each table you have inside <br> should be a CAPTION.
Copy linkTweet thisAlerts:
@anothenauthorJun 16.2014 — Thanks Shadow,

Yeah, the newer version I'm using html 5, your seeing my original.

All of the javascript code works just fine as long as I maintain

all of it within the form. What I'll do is start experimenting using

a minimum of tables. I'm still stumbling through CSS, but I see it

as a great benefit from having to endlessly repeat the same styling code.
Copy linkTweet thisAlerts:
@VeeramanikandanJun 18.2014 — Use this code for displaying nested table and also inner table contain align to right.


<table>

<tr>

<td>

<table style="float:right:">

<tr>

<td></td>

<td></td>

</tr>

</table>

</td>

</tr>

</table>
×

Success!

Help @anothen spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...