?Discuss media query expressions with relevant examples.

What will be an ideal response?


?A media query can use a logical expression to test whether a viewport has reached a particular breakpoint. The logical expression includes the name of a media query feature, a characteristic of the environment, and a breakpoint value to be tested. If the logical expression evaluates to "true," the media query applies the styles that follow. Following is an example of a media query that includes a media type and a logical expression:?          ?This code directs browsers to use the styles-mobile.css stylesheet in the css folder when screens have a viewport width smaller than or equal to 480px (which is a common maximum viewport size for a phone and thus a common breakpoint for changing styles). In this case, max-width is the feature and 480px is the breakpoint value being tested in the logical condition. A media query can also test for both minimum and maximum breakpoints, as in the following example:??In this case, the code directs browsers to apply the styles-tablet.css stylesheet in the css folder when screens have a viewport width between 481px and 768px (common breakpoint sizes for tablet devices). When testing for minimum and maximum widths, the word "and" separates each part of the media attribute value. This means that each part must be true to apply the associated styles. The syntax also requires you to surround the logical expression with parentheses and use a colon to separate the media query feature from the value being tested. When writing the CSS code, follow the requirements of the syntax carefully to make sure the media query works correctly.

Computer Science & Information Technology

You might also like to view...

Office 365 has several advantages over Office 2013, but requires payment of an annual fee

Indicate whether the statement is true or false

Computer Science & Information Technology

The Internet Explorer button that reloads a webpage you are viewing to see updates since the last time you viewed it, is the ________ button

A) Reload B) Forward C) Back D) Refresh

Computer Science & Information Technology

The statement if (document.getElementById) returns ____ when a browser is compatible with the W3C's version of DHTML.

A. false B. true C. yes D. an error message

Computer Science & Information Technology

An IT security ________ helps to reduce risks.

A. control B. safeguard C. countermeasure D. all of the above

Computer Science & Information Technology