Question

I want to center or bottom align vertically a text in between two buttons inside a jQuery Dialog box. I have tried several methods but none of them seem to work. What am I doing wrong here?

My code is as follows:

<!doctype html>
<html lang="en">
<head>
   <meta charset="utf-8">
<title>jQuery UI Dialog - Default functionality</title>

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/ui-darkness/jquery-ui.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>



<script type="text/javascript">

    $(function () {
        $("#dialog_nav").dialog({
            autoOpen: false,
            modal: true,
            dialogClass: "First_Dialog",
            resizable: false,
            buttons: [
                {

                    text:"Login",
                    class:"Login_Class",
                    click: function () {
                       //
                    }
                },
                {
                    text:"SignUp",
                    class:"Sign_Up_Class",
                    click: function () {
                        //
                    }
                }
            ]


        });



        $("#Dialog_Modal").on("click", function (event) {
            $("#dialog_nav").dialog("open");
        });

        //$(".ui-dialog-buttonpane button:first").after('<span>Or</span>');

        $(".ui-dialog-buttonset > button:first-child").css("float", "left");
        $(".ui-dialog-buttonset > button:last-child").css("float", "right");

        $(".Login_Class").after('<span class="Span_Text">Or</span>');

});



</script>


<style type="text/css">
    .First_Dialog .ui-dialog-titlebar-close{
        display:none;
    }
    .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset
    {
        float:none; 
    }
    .ui-dialog .ui-dialog-buttonpane
    {
        text-align:center;
    }
    span.Span_Text
    {
        text-align:center;
        vertical-align:bottom;
    }




</style>

</head>
<body>

<div id="dialog_nav" title="Basic Modal dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div> 
<input type="button" id="Dialog_Modal" value="Click to open a modeless dialog" /> 
</body>
</html>
Was it helpful?

Solution

Give this code in CSS:

span.Span_Text {line-height: 3.5em;}

Fiddle: http://jsbin.com/biheqemi/1/edit

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top