centering a 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开发者_C百科 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
the code of interest is below:
<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>
This is how you center divs, with CSS:
#fadeshow1 { margin:0 auto; }
in css
#fadeshow1{
margin-left: auto;
margin-right: auto;
width: THE WIDTH OF THE DIV
}
- The div has to have a width specified.
- You need to add the styles
margin-left:auto;margin-right:auto;
精彩评论