从第n个孩子中删除课程

时间:2014-03-11 10:49:14

标签: jquery html css css3 printing

这是一个相当简单的问题,我希望,我有一系列div:

<div class="full">
    <div class="wrap">
        <div class="grid">
            <div class="left">

我正在创建一个特定于打印的样式表,我需要删除wrap类。我用jQuery实现了这个目标:

$(".printMe").click(function() {
    $("div.full > div:nth-child(1)").removeClass("wrap");
    window.print();
});

但这会影响我页面的整体外观。

有什么办法可以在CSS中实现上述功能,所以我可以放在我的print.css页面中吗?

print.css在我的html中被引用为:

<link type="text/css" rel="stylesheet" href="idauthenticate/css/print.css" media="print" />

由于

1 个答案:

答案 0 :(得分:1)

尝试

@media print {
    div.full > div:nth-child(1).wrap {
        /*remove styles here eg.*/
        border:0;
        padding:0;
    }
}