将CSS应用于弹出窗口

乔廷格

我无法将样式表应用于我的弹出窗口。我可能想念一些简单的东西,但似乎无法弄清楚。我在具有相同链接的其他页面上使用CSS,效果很好。

的CSS

.Code128 {
    font-size: 50px;
}

jQuery查询

$(document).ready(function () {

    $('#Print').on("click", function () {
        Popup($('#PrintDiv').html());
    });

    function Popup(data) {
        var mywindow = window.open('', 'Print Label', 'height=400,width=600');
        mywindow.document.write('<html><head><title>Print Label</title>');

        mywindow.document.write('<link rel="stylesheet" type="text/css" href="~/Content/Fonts.css"/>');
        mywindow.document.write('<link rel="stylesheet" type="text/css" href="~/Content/Label.css"/>');

        mywindow.document.write('</head><body >');
        mywindow.document.write(data);
        mywindow.document.write('</body></html>');

       // mywindow.print();
       // mywindow.close();
    }
});

的HTML

<div id="PrintDiv">
    <div class="Code128">BarCode</div>
    <div class="Code128">Bar Code</div>
</div> 
邪恶的橙色

您的路径中是否真的有“〜”?尝试将其删除。您能给您的文档链接吗?另外,如果只想显示文本,则可以与CSS属性“ position:absolute”一起使用,并为其提供必要的坐标。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章