将div居中 [英] centering a div
本文介绍了将div居中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将div居中,但是由于它是一个块并且行内插入了常规文本或图像,因此无法正常工作... div中的内容居中,但div本身未居中...我该怎么办这?香港专业教育学院尝试了谷歌的一堆东西,但我无法使其工作...
I am trying to center a div but due to it being a block and general text or image being inline it does not work...The stuff inside the div gets centered but not the div itself...How can I do this? Ive tried a bunch of things from Google but I couldn't get it to work...
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>
推荐答案
在CSS
#fadeshow1{
margin-left: auto;
margin-right: auto;
width: THE WIDTH OF THE DIV
}
这篇关于将div居中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文