From: Beauregard T. Shagnasty on
coltrane wrote:

> thanks, adding margin:auto resulted in centered text. Strange the book
> I have only has the width and the text-align set. I even downloaded
> their examples and it also didn't work correctly.
>
> http://www.jprokassociates.com/cssexamples/pagewithmargin.html
> http://www.jprokassociates.com/cssexamples/pagewithoutmargin.html

Don't be dragged into using the HTML comment markers those pages have in
the CSS. They're left over from Netscape 3 ...

--
-bts
-Four wheels carry the body; two wheels move the soul
From: Thomas 'PointedEars' Lahn on
coltrane wrote:

> Thomas 'PointedEars' Lahn wrote:
>> coltrane wrote:
>>> [...] Actually width doesn't seem to have any effect
>>> whether I use pixels or percent. The only way to get the text to not
>>> take up the entire width of the browser is by specifying a margin.
>>> It does seem that the width should do it but it doesn't.
>>
>> It is the reverse here: margin-*: auto without setting the width does not
>> center the block. Probably you are setting the width of the wrong
>> element, or your markup or CSS is syntactically wrong.
>>
>> <http://validator.w3.org/>
>> <http://jigsaw.w3.org/css-validator/>
>
> thanks, adding margin:auto resulted in centered text.

You probably don't want `margin: auto' which sets all margins to automatic
width, but margin: … auto. The ellipsis would be one value to set the top
and bottom margins alike.

> Strange the book I have only has the width and the text-align set.

There are many bad books. Ask for a refund, if centering is what they
wanted to show.

> I even downloaded their examples and it also didn't work correctly.
>
> http://www.jprokassociates.com/cssexamples/pagewithmargin.html
> http://www.jprokassociates.com/cssexamples/pagewithoutmargin.html

Is that your code or theirs? It has a number of problems: It is not Valid,
and the stylesheet is commented out (which really means that in XHTML).

Please trim your quotes to the relevant minimum.


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7(a)news.demon.co.uk> (2004)
From: coltrane on
thanks
From: coltrane on
while I'm here, can you recommend a book? I have been using oreilly's
cookbook and the first edition of the definitive guide which I guess I
should get the latest edition.
From: Thomas 'PointedEars' Lahn on
coltrane wrote:

> while I'm here, can you recommend a book?

No, sorry, the Web sufficed for me to date.

> I have been using oreilly's cookbook and the first edition of the
> definitive guide which I guess I should get the latest edition.

Perhaps. Who is the author (O'Reilly is only the publisher)?


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee