I have a image slider with description coming from left to right. Now I need to make the text alignment as justified and I want to place the text in the center. If I add any property to the CSS, it does not work.
setting.$descpanel=$('<div class="fadeslidedescdiv" valign="center"></div>')
.css({position:'absolute', visibility:'hidden', width:'100%', left:0, top:0,right:setting.dimensions[1],bottom:0, font:fadeSlideShow_descpanel.fontStyle, zIndex:'1001'})
.appendTo(setting.$wrapperdiv)
$('<div class="descpanelbg" valign="center"></div><div class="descpanelfg" valign="center"></div>') //create inner nav panel DIVs
.css({position:'absolute', left:0, top:150, width:setting.$descpanel.width(), padding:'20px'})
.eq(0).css({background:'#000000', opacity:0.7,}).end() //"descpanelbg" div
.eq(1).css({color:'white'}).html(setting.closebutton + setting.longestdesc).end() //"descpanelfg" div
开发者_StackOverflow .appendTo(setting.$descpanel)
You already have a class
for that div so just do it in CSS:
.descpanelfg { text-align: center; }
If you mean middle (which is not center) you have to give it fixed height first, for example:
.descpanelfg { height: 20px; line-height: 20px; vertical-alignment: middle; }
精彩评论