我试图将一个div居中,但由于它是一个块,一般文本或图像是内联的,它不起作用... div内的东西集中但不是div本身......我怎么办这个?我曾尝试过谷歌的一些东西,但我无法让它发挥作用......
http://dev.icalapp.rogersdigitalmedia.com.rogers-test.com/menutest.htm
感兴趣的代码如下:
<head>
<script type="text/javascript">
var mygallery=new fadeSlideShow({
wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
dimensions: [500, 360], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: [
["01.jpg"],
["02.jpg"],
["03.jpg"],
["04.jpg"] //<--no trailing comma after very last image element!
],
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
persist: false,
fadeduration: 500, //transition duration (milliseconds)
descreveal: "ondemand",
togglerid: ""
})
</script>
</head>
<body>
<div id="fadeshow1"></div>
</body>
答案 0 :(得分:3)
这就是你用div来集中div的方法:
#fadeshow1 { margin:0 auto; }
答案 1 :(得分:2)
在css中
#fadeshow1{
margin-left: auto;
margin-right: auto;
width: THE WIDTH OF THE DIV
}
答案 2 :(得分:1)
margin-left:auto;margin-right:auto;