Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery追加元素-文本不';不适合_Jquery_Css - Fatal编程技术网

jQuery追加元素-文本不';不适合

jQuery追加元素-文本不';不适合,jquery,css,Jquery,Css,所以我不知道为什么这不起作用。我有以下jQuery: $('#shifts').on({ click: function(event) { selectStaff($(this)); }, mouseover: function() { var match = $(this); // There is something wrong with this user. Lets write it all down

所以我不知道为什么这不起作用。我有以下jQuery:

$('#shifts').on({
    click: function(event)
    {
        selectStaff($(this));
    },
    mouseover: function()
    {
        var match = $(this);
        // There is something wrong with this user. Lets write it all down
        if( match.hasClass('warning') )
        {
            var w1 = '<div class="display_warning">This user has already been used for today.</div>';
            var w2 = '<div class="display_warning">This user is not qualified to perform one or more of the tasks assigned to this shift</div>';
            var warning = '<div id="display_warning">' + w1 + w2 + '</div>';

            match.after(warning);

        }
    },
    mouseout: function()
    {
        $('#display_warning').remove();
    }
},'.staff .match');

但是,文本位于div之外,而不是div内的约束!为什么

问题是因为您为块元素指定了
宽度
高度
。如果删除其中任何一个,则文本将在
div
中换行,或者如果您对
div
水平展开没有问题,则另一个选项是将其更改为
min width
,或者
minheight
如果你对垂直扩展
div
没问题。

我想你是在定义类
的css。在
中显示警告
。你能在另一个类中包含css属性吗????!!!而且
/
不是注释此属性的正确方式!!!你必须使用
/*bla-bla-bla:bla-bla-bla*/
对不起,我应该说,那是用更少的钱!所以它编译成CSS!发布编译后的CSS,最好是一个我们可以重现问题的地方,怎么样?我希望宽度是固定的。我试着给潜水艇最低高度,但那没用!嗯,这是我的意思的一把小提琴:。尝试将小提琴中的
min height
更改为刚好
height
,以查看差异。您还可以尝试添加
空白:换行选项,我已经在fiddle.square中注释掉了它。这可能与动态添加元素有关吗?不应该,但您可以通过调用
.css(…)
addClass()
#display_warning
{
    float: left;
    width: @shiftWidth;
    background-color: @white;
    padding-top: @unit;
    padding-bottom: @unit;
    color: @textColor;
    font-size: 12px;
    height: 100px;
    //border: 1px sol;
    .display_warning
    {
        float: left;
        width: @shiftWidth;
        //text-align: center;

    }
}