On Sun, 3 Jun 2001, StOo wrote:
>>
>> That's because the paragraph in the table is being given margins. Add the
>> folowing to your stylesheet to fix it:
>>
>>    td p { margin: 0; }
>
> thanks for your speedy reply.. i really do appreciate it. unfortunately,
> that change, although it kinda fixed my problem, knocked all my paragraphs
> within <td> together (i.e. no space between *any* table paragraphs) and made
> the site look very messy (it had this effect in all browsers). i've reverted
> to the previous stylesheet until i can find a way to fix it. i'll prolly end
> up having to apply a 0 margin to specific tables/cells instead of across the
> site. *sigh*

The "correct" solution is to change the <p> with the margins to an <h1>
and then say

   h1 { margin: 0; }

I was trying to give you the simplest solution.

As others have remarked, though, you shouldn't really use tables when you
are not trying to draw tabular data. See, for example, the markup of:

   http://www.libpr0n.com/

...in Mozilla. (That site has not been tweaked to work in any other
browser, though.)


>> "text-align: center" means "align text to the center". What you want to do
>> is tell it to align the _block_ to the center. Replace the "text-align:
>> center" part of your rule for ".center" and replace it with "margin: 0
>> auto". That should center it in any standard compliant browser.
>
> hmm.. ok, can you explain to me why "margin: 0 auto" *will* centralise a
> table if the modified "center" class is called within the <table> tag but it
> *won't* centralise a paragraph with an image in it if the "center" class is
> called within the <p> tag or the <img> tag?

Because the image inside the paragraph is considered to be text. (If you
put text around it, it would flow along with the text.)


> what elements does "margin: 0 auto" work with and what is a suitable
> compliant alternative to use to center this image?

To center the image, tell it it is a block:

   img { display: block; }

...and then give it auto horizontal margins:

   img { display: block; margin: 0 auto; }

That will center your image.


> jeez, sorry about all the n00b questions.. feel free to say "look it
> up yourself!" :)

http://www.w3.org/TR/REC-CSS2/ :-)

-- 
Ian Hickson                                     )\     _. - ._.)       fL
Netscape, Standards Compliance QA              /. `- '  (  `--'
+1 650 937 6593                                `- , ) -  > ) \
irc.mozilla.org:Hixie _________________________  (.' \) (.' -' __________

Reply via email to