No float:center in CSS
What float? Root beer float? Nope, I am talking about the CSS float command. CSS is definitely not a walk in the park to most blogger. Me included. I have no formal training on CSS and so far I have been relying on trial and errors and researches in Google. The most complicated project that I did for the blog was adding a 3-column widgetized footer that you can see today. It’s peanuts to some of you but a big achievement for me. Took me many days and had to combine solutions from various experts and/or so-called-experts just to get it working. And this post is related to that footer.
After completing the 3-column widgetized footer, I had the problem of aligning them to the center of the page. CSS does not support float:center and Divs does not recognize the <center> command. CSS only allows float:left and float:right and that’s about it. I guess it does not make sense to float things to the center of nowhere…
My first workaround was to play with the margin.
float: left;
margin: 0 0 0 190px;
That code started the footer 190 pixels away from the left edge of the screen and that worked for me. However, one or two visitors were complaining that the chat box, which is on the right footer was way too far down. I did not understand the problem at first. Then upon testing it on a 800×600 screen, I found that there was not enough space for the right footer to be on the right. So, it went below the left and the middle footer. Duh… Back to research then…
Finally, after hours of research and reading articles from mostly frustrated people who wished that there was a CSS command that would center everything, I bumped on the solution. It was really simple. Instead of using float, I just need to play around with the auto margin function. Found this while reading the whole CSS of this theme one line at a time…
width: 960px;
margin: 0px auto;
See, there is no need to float it anymore. It is important to specify the width so that the browser knows where the center point is.
p/s:
This entry might make no sense to most of you but I need this as my own reference when tweaking new themes… Yup, Papa Bear does not create, only tweak…







IMCurtain.com
No float:center in CSS | Bear, Diah and Pasha…
What float? Root beer float? Nope, I am talking about the CSS float command. CSS is definitely not a walk in the park to most blogger. Me included. I have no formal training on CSS and so far I have been relying on trial and errors and [..]…
kenwooi
i have no training in CSS as well.. but yeah, setting auto for both left and right works =)
kenwooi´s last post ..My Grandma and Her Super Skill
papabear
took me a while to come across that solution. LOL!
lowongan kerja
hehehe float left and right..
lowongan kerja´s last post ..Aston International Hotel Jobs Bogor 2010
papabear
awas… nanti pusing lho…
myebuzz.net
No float:center in CSS | Bear, Diah and Pasha…
What float? Root beer float? Nope, I am talking about the CSS float command. CSS is definitely not a walk in the park to most blogger. Me included. I have no formal training on CSS and so far I have been relying on trial and errors and [..]…
GreenLava
Maybe you wanna bookmark w3schools[dot]com (if you have’t already). You can learn everything there -CSS, HTML, Javascript and whatnot.
GreenLava´s last post ..Improve Custom Search results by adding synonyms
papabear
I know that site but the problem is that it is good when it comes to solving common problems but when it comes to specific stuffs, trial and error work best for me. Thanks
No float:center in CSS | Bear, Diah and Pasha | My Blog
[...] here: No float:center in CSS | Bear, Diah and Pasha This entry was posted on Saturday, July 10th, 2010 at 3:22 pm and is filed under Uncategorized. [...]
Almy
Almy bawa something ni..
KICK START NESCAFE
koleksi bola
Slash Live in KL
papabear
Thanks Almy!
amirulfaiz
Great article, I will refer to it when I want to edit my blog layout.

amirulfaiz´s last post ..Ubat gigi- cecair – pepejal
papabear
All the best editing
cheqna
congrats in learning n willing to learn new things..keep on tweaking…
may be I cld give this a try, but bit scared of doing trial n error thing, in case i lose my blog..haha..
but i don’t mind “trying” the drinking float..hehe..
cheqna´s last post ..power rangers in Melaka
papabear
that’s why you need to backup first… isk isk isk… makan juga yg dia mau
cheqna
haha..u noticed that! shouldnt mentioned anything related to food..hehehe..
cheqna´s last post ..power rangers in Melaka
papabear
you and food is about to become synonyms…
Anne Boleyn
hana pon sama tak pandai mende2 code neh. tapi klu boley wat cam papa bear…mmg a big achievement lah to me. hehe :p
Anne Boleyn´s last post ..Blog Pilihan Anne Boleyn – Muqaddimah
papabear
haha… sama la kita
eszol
helpful
eszol´s last post ..People Wont Be So Optimist Without The Pessimist
papabear
Thanks eszol!
Cashmere
Yes, I agree it’s quite hard in the beginning.

But once you get the hang of it, it’ll be super easy.. and you’ll understand that CSS sure takes a load off your shoulder. And I learned myself also..
Cashmere´s last post ..Dear Daddy…
papabear
Yup, CSS is really an amazing tools once we get the hang of it
zik
i got prob papabear, using this new theme twenty ten (2010).. dun know how to place the ads nuffnang between content.. huhu..
zik´s last post ..Diego Forlan raih Bola emas Piala Dunia 2010
papabear
cuba cari
< ?php endwhile; ?>dalam Main Index Template (index.php). Nuffnang’s code mesti letak sebelum code tu. Cubalah…< ?php endif; ?>
Center With Css | More More Pics
[...] center of the page. CSS kisahberuang.com [...]