Topic: NN4 and centring Div's Pages that link to <a href="https://ozoneasylum.com/backlink?for=11082" title="Pages that link to Topic: NN4 and centring Div&amp;#039;s" rel="nofollow" >Topic: NN4 and centring Div&#039;s\

 
Author Thread
Blaise
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2003

IP logged posted posted 10-22-2003 02:05 Edit Quote

Hi Guy's how's it going?

I'm wondering if there's a way to position a Div in the centre of a page with NN4, I've tried margin:auto; text-align:centre; but these don't seem to work, even align="centre". I was wondering if there was a clever hack or something that could take care of it?

Cheers,

Blaise

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 10-22-2003 02:09 Edit Quote

You have to use the american-english spelling of "center" =)

Blaise
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2003

IP logged posted posted 10-22-2003 02:19 Edit Quote

ooh, I didn't notice that!

Well actually I have checked that before I guess I just types centre like that on this post.

so I've tried using center aswell but still left aligned for me

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

IP logged posted posted 10-22-2003 02:33 Edit Quote

Blaise: Depending on the mood of NN4 and the inner guts of your page, the negative margin hack may do the trick. For instance:

code:
#idOfYourDiv
{
position:absolute;
left:50%;
width:300px;
margin-left:-150px; // minus half the width of the Div
}

Hope that helps

Mathieu "POÏ" HENRI

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 10-22-2003 03:23 Edit Quote

Poi: For a thing like horizontal centering, that might actually cause more troubles than it solves (vertical centering is mostly what it's good for, IMO).

Blaise: Can you give us a link to the page demonstrating the problem?

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

IP logged posted posted 10-22-2003 03:44 Edit Quote

Before we give any more thought to this, one VERY important question:

Why does this have to work in NN4?

If there's a good reason, then there is a good probability that the answer will involve something other than <div>'s and CSS.....seeing as NN4 is notorious for it's very poor support of such things.

If there is not a good reason...then forget all about it....

Blaise
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2003

IP logged posted posted 10-23-2003 01:29 Edit Quote

Perhaps one good reason is that I'm being told it has to?

If I had it my way I wouldn't even look to see if a website worked in NN4 I couldn't care less. except for the fact that this time the powers that be want it that way, so unfortunatly it has to.

I want to create a page using CSS for layout and style as much as possible, and one thing (which I thought would be extremely simple to do) I would liek is to centre the contents of my page without using a table design.

Blaise

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 10-23-2003 01:37 Edit Quote

It's definitely possible with text-align:center . I think you have to apply it to the *containing* element, not the element you want to center.

You can then override it in other browsers with this NN4 CSS-hiding trick:

/*/*/
text-align:left;
/* */



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu