473,321 Members | 1,916 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,321 software developers and data experts.

Div not centering in Firefox but fine in IE ?

Hi I'm new to group and I'm having an issue with a page I'm doing for
an Artist firend. This is my first foray into stylesheets.

here's the problem: I've got a dive I would like centered. I use the
code below to created a div that's centerd on the page. It works in IE
bit does not work in Firefox Mozilla etc.

here's the code

body{
text-align:center;
font-color:#ffffff;
background-image:URL(gothclub.jpg);
}
div{
text-align:center;
padding:5px;
padding-top:10px;
margin-top:10px;
margin:left:20%;
width:60%;
color:sienna;
background-color:#330000;
border:1px #82543d solid
}

Any help will be appreciated.

Dave

Jul 21 '05 #1
9 52813
da*************@gmail.com wrote:
Hi I'm new to group and I'm having an issue with a page I'm doing for
an Artist firend. This is my first foray into stylesheets.

here's the problem: I've got a dive I would like centered. I use the
code below to created a div that's centerd on the page. It works in IE
bit does not work in Firefox Mozilla etc.

here's the code

body{
text-align:center;
font-color:#ffffff;
background-image:URL(gothclub.jpg);
}


To centre a block you are supposed to set margin-left and margin-right
to auto, but IE doesn't honour this, so you have to use
text-align:center to make IE happy, plus margin-left:auto;
margin-right:auto for the standards compliant browsers.
Jul 21 '05 #2
Why am I not suprised IE is not compliant ? Well thanks for the tip it
worked like a champ !!

Dave

Jul 21 '05 #3
C A Upsdell > wrote:

To centre a block you are supposed to set margin-left and margin-right
to auto, but IE doesn't honour this,
IE6 in standards mode does, for sure.
text-align:center to make IE happy,


More specifically, IE5.x or IE6 in quirks mode (which you shouldn't be
triggering, anyway).

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Jul 21 '05 #4
Please elaborate on standards mode and quirks mode ? Especially what
one does to trigger quirks mode ?
In the meantime I'll STFW regarding these modes.

Dave

Jul 21 '05 #5
da*************@gmail.com wrote:
Please elaborate on standards mode and quirks mode?
http://dorward.me.uk/www/centre/#ie
http://gutfeldt.ch/matthias/articles/doctypeswitch.html
Especially what one does to trigger quirks mode ?


You don't trigger quirks mode, its the default. You trigger standards mode.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 21 '05 #6
Thanks

Jul 21 '05 #7
da*************@gmail.com wrote:
Hi I'm new to group and I'm having an issue with a page I'm doing for
an Artist firend. This is my first foray into stylesheets.

here's the problem: I've got a dive I would like centered. I use the
code below to created a div that's centerd on the page. It works in IE
bit does not work in Firefox Mozilla etc.

here's the code

body{
text-align:center;
font-color:#ffffff;
background-image:URL(gothclub.jpg);
}
div{
text-align:center;
padding:5px;
padding-top:10px;
margin-top:10px;
margin:left:20%;
width:60%;
color:sienna;
background-color:#330000;
border:1px #82543d solid
}

Any help will be appreciated.

Dave


I would use shorthand on some your properties as well:

------------------------------------------------------
body {
margin-left:auto;
margin-right:auto;
width:50%;
text-align:center;
background:transparent URL(gothclub.jpg);
}

div {
text-align:center;
padding:10px 5px 5px 5px;
margin:10px 20% 0;
width:60%;
color:#960; /* Try to use shorthand #960 */
background:#300 none;
border:1px solid #853;
}
------------------------------------------------------

My 2 cents.

JL
Jul 21 '05 #8
Justin Lieb wrote:

I would use shorthand on some your properties as well:


By shorthand, you mean

border: thin solid black;

rather than

border-width:thin;
border-style:solid;
border-color:black;

right?

I'm curious: other than simplifying the coding, is there any performance or
other benefit to working this way?

--
Tony Garcia
http://www.dslextreme.com/~tony23/
Jul 21 '05 #9
On Tue, 14 Jun 2005, Tony wrote:
Justin Lieb wrote:

I would use shorthand on some your properties as well:
By shorthand, you mean

border: thin solid black;

rather than

border-width:thin;
border-style:solid;
border-color:black;

right?


there's also border-top-width, border-right-width, and so on, if you
want/need to spell it out in every tedious detail... see e.g the
navigation area at http://www.w3.org/TR/CSS21/box.html
I'm curious: other than simplifying the coding,


I'd see that as a benefit: smaller CSS files, less to transfer over
the net, in theory less to go wrong.

Early browser implementations of CSS were rather buggy in this area,
and some of us got accustomed to specifying both forms, in the hope
that this or that browser would grok at least one of them. But by now
that sort of nonsense should be finished, and those who are using old
buggy browsers have surely got accustomed to less than ideal results
on other web sites, and with a reasonable attitude to flexible design
(which IMHO probably means using float in preference to absolute or
fixed positioning, where bugs can all too easily result in overlapping
areas), they should at least get a usable page, even if its cosmetics
leave something to be desired.

If all else fails they can disable (author) stylesheets, one way or
another.

imho and ymmv, anyway.
Jul 21 '05 #10

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...
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...
3
by: yawnmoth | last post by:
I'm trying to center list elements in a webpage I'm working on, and setting margin-left to auto for ol (or ul) seems to prevent the number (or bullet) from displaying in IE6 (strict mode) and...
6
by: Simon Wigzell | last post by:
I have the following funciton that centers my website content for any size window and will center it in real time as the window is expanded or shrunk. It is activated by a onresize="CenterIt();"...
3
by: John Pote | last post by:
1. Horizontal centering a <divin browser window. The current trend seems to be to place page content in a fixed width area in the middle of the browser window. How is this achieved? If I use a...
3
by: BT | last post by:
I have taken over the support of an existing webpage and I need to revise the page so that it is centered (left and right) on the screen instead of aligned on the left. I can do this easily, but...
9
by: Neal | last post by:
http://www.brassattackofspringfield.com/gigs.html CSS at http://www.brassattackofspringfield.com/default.css Opera and IE render caption as desired. Firefox does not. Why? And is there a fix?
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...
14
by: issentia | last post by:
I'm working on this site: http://www.essenceofsoy.com/redesign/index2.html and I'm having a few problems with getting the layout exactly right. 1) When the menu items are rolled over, they...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.