Centering in IE5 / 6/7/8 and FF

I am trying to center the contents of a div so that the display is correct in IE 5,6,7 and 8, as well as FF.

<div id="YoutubeClip">
    <h3>Subscribe on YouTube!</h3><br>
    <ul class="gallery clearfix"><a href="http://www.someyoutubevideo.com" rel="prettyPhoto" title="Some youtube title"><img alt="some youtube title" src="youtube clip image" border="0"></a></ul>
    Some youtube title
</div>

My CSS is simple:

text-align: center

As expected, this displays an image and text centered in FF.

In IE5, the image remains justified. The text is also left-aligned, with only one word per line, for example:


appears
like
this.

IE 6 has the same problem as above.

IE 7 seems to have the same problem, but when I put the border around the div, the content overflows the border.

IE8 displays correct display

Any help on this would be great. I am trying to learn CSS better, and I have not yet been able to understand the intricacies of this problem.

+3
4

: " ", .

, , , <ul>, , :

http://validator.w3.org/

- .

CSS, , IE5,

margin: 0 auto

div. , , .

, :)

+3

text-align:center ul h3. css, . .

0

, :

margin-left: auto;
margin-right: auto;
0
#YoutubeClip {
margin: 0 auto 0 auto;
}

0 = auto =

div, , , .

,

text-align: center; h3 #YoutubeClip

- ,

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

<ul class="">, <div class="">, , . <li></li> ( ).

EX:

<ul>
   <li>content goes here</li>
   <li>more content</li>
</ul>
0

Source: https://habr.com/ru/post/1747725/


All Articles