473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Centering divs in firefox and scrollbar issue

Hi,

I am using the following in my stylesheet to center divs in firefox.

html>body {
font-size: 13px;
}

div.centerdiv
{
margin-left: auto;
margin-right: auto;
width: 760px;
}

div.outer { text-align: center; margin: 0 0 0 0; padding: 0 0 0 0; }
div.inner { text-align: left; }

After playing around with it I've noticed that firefox moves the whole
page in when it gets a scrollbar, in other words when the page is too
long to show. Is there any way of stopping this?

Thanks.

Nov 10 '05 #1
5 8014
Els
Spondishy wrote:
Hi,
Hello,
I am using the following in my stylesheet to center divs in firefox.

html>body {
Why are you using this hack?
font-size: 13px;
}
Bad font-size.
Change it to font-size: 100%;

(yes, I did notice that you are setting this pixel font size only for
browsers that can actually enlarge it, but what's the point?)
div.centerdiv
{
margin-left: auto;
margin-right: auto;
width: 760px;
}
Do you have a good reason for a fixed width? It may cause horizontal
scrollbars for a number of people. It may also give very short
sentences for another number of people.
div.outer { text-align: center; margin: 0 0 0 0; padding: 0 0 0 0; }
div.inner { text-align: left; }
You haven't given any html code, is div.centerdiv inside div.inner?
After playing around with it I've noticed that firefox moves the whole
page in when it gets a scrollbar, in other words when the page is too
long to show. Is there any way of stopping this?
If I understand you correctly, you would prefer to have the most right
24 pixels of your page invisible, as in covered by the scrollbar?
I hope that's not what you want.
Thanks.


You're welcome :-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Electric Boys - Groovus Maximus
Nov 10 '05 #2
Hi HTML is

<div class="outer">
<div class="centerDiv">
<div class="inner">
Content
</div>
</div>
</div>

In answer to your questions.

1) If I understand you correctly, you would prefer to have the most
right
24 pixels of your page invisible, as in covered by the scrollbar?
I hope that's not what you want.

Not at all. The behaviour of IE is that the scrollbar is always
visible, but isn't in Firefox and that is why the center div sometimes
shifts to the left. I was just wondering if there was a way around
this.

2) Do you have a good reason for a fixed width?
As usual the client wants a fixed width "table style" in the center of
the page.

Thanks.

Nov 10 '05 #3
Els
Spondishy wrote:
1) If I understand you correctly, you would prefer to have the most
right 24 pixels of your page invisible, as in covered by the
scrollbar? I hope that's not what you want.
Not at all. The behaviour of IE is that the scrollbar is always
visible, but isn't in Firefox and that is why the center div sometimes
shifts to the left. I was just wondering if there was a way around
this.


Not that I know of, unless you'd just add enough height to the html or
body element to warrant a scrollbar at all times, but that will have
people scrolling down to see what's there.
<joke>You could then add a tiny pixel sentence right at the bottom,
explaining about the reason for the scrollbar.</>
2) Do you have a good reason for a fixed width?

As usual the client wants a fixed width "table style" in the center of the page.
Well, once you've tried your best to convince the client of the
obvious drawbacks for their visitors and the possible smaller income
due to inaccessibility on their website, there's not much you can do
about that ;-P
Thanks.


You're welcome :-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Electric Boys - The change
Nov 10 '05 #4
Once upon a time *Spondishy* wrote:
Hi HTML is

<div class="outer">
<div class="centerDiv">
<div class="inner">
Content
</div>
</div>
</div>

In answer to your questions.

1) If I understand you correctly, you would prefer to have the most
right
24 pixels of your page invisible, as in covered by the scrollbar?
I hope that's not what you want.

Not at all. The behaviour of IE is that the scrollbar is always
visible, but isn't in Firefox and that is why the center div sometimes
shifts to the left. I was just wondering if there was a way around
this.


The behaviour of IE is wrong. The reason I say so, is that IE seams to
thinks the browser is part of the website the user is on. Therefore
the web authors is allowed to mess with IE, e.g. changing the look of
the scrollbar. So the scrollbar is visible even when it's not needed.

But as I hope even you understand, the scrollbar is part of the
browser and the browser is the users, not the web authors. So other
browsers show the scrollbar if it's needed, and never let the author
change the look of it.

But the centered content is always centered on a webpage, it's just
that the center change if the page is long enough to need the
scrollbar. As the author you can't do anything about it, and should
not since the browser is the users who visit your site, not yours and
not a part of your site. :)

--
/Arne
-- *Joke of the day* ----------------------------------------
Tech Support: What anti-virus program do you use?
Customer: Netscape.
Tech Support: That's not an anti-virus program.
Customer: Oh, sorry...Internet Explorer.
-------------------------------------------------------------
Nov 10 '05 #5
Spondishy a écrit :
Hi HTML is

<div class="outer">
<div class="centerDiv">
<div class="inner">
Content
</div>
</div>
</div>

In answer to your questions.

1) If I understand you correctly, you would prefer to have the most
right
24 pixels of your page invisible, as in covered by the scrollbar?
I hope that's not what you want.

Not at all. The behaviour of IE is that the scrollbar is always
visible,
html {overflow: auto;}

MSIE default overflow declaration is scroll, not auto. You may even try
overflow: visible.
but isn't in Firefox
Firefox's is visible, not scroll.

and that is why the center div sometimes shifts to the left. I was just wondering if there was a way around
this.

2) Do you have a good reason for a fixed width?
As usual the client wants a fixed width "table style" in the center of
the page.


Well, maybe you can explain to him that a rigid page layout is not
scalable, is less accessible for web-aware devices and applications with
reduced viewport dimensions. A rigid, fixed layout webpage is less
accessible for many web users.
One advantage of the web and the screen media is the scalability of
rendering of the content (text size can be increased, padding and margin
are settable, blocks of text can wrap around, etc.) while the page media
is much less flexible.

Gérard
--
remove blah to email me
Nov 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Duane Lambe | last post by:
Hi - just a quick question, I hope it's simple enough that a visual example isn't required. I have an internal site, everything's the way I want it, but there's an anomoly in both Opera and...
5
by: Abs | last post by:
Hi! I'm having a little problem with my site. I know how to center DIVs using the "margin: auto" thing. But I'm unable to center two images. I used the "text-align: center" hack with no results,...
15
by: red | last post by:
How do I center two side by side divs ? I've been writing css pages for a while but there's one thing tha still eludes me. I can center a div with margin auto. I can place two divs side by side...
13
by: Raffi | last post by:
Hi, We have an application that requires IE. We recently incorporated CSS scroll areas. The scroll fields are supposed to be centered. They are except for IE5 for the Mac. I have tried various...
3
by: ben.saur | last post by:
I am having a problem viewing a centered table using Firefox. When the page is long enough to scroll, the alignment moves slightly to the left. The alignment doesn't change when I view the page...
3
by: rudicheow | last post by:
SHORT VERSION ============= I have a bunch of identical fixed-size single-celled tables that rest against each other horizontally thanks to "float:left". These tables are dynamically generated...
1
by: vunet.us | last post by:
I create a new CSS structure and divs on a right and left sides with width 150px are conflicting with 100% wide and high div laying under them with 150px margin on both sides in Firefox only. This...
11
by: Cartoper | last post by:
Here is the code: http://cartoper.ueuo.com/centering.htm How do I get the big blue buttons to center themselves on Firefox and Safari on this web site? I know that the layout is a bit...
5
by: Amir Michail | last post by:
Hi, I would like to center a logo between left and right floats with different widths. The issue is that the logo should be centered with respect to the window, not the area between the left...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.