Various front-end printing methods of web: CSS controls web page printing style

Various front-end printing methods of web: CSS controls web page printing style
CSS controls the printing style of web pages :
Use CSS to control the print style. I was a complete mess when I first used it. I had no idea what the function of midia in CSS was. When I asked others to import this style, I was still at a loss. If you also have this phenomenon, then let me tell you, find out the function of CSS midia on W3school.

midia definition and usage :
The media attribute specifies the device on which the linked document will be displayed.
The media attribute is used to specify different styles for different media types.
Media is used to specify the media type of CSS. Its syntax formats are as follows:
@media screen | print | projection | braille | aural | tv | handheld | all

Parameter Description :
screen: refers to the computer screen.
print: refers to opaque media used in printers.
projection: refers to the project used for display.
braille: Braille system, refers to printed matter with tactile effects.
aural: refers to an electronic speech synthesizer.
tv: Television-type media.
handheld: refers to a handheld display device.
all: For all media.
Just add the following CSS style declaration to the things you don’t want to print, and they will not appear on the printed page:

Copy code
The code is as follows:

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

For example:

Copy code
The code is as follows:

<style midia="print">//midia must be declared, otherwise it will be invalid
#my_hidden{display:none;}
</style>

<<:  About Zabbix forget admin login password reset password

>>:  How MySQL supports billions of traffic

Recommend

Which one should I choose between MySQL unique index and normal index?

Imagine a scenario where, when designing a user t...

Getting Started with Front-End Vue Unit Testing

Table of contents 1. Why do we need unit testing?...

JS realizes picture digital clock

This article example shares the specific code of ...

Linux general java program startup script code example

Although the frequency of starting the shell is v...

Install OpenSSL on Windows and use OpenSSL to generate public and private keys

1. OpenSSL official website Official download add...

Analysis of pitfalls in rounding operation of ROUND function in MySQL

This article uses examples to illustrate the pitf...

Example code for implementing transparent gradient effects with CSS

The title images on Zhihu Discovery columns are g...

CSS3 gradient background compatibility issues

When we make a gradient background color, we will...

Three methods of inheritance in JavaScript

inherit 1. What is inheritance Inheritance: First...

JS achieves five-star praise case

This article shares the specific code of JS to ac...

TypeScript namespace explanation

Table of contents 1. Definition and Use 1.1 Defin...