PDA

View Full Version : centre iframe within a simple table



pwcircuits
08-08-2012, 01:20 PM
Hello all,

I'm trying to centre the iframe containing the facebook app on my website inside a simple table. I've scanned through a few internet pages and tried the suggestions ( including one on here from last year ) but nothing seems to shift it from it's left hand margin. :confused:

The website is:

www.pwcircuits.co.uk

and it's the group of social button at the bottom left, you'll see the pesky facebook.

Any help would be gratefully received !

Thanks. :cool:

williamsun
08-08-2012, 09:58 PM
The easiest way is to center the <td> it is in.
<td align="center">

If more stuff is in the same <td>, split it into its own table division and center that.

That's provided the iFrame is only as wide as the icons. If it's 100% width of the outer cell or something, size down the iFrame and it will center.

I didn't look at your code, so I hope that helps.

pwcircuits
08-15-2012, 12:57 PM
Hmm tried that but coudn't seem to get it to shift, the iframe size is the same as the facebook icon ( i think ) and is smaller that the frame. might need someone to quickly scan that part of the code to point out where i'm going wrong? :confused:

keyboard
08-16-2012, 12:27 AM
Try adding style="margin:auto;" to the problematic iframe or style="text-align:center;" to it's parent tag.


Tables for content layout
From the looks of your website, you're using tables for the layout of your content.
Tables can only be used for tabular data! Using tables for layout is depricated by all modern standards!
The correct way to program the layout of your site is using css (http://www.tizag.com/cssT/) and divs (http://www.tizag.com/htmlT/htmldiv.php).
Using tables can bring about a whole pile of problems for your site.
You should never use tables for layout.


:eek:

Also around line 350, there is this -

<p ALIGN=center>
However all your other tags are lowercase. One of the main things to try and keep to is consistancy!
(P.s. You should never use uppercase tags anyway)


Also, you're using font tags; in modern standards they're depricated.
You have to use <tag style=""></tag> where tag is the tag of your choice (I normally use span tags to do what a font tag would do).

At least you're not using <center> tags! :)

pwcircuits
08-16-2012, 12:28 PM
thanks for the reply and help but it doesn't shift.

Your right of course with the tables, I'm only a amateur web builder - the design was from a pre brought template, but I finding the site now starting to 'creak' a little under all the changes to html etc ....., but it's having the time & knowledge to update it.

Think I'll just live with it not lining up for the mo, I'm sure potential customers aren't going to be put off buying from us because the Facebook logo isn't centred ;)