garedeuropa: (Default)
Anna Ghislaine ([personal profile] garedeuropa) wrote in [community profile] getting_started2011-11-27 11:25 am

Centre-aligned journal with css

I'd like to have my journal centred horizontally. I find my journal's default layout too wide to read comfortably, so I used body {width:70%;} to narrow it. However, it won't budge from the left side of the screen. I've tried align:center, float:center, and auto left and right margins. Having it all on the left leaves a distracting block of white space on the right, so I'd much prefer the journal in the middle.
dancing_serpent: (Default)

[personal profile] dancing_serpent 2011-11-27 11:38 am (UTC)(link)
so I used body {width:70%;} to narrow it.

I believe it should work if you deleted that again and then simply changed the margin size here: http://www.dreamwidth.org/customize/options
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)

[personal profile] chagrined 2011-11-27 03:29 pm (UTC)(link)
You don't want to change the width on "body": you can't set margins on that (b/c "body" is your parent display element, if you will, the thing within which everything else that you see sits, so you can't tell it to be evenly spaced inside of another element).

Instead, you want to set the width and margins on the first child div inside body, which is called #canvas.

So for your CSS:

#canvas { width: 70%; margin-left: auto; margin-right: auto; }

That ought to do it! :)