From: Beauregard T. Shagnasty on
coltrane wrote:

> What I get is justified text set at the correct width
> but the text is set against the left side.

See other replies about setting your container:
margin-left: auto; margin-right: auto;

You'd probably also get better (flexible) results by setting the width
of the container as a percentage. Your pixels ain't the same as my
pixels. Or the width of my browser window.
width: 75%;

--
-bts
-Four wheels carry the body; two wheels move the soul
From: coltrane on
On 6/15/2010 11:44 AM, Beauregard T. Shagnasty wrote:
> coltrane wrote:
>
>> What I get is justified text set at the correct width
>> but the text is set against the left side.
>
> See other replies about setting your container:
> margin-left: auto; margin-right: auto;
>
> You'd probably also get better (flexible) results by setting the width
> of the container as a percentage. Your pixels ain't the same as my
> pixels. Or the width of my browser window.
> width: 75%;
>
thanks for the reply. 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.
From: Chris F.A. Johnson on
On 2010-06-15, coltrane wrote:
> On 6/15/2010 11:44 AM, Beauregard T. Shagnasty wrote:
>> coltrane wrote:
>>
>>> What I get is justified text set at the correct width
>>> but the text is set against the left side.
>>
>> See other replies about setting your container:
>> margin-left: auto; margin-right: auto;
>>
>> You'd probably also get better (flexible) results by setting the width
>> of the container as a percentage. Your pixels ain't the same as my
>> pixels. Or the width of my browser window.
>> width: 75%;
>>
> thanks for the reply. Actually width doesn't seem to have any effect
> whether I use pixels or percent.

It may not on *your* browser; it may on other people's.

> 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.

Without knowing exactly what you are doing, it's impossible to tell
why it doesn't work. Please post a URL.

--
Chris F.A. Johnson <http://cfajohnson.com>
===================================================================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
From: Thomas 'PointedEars' Lahn on
coltrane wrote:

> Beauregard T. Shagnasty wrote:
>> coltrane wrote:
>>> What I get is justified text set at the correct width
>>> but the text is set against the left side.
>>
>> See other replies about setting your container:
>> margin-left: auto; margin-right: auto;
>>
>> You'd probably also get better (flexible) results by setting the width
>> of the container as a percentage. Your pixels ain't the same as my
>> pixels. Or the width of my browser window.
>> width: 75%;
>
> thanks for the reply. 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/>


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
From: coltrane on
On 6/15/2010 1:48 PM, Thomas 'PointedEars' Lahn wrote:
> coltrane wrote:
>
>> Beauregard T. Shagnasty wrote:
>>> coltrane wrote:
>>>> What I get is justified text set at the correct width
>>>> but the text is set against the left side.
>>>
>>> See other replies about setting your container:
>>> margin-left: auto; margin-right: auto;
>>>
>>> You'd probably also get better (flexible) results by setting the width
>>> of the container as a percentage. Your pixels ain't the same as my
>>> pixels. Or the width of my browser window.
>>> width: 75%;
>>
>> thanks for the reply. 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/>
>
>
> PointedEars
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