Problem coloring table rows in print using @media ASP.NET MVC

Asked

Viewed 99 times

1

In my view the result of my table is as follows:

inserir a descrição da imagem aqui

In printing:

inserir a descrição da imagem aqui

I put my css styles used in the view inside @media as follows:

<style>
    .form-control {
        min-width: 100% !important;
    }

    .p-periodo{
        text-align :left !important;
        margin-left: -1.5% !important;
        margin-top: 3% !important;
    }


    #btnImprimir {
        margin-top: 8% !important;
    } 

    th {
        text-align: center !important;
    }

    .debito {
        color: red;
    }

    .saldo {
        background-color: gainsboro;
    }

    .credito {
        text-decoration-color: black;
    }

    .periodoMensal {
        border: none !important;
        border-style: none !important;
        background-color: dimgray;
        color: white;
    }

    @@media print {

        th {
            text-align: center !important;
        }

        #myContainerPrint{
            margin-top: -10% !important;            
        }

        #btnImprimir {
            display: none !important;
        }

        .debito {
            color: red !important;
        }

        .saldo {
            background-color: gainsboro !important;
        }

        .periodoMensal {
            border: none !important;
            border-style: none !important;
            background-color: dimgray;
            color: white;
        }

        .credito {
            text-decoration-color: black !important;
        }

    }

</style>

What I need to do to print the colors of the lines in my table to be the same as in my view ?

1 answer

1

@print media {

}

you’re wearing it like this :

@@print media {

}

  • In c# the character @is reserved for Razor, so in this case to use @media I need to use @@media, but it is working, but it is not coloring the lines as it should do understand ?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.