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

HTML5+CSS3 header creation example and update

Last time, we came up with two header layouts, on...

Installation and configuration of mysql 8.0.15 under Centos7

This article shares with you the installation and...

Difference between var and let in JavaScript

Table of contents 1. Scopes are expressed in diff...

JavaScript implements page scrolling animation

Table of contents Create a layout Add CSS styles ...

js basic syntax and maven project configuration tutorial case

Table of contents 1. js statement Second, js arra...

Build a server virtual machine in VMware Workstation Pro (graphic tutorial)

The VMware Workstation Pro version I use is: 1. F...

Using Zabbix to monitor the operation process of Oracle table space

0. Overview Zabbix is ​​an extremely powerful ope...

Basic notes on html and css (must read for front-end)

When I first came into contact with HTML, I alway...

How to find the specified content of a large file in Linux

Think big and small, then redirect. Sometimes Lin...

JavaScript implements class lottery applet

This article shares the specific code of JavaScri...

Html+CSS drawing triangle icon

Let’s take a look at the renderings first: XML/HT...