Center Javascript Slideshow?

This question already has an answer here:

  • How to horizontally center a <div> in another <div>? 82 answers

  • You just need to put <div> around your slideshow and apply text-align:center to the div.

    <div style="text-align:center;">
        <img src="congo.jpg" name="slide" width="400" height="300">
    </div>
    

    Quick and dirty example: https://jsfiddle.net/pbsz9spu/


    /*css*/
    
    .slideshowContainer {
    position:relative;
    width:400px;
    height:300px;
    margin:0 auto;
    clear:both;
    }
    
    
    
    <!-- HTML -->
    
    
    <div class="slideshowContainer">
    <img src="congo.jpg" name="slide" width="400" height="300">
    </div>
    

    Always try to style your divs with css style sheets or in head of the page. Try to avoid styling inline like div style="". This is bad practice.

    链接地址: http://www.djcxy.com/p/13216.html

    上一篇: 居中未知宽度的固定格

    下一篇: 中心JavaScript幻灯片?