Forum Moderators: not2easy

Message Too Old, No Replies

Display Block wont center in n/s 6

         

Kysmiley

12:16 pm on Apr 29, 2004 (gmt 0)

10+ Year Member



I have a few pages setup with the display: block; element for links they look fine in IE6 but when I few them in netscape they are lined down the left side and not in the center like they should be. Here is the coding Im using.
div.left
{ position: absolute; top: 165px; left: 1.5%; height: 27em; width: 17%; border-style: inset; color: #c9f; 1px; text-align: center; color: black; background-color: #6fb7ff; }

div.left a, div.left a:link, div.left a:visited, div.left a:active
{display: block; padding: 10px; width: 35px; height: 15px; border: 3px #c9f outset; margin-bottom: 15px; margin-top: 15px; color: black; background: #6fb7ff; font-size: 1em; bold; "monotype corsiva", script, Arial; text-decoration: none;}

/* Box model hack */
div.left a, div.left a:link, div.left a:visited, div.left a:active {width 90px; height: 18px; voice-family: "\"}\""; voice-family: inherit; width: 100px; height: 18px;}
html> body div.left a {width: 90px; height: 18px; }
/* end hack */

The only way I can get it to work is to use the center comand in the html coding. Any suggestions on how to do this with css so I dont have to html code the pges for this setup
Pat
Thanks

Sorry for not including the html code

<div class="left">
<p>
<a href="http:">thing</a>
<a href="http:">any</a>
<a href="htm">anything</a>
<a href="htm">me</a>
<a href="htm">that</a>
<a href="this/">this</a>
</p></center>
</div>

I also gtried to create a class for centering ie:
div.cnt
{text-align: center;}
inside the left class but it still dit not work out
Pat

[edited by: Kysmiley at 12:40 pm (utc) on April 29, 2004]

WHeights

12:28 pm on Apr 29, 2004 (gmt 0)

10+ Year Member



Post your (x)html code as well, it's easier to debug that way.

Oh, and what version of netscape?

DrDoc

3:15 pm on Apr 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you want the links to be centered, try appling
text-align:center
to the paragraph inside your .left div.

Also, keep in mind that

text-align:center
does not center elements, only their inline contents (such as text, images, form elements, etc). Older versions of IE incorrectly interpret
text-align:center
to cause block level elements themselves to be centered, when the correct way of doing this is by adjusting the margin (
margin:0 auto
).

aeve

4:17 pm on Apr 29, 2004 (gmt 0)

10+ Year Member



You should start by validating your code:
[jigsaw.w3.org...]

This is probably the problem:

color: #c9f; 1px; text-align: center;

Ie6 is much more forgiving than mozilla with small errors.