| | |
Not Centering in Opera
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2009
Posts: 22
Reputation:
Solved Threads: 0
Hi,
I have a website in development and i've made it centered regardless of width of the viewing browser window (eg. the browser is 1000px wide and the content is 600px wide and is centered with 200px each side) by using div's.
Now it works perfectly in FF, IE and WebKit (Safari, Chrome etc) but trying to open in Opera it is aligned left...
Now i know opera doesn't recognize text-align: center (how i'm centering the "wrapper" div) so my question really is...does anyone know of a work around for this typr of centering in Opera?
Thanks
I have a website in development and i've made it centered regardless of width of the viewing browser window (eg. the browser is 1000px wide and the content is 600px wide and is centered with 200px each side) by using div's.
Now it works perfectly in FF, IE and WebKit (Safari, Chrome etc) but trying to open in Opera it is aligned left...
Now i know opera doesn't recognize text-align: center (how i'm centering the "wrapper" div) so my question really is...does anyone know of a work around for this typr of centering in Opera?
Thanks
•
•
•
•
Hi,
I have a website in development and i've made it centered regardless of width of the viewing browser window (eg. the browser is 1000px wide and the content is 600px wide and is centered with 200px each side) by using div's.
Now it works perfectly in FF, IE and WebKit (Safari, Chrome etc) but trying to open in Opera it is aligned left...
Now i know opera doesn't recognize text-align: center (how i'm centering the "wrapper" div) so my question really is...does anyone know of a work around for this typr of centering in Opera?
Thanks
open a window less than full screen and your page is shifted right, out of the visible area, click a link and the new page is shifted right out of the visible area. No.
images and borders, sized in pixels
all other elements, sized in ems or %
then the visible page will properly adjust,
Your divs should be something like 10% 80% 10% which will scale, and increase the usable area by 1/3
opera has a few quirks
for the vanishing div try sticking something in it
<div> </div>
still 'blank' but may display differently
check also the styles, different browsers throw away the entire style if the definitions are 'wrong'
Last edited by almostbob; Feb 4th, 2009 at 9:38 am.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Jan 2009
Posts: 22
Reputation:
Solved Threads: 0
sorry don't think i was total implicit...
is what i'm using to center the content....
with all content being inside the innerwrapper
HTML and CSS Syntax (Toggle Plain Text)
#wrapper { text-align: center; } #innerwrap{ text-align: left; margin: 0 auto; width: 600; }
is what i'm using to center the content....
with all content being inside the innerwrapper
the width of #innerwrap could be, throwing browsers off
without a dimension IE firefox opera render differently
IE assumes px
firefox throws it away(but 0 auto margin setting would make it work anyway in firefox)
opera goes funky
works in opera IE Firefox
I set the body, you set outer wrap, same thing
without a dimension IE firefox opera render differently
IE assumes px
firefox throws it away(but 0 auto margin setting would make it work anyway in firefox)
opera goes funky
css Syntax (Toggle Plain Text)
body { text-align:center; } #innerwrap{ text-align: left; margin: 0 auto; width: 60%; }
I set the body, you set outer wrap, same thing
Last edited by almostbob; Feb 5th, 2009 at 10:07 am.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Oct 2008
Posts: 76
Reputation:
Solved Threads: 6
I'm not sure that that will always work but I use this method to center objects, Position the wrap div left: 50%; this will set the left corner of the div to be in the exact center of the page, then set a negative margin to be half the width of the content (e.g. If your content is 300px your margin would be -150) which will move the content back to the left, centering it exactly. Your end code will look something like this
#wrap
{
Position:fixed;
left:50%;
width: 300px
margin: -Half of your content width (in this case -150px) ; If I have been helpful add to my reputation!
•
•
Join Date: Jul 2008
Posts: 101
Reputation:
Solved Threads: 9
I had the same "problem" when testing a site with Opera.
The reason is that align:center is not supported for block objects. This conforms with W3C standards, so Opera is doing it right and the others do not.
Use margin:0 auto; for centering objects,
and text-align:center; can be used to center the contents of a block.
Note that even if you use text-align:center; for a block object, it may not be centered unless you ALSO specify margin:0 auto; for that object.
In these cases, Opera, and in my experience FireFox 3, does this the way it was intended.
Note that for instance <div align:center> is not supported at all except in quirks mode. This is because the layout and style should not be specified in the HTML. That's for the CSS.
The reason is that align:center is not supported for block objects. This conforms with W3C standards, so Opera is doing it right and the others do not.
Use margin:0 auto; for centering objects,
and text-align:center; can be used to center the contents of a block.
Note that even if you use text-align:center; for a block object, it may not be centered unless you ALSO specify margin:0 auto; for that object.
In these cases, Opera, and in my experience FireFox 3, does this the way it was intended.
Note that for instance <div align:center> is not supported at all except in quirks mode. This is because the layout and style should not be specified in the HTML. That's for the CSS.
Last edited by ingeva; Feb 6th, 2009 at 9:06 am.
![]() |
Similar Threads
- Fit-to-Width killing my site in Opera 9.50? (HTML and CSS)
- centering website with CSS (HTML and CSS)
- Which browser do you design for? (HTML and CSS)
Other Threads in the HTML and CSS Forum
- Previous Thread: CSS Help..Plz
- Next Thread: HTML onMouseOver and Out validation problem
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7






