hi!
i am aware that there is another thread that has to do with aligning a div.....yet i could find an answer to the specific problem...so i am asking again...
i have a parent div (pageBody) and in it another div and some text...
div#pageBody {
width: 620px;
}
what i need to do is align the parent div horizontally in the middle....well adding text-align: center appears to do the job on IE but due to a bug...
on Mozilla the parent div stays always on the left...
how can it be done...
Thanl u in advance....Originally posted by cssrules
hi!
what i need to do is align the parent div horizontally in the middle....well adding text-align: center appears to do the job on IE but due to a bug...
on Mozilla the parent div stays always on the left...
how can it be done...
The correct way to center a div with CSS is
div#pageBody {width: 620px; margin:0 auto;}thank you for your answer...
i have used this code
div#parentDiv {
width: 620px;
text-align:center;
margin: auto;
}
and it works under IE and Mozilla...I have also changed the text-align (due to inherit) to divs-content of the page....
i know though that by removing the text-align attribute IE will fail to horizontally center the div's content, whereas Mozilla has no such problem..
how can it be done without the text-align? i have read it is due to a bug that actually causes the content of the page to be centered....
Anyway, if there is no answer, i'll probably stick to the above code...If something ain't broken, why fix it?
Thank u in advance.... Originally posted by cssrules
how can it be done without the text-align? i have read it is due to a bug that actually causes the content of the page to be centered....
Yes, you take advantage of that IE bug to fix the other IE bug (it ignores the mergin auto).thanx...
you have been most helpful....
i am aware that there is another thread that has to do with aligning a div.....yet i could find an answer to the specific problem...so i am asking again...
i have a parent div (pageBody) and in it another div and some text...
div#pageBody {
width: 620px;
}
what i need to do is align the parent div horizontally in the middle....well adding text-align: center appears to do the job on IE but due to a bug...
on Mozilla the parent div stays always on the left...
how can it be done...
Thanl u in advance....Originally posted by cssrules
hi!
what i need to do is align the parent div horizontally in the middle....well adding text-align: center appears to do the job on IE but due to a bug...
on Mozilla the parent div stays always on the left...
how can it be done...
The correct way to center a div with CSS is
div#pageBody {width: 620px; margin:0 auto;}thank you for your answer...
i have used this code
div#parentDiv {
width: 620px;
text-align:center;
margin: auto;
}
and it works under IE and Mozilla...I have also changed the text-align (due to inherit) to divs-content of the page....
i know though that by removing the text-align attribute IE will fail to horizontally center the div's content, whereas Mozilla has no such problem..
how can it be done without the text-align? i have read it is due to a bug that actually causes the content of the page to be centered....
Anyway, if there is no answer, i'll probably stick to the above code...If something ain't broken, why fix it?
Thank u in advance.... Originally posted by cssrules
how can it be done without the text-align? i have read it is due to a bug that actually causes the content of the page to be centered....
Yes, you take advantage of that IE bug to fix the other IE bug (it ignores the mergin auto).thanx...
you have been most helpful....