Wednesday, 8 December 2010
So many of us were having problems centralising our websites for Web Design 2.
I feel kinda stupid now that I've found the solution to be so simple.
I kept telling people that I had no idea how to centralise the website using CSS, so I kept advising them to use the "margin-left" property.
After some research (looking at the source code of perfectly centralised sites) and other research (Googling key words), I found out that I was going about it in the wrong way.
We were heading in the right direction with the use of the "margin" property, but we sorta got it wrong when we assigned it values.
Ok, long story short, this is how it's done:
And that is that is all is all. Simple right? *facepalm*
I need to configure some awesome styling thing for code snippet posting. >_<
Read more »
I feel kinda stupid now that I've found the solution to be so simple.
I kept telling people that I had no idea how to centralise the website using CSS, so I kept advising them to use the "margin-left" property.
After some research (looking at the source code of perfectly centralised sites) and other research (Googling key words), I found out that I was going about it in the wrong way.
We were heading in the right direction with the use of the "margin" property, but we sorta got it wrong when we assigned it values.
Ok, long story short, this is how it's done:
body
{
text-align: center;
}
div#container
{
margin-left: auto;
margin-right: auto;
width: 50em;
text-align: left;
}
And that is that is all is all. Simple right? *facepalm*
I need to configure some awesome styling thing for code snippet posting. >_<
Labels: CSS, short, useful tip, Web Design
;;
Subscribe to:
Posts (Atom)