Center a theme A Theme

Center a theme A Theme

by Jason Grey -
Number of replies: 6

Hi I am wondering how do I Centre a theme that I Created that I have attached an screen dump of which that i have created from a sample Moodle Theme.

If someone can help me that Be great to Centre the Theme in the middle of the Webpage.

Thank You
Jason Grey

Attachment moodle_screen_print.JPG
Average of ratings: -
In reply to Jason Grey

Re: Center a theme A Theme

by Frank Ralf -
Hi Jason,

The secret of centering an element on a page is setting both its left and right margin to "auto". Try something like:

body {
margin-left: auto;
margin-right: auto;
}

See also Center Forum Posts.

hth
Frank

PS:
CSS FAQ and Themes FAQ are good starting points for learning more about CSS and theming.
In reply to Frank Ralf

Re: Center a theme A Theme

by Jason Grey -

Hi Frank
Where do I put this code

body {
margin-left: auto;
margin-right: auto;
}

In he header or the footer of the post.

Jason

In reply to Jason Grey

Re: Center a theme A Theme

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
It already looks centred in the middle of the web page! It has equal margins either side.

In a lower resolution, say about 1024 x 768, it would look much better and easier to read.
In fact if you are not using a fluid theme layout then it's better to stick with 1024 x 768 resolution.
If you don't know how to do this there's an article HERE you can read which explains it quite well.

However, if you want to make your theme FLUID, by this I mean it will expand and contract to fit any screen resolution, then you need to change the #layout-table width to 100%

but fix the side-columns to stay with 210px, and change middle-column to 100% this will allow the middle section of your page to adapt to the various page views when it will take up all the page in some cases when the sideblocks are not present.

Hope this is what you are asking to do.

If you're not sure how to do this say so, and we can help you further.

Cheers

Mary

In reply to Jason Grey

Re: Center a theme A Theme

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Jason,

I've just been looking at your website given in your profile, and see that on that website you have use this code which fixes the page in both height and width...

<iframe height="1217" width="1664" src="http://lithgowcommunitycollegeonline.enwebsolutions.com/" name="I1">

If you have your Moodle site set to these fixed dimensions you need to follow my earlier suggestion to set your layout-table to 100% and margins as suggested by Frank.

Hope this helps?

Mary