将文本与对话框标题栏中的图像对齐

时间:2014-12-10 15:10:17

标签: javascript jquery dialog

有任何方法可以使用css自定义"您的标题"例如,在这个小提琴中,将它与图像对齐? http://jsfiddle.net/saikotju/F9uR3/3/

<span class="dialog">English</span>

<div id="dialog" class="dialogBox" title="LessonSelected"></div>

$(function() {

    $('#dialog').dialog({
        resizable:false,
        autoOpen: false,
        title:'<img src="http://weeklyprobateleads.com/wp-content/uploads/2014/10/download-icon-probate-leads.png" /> Your Title',
        buttons: {
            "Enrol": function(){
                $(this).dialog('close');
                choice(true);
            },
            "Cancel Enrol": function(){
                $(this).dialog('close');
                choice(false);
            }
        }
    });

    $( ".dialog" ).click(function(){        
        $('#dialog').dialog("open");
    });
});


.ui-dialog-title {
    color: white;
}

感谢

2 个答案:

答案 0 :(得分:0)

这应该这样做:

.ui-dialog-title img {
    vertical-align:middle;
}

<强> jsFiddle example

答案 1 :(得分:0)

试试这个:

&#13;
&#13;
$(function() {
    
        $('#dialog').dialog({
            resizable:false,
            autoOpen: false,
            title:'<img src="http://weeklyprobateleads.com/wp-content/uploads/2014/10/download-icon-probate-leads.png" /> Your Title',
            buttons: {
                "Enrol": function()
                {
                    $(this).dialog('close');
                    choice(true);
                },
                "Cancel Enrol": function()
                {
                    $(this).dialog('close');
                    choice(false);
                }
            }
        });
        
    $( ".dialog" ).click(function(){        
        $('#dialog').dialog("open");
    });
  });
&#13;
.ui-dialog-content div {
    background: url(https://www.google.com/logos/2014/worldcup14/opening/cta.png) no-     repeat  !important;
}
&#13;
<table>
  <tr>
    <td>
      <span class="dialog">English</span>
    </td>  
    <td>
      <div id="dialog" class="dialogBox" title="LessonSelected">
        <img src="https://www.google.com/logos/2014/worldcup14/opening/cta.png" />
      </div>
    </td>
  </tr>
</table>  
&#13;
&#13;
&#13;