¿Cómo cambiar la descripción para que aparezca en el centro del div?

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
        .appendTo(setting.$descpanel)

preguntado el 09 de enero de 11 a las 06:01

Not sure how you expect folks to correct your code if you can't post the code :-/ -

i have the code , but i am unable to post it here. Its giving error as spam image error.I have put the code.. -

You can format you're code properly using the { } button in the editor toolbar. You can also take a look at the section on asking JavaScript questions in the JavaScript tag wiki -

descpanelfg - if set valign center, the whole script is not working.. -

1 Respuestas

Ya tienes un 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; }

Respondido el 09 de enero de 11 a las 18:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.