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

How to build a deep learning environment running Python in Docker container

Check virtualization in Task Manager, if it is en...

Linux Network System Introduction

Table of contents Network Information Modify the ...

js to realize automatic lock screen function

1. Usage scenarios There is such a requirement, s...

How to display TIF format images in browser

The browser displays TIF format images Copy code T...

MySQL compressed package version zip installation configuration method

There are some problems with the compressed versi...

Understand the principle of page replacement algorithm through code examples

Page replacement algorithm: The essence is to mak...

Creating a Secondary Menu Using JavaScript

This article example shares the specific code of ...

Tutorial on building a zookeeper server on Windows

Installation & Configuration The official web...

JavaScript to implement the web version of the snake game

This article shares the specific code for JavaScr...

Introduction to the use of MySQL pt-slave-restart tool

Table of contents When setting up a MySQL master-...

Detailed explanation of Json format

Table of contents A JSON is built on two structur...

Rainbow button style made with CSS3

Result: Implementation code: html <div class=&...

The forgotten button tag

Note: This article has been translated by someone ...