You know, when it comes CSS (Cascade Style Sheets, or style sheets) Internet Explorer browser is among the worst.
Do not parse correctly (by the book W3C) CSS properties and reads them in his own way.
Firefox is much more adherent to the official standard, but not everyone uses Firefox.
So, when you need to center an element <div> or another things get complicated. To avoid the typical <center> </ center> and have the compatibility of all browsers there is a way, but you have to do a little trick.
Since I happen to write it here as it is often personal reminder, perhaps useful to someone else.
The "trick" is that.
We must create 2 <div> one inside the other, like this:
<div id="contenitore1">
<div id="contenitore2">Contenuto, testo, foto, ecc...</div>
</div>
Then you need to create styles in the header of the page or in a file. Css in part:
# {Contenitore1
text-align: center; / * for Internet Explorer * /
}# {Contenitore2
margin: 0 auto; / * standard alignment in CSS * /
text-align: left; / * compensate center alignment * /
/ * ADDED ONLY TO SEE BETTER EXAMPLE: * /
border: 2px solid # 000;
width: 50%;
}
That's it, the trick is all here.
Good alignment!
Related Articles:
- How to encrypt passwords in MD4, MD5 and SHA-1
- Google Update finished, Google Update in progress ...
- Flash LightBox v2
- How to introduce and promote their own blog
- Googlebombing for Obama





April 30th, 2009 at 24:46
You are my savior. Grandeeeeeeeeee
June 27th, 2010 at 20:21
You were very clear! Thanks a lot!
December 19th, 2010 at 10:06
Grazieeeeeeee finalmentee has moved! you're great!
January 19th, 2011 at 13:36
Tested, works perfectly ... damn IE ...
March 4th, 2011 at 12:17
thank you, good advice! you made me save time with an elegant solution
April 27th, 2011 at 13:43
Hello I put a slideshow on my blogger widget
but with the classic center> <center
only works on chrome
and not on mozilla and explorer
what do you think?
http://www.mondotorrent.blogspot.com
take a look and let me know what you can do to please! Regards
December 23rd, 2011 at 13:54
I was not no saint was to be pulled down: D thanks, I finally resolved and the myriad of posts that are on the internet, this is the fastest, most intuitive and effective, even for a nabbo like me ... thanks again