Forum Moderators: not2easy

Message Too Old, No Replies

cross browser

problems with different browser

         

hrudayamm

10:04 pm on Feb 10, 2005 (gmt 0)

10+ Year Member



HI!

The below code shows up fine in IE 6.0 but not in Netscape 7.2. It would work fine if I use <div align=center> but i want it to be controlled form the style sheet.

please help.:(

Lalith

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<style>

.container{
text-align:center;
}

p{
font-family: Verdana, Helvetica, sans-serif;
font-size: 11px;
text-align: justify;
font-weight: normal;
width:540px;
}

</style>

<body>
<div class="container">
<p>this is a test alsdhf aosdi fa aiosuhgf aious gaiushgakoustyr faiosuf ausgdpri7u ausyd asudygqyug98 asiudfgy[q worhg97w8ry gaus7thwr8ya sudhqwyhe as98yhgf 9w8ryt g8asy sid fapisd fpasjdf</p>
<p>askduh faosuhd foasuih dfo[aish dfo[iahsdasdfag asdf gasd fasdiof apsioud fapsioud fpaious dfaduas df asdofya sdg fas dg asdf gasoidfg asoidfg aoshgd aosg [oaisdg foaisg oiasfd[goias oghaoshig oasi goaihg oiaihs goihas o[giha s[oigh a[osihg a[oifha s[dohjf a[osidh fgo[aish </p>
<p>aisugd faousihd foasihd foaish dfioasd</p>
</div>
</body>
</html>

Robin_reala

12:04 am on Feb 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you trying to centrally align the div or to align the text inside it to the centre? If (as I suspect) the former then you're using the wrong code. text-align:center tells all the text inside the div to centre align itself. To centre align the div itself use:

.container {
margin: 0 auto;
}

I thought IE6 had stopped doing this so you've probably got it in quirks mode with your broken doctype. Try using a proper one instead and see if it fixes it:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

hrudayamm

3:07 pm on Feb 11, 2005 (gmt 0)

10+ Year Member



It did not work. I wanted the whole div tag centred to the page with p tag width fixed.

please help:(
thanx
lalith.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<style>

.container {
margin: 0 auto;
}

p{
font-family: Verdana, Helvetica, sans-serif;
font-size: 11px;
text-align: justify;
font-weight: normal;
width:540px;
}
</style>
<body>
<div class="container">
<p>this is a test alsdhf aosdi fa aiosuhgf aious gaiushgakoustyr faiosuf ausgdpri7u ausyd asudygqyug98 asiudfgy[q worhg97w8ry gaus7thwr8ya sudhqwyhe as98yhgf 9w8ryt g8asy sid fapisd fpasjdf</p>
<p>askduh faosuhd foasuih dfo[aish dfo[iahsdasdfag asdf gasd fasdiof apsioud fapsioud fpaious dfaduas df asdofya sdg fas dg asdf gasoidfg asoidfg aoshgd aosg [oaisdg foaisg oiasfd[goias oghaoshig oasi goaihg oiaihs goihas o[giha s[oigh a[osihg a[oifha s[dohjf a[osidh fgo[aish </p>
<p>aisugd faousihd foasihd foaish dfioasd</p>
</div>
</body>
</html>

benihana

3:11 pm on Feb 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



body {
text-align:center;
}

div {
text-align:left;
}

.container {
margin:0 auto;
}

any good?

hrudayamm

3:41 pm on Feb 11, 2005 (gmt 0)

10+ Year Member



Not comming up in netscape

any other suggestions..

thanx

Lalith

Robin_reala

11:19 am on Feb 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Move the width statement from the p to the div.

hrudayamm

5:19 pm on Feb 12, 2005 (gmt 0)

10+ Year Member



Thanx a lot
it worked :)

Lalith.