HTML styles compatible with different device types

Source: Internet
Author: User

You can use the Media property to specify the style that is used for different media when you experience the effects that appear on the screen in your project and when you print them differently.

Media Property Value:

Value Describe
Screen computer screen display (default)
Tty Telex typewriters and similar media using a wide character grid
Tv TV type equipment (low resolution, limited scrolling capability)
Projection Projector
Handheld Handheld Devices (small screen, limited bandwidth)
Print Print Preview mode/print page
Braille Braille Method Feedback Device
Aural Speech synthesizer
All Suitable for all devices

Definition and usage

The media attribute specifies what device the linked document will be displayed on.

The media property is used to specify different styles for different media types.

Browser support

All browsers support media properties with a value of "screen", "Print", and "all".

  tip: in full-screen mode, Opera also supports the "projection" attribute value.

How to use one:

Use Way two:

<style type= "Text/css" media= "All" >/*Common Styles*/         .        printpage{margin:0px Auto;} . Breakpage{page- Break-Before:always;} . Headerarea,. Gridarea,.            bottomarea{margin:5px 0px;        padding:0px; }        . Headerarea,.        Bottomarea{position:relative;overflow:hidden;} .        Headerelement{position:absolute; Display:flex;} .        HeaderElement Span{display:block;} . HeaderElement Span[name= ' ShowLabel ']{min-width:90px; margin-right:5px; text-Align:right;} . HeaderElement Span[name= ' Showvalue ']{flex:1;} table td{Overflow:hidden; White-Space:nowrap; }    </style> <style type= "text/css" media= "screen" >/*On- screen display style*/        . Headerarea[print= ' Headprint ']{display:none;} . Bottomarea[print= ' Bottomprint ']{display:none;} . Gridareatable[print= ' Tableprint ']{margin-top:0; border-top:0}. First-line-Print{display:none;} . Bottomarea[show= ' bottomshow ']{display: '} #btnTemplateDesign, #btnTemplateInit {display:none;} </style> <style type= "text/css" media= "print" >/*style when printing*/. Buttondiv{display:none;} . Headerarea[print= ' Headprint ']{display: '; page- Break-Before:always;} . Bottomarea[print= ' Bottomprint ']{display: ';} . Gridareatable[print= ' Tableprint ']{margin-top:10px; border-top:1}. First-line-print{display: ";} . Bottomarea[show= ' Bottomshow ']{display:none;} </style>

HTML styles compatible with different device types

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.