Yahoo India Web Search

Search results

  1. www.w3schools.com › cssref › css3_pr_mediaqueryCSS @media Rule - W3Schools

    The @media rule is used in media queries to apply different styles for different media types/devices. Media queries can be used to check many things, such as: width and height of the viewport. width and height of the device.

  2. What is a Media Query? Media query is a CSS technique introduced in CSS3. It uses the @media rule to include a block of CSS properties only if a certain condition is true.

  3. CSS Media Queries. The @media rule, introduced in CSS2, made it possible to define different style rules for different media types. Media queries in CSS3 extended the CSS2 media types idea: Instead of looking for a type of device, they look at the capability of the device.

  4. Apr 30, 2024 · The @media CSS at-rule can be used to apply part of a style sheet based on the result of one or more media queries. With it, you specify a media query and a block of CSS to apply to the document if and only if the media query matches the device on which the content is being used.

  5. Apr 30, 2024 · Media queries are used for the following: To conditionally apply styles with the CSS @media and @import at-rules. To target specific media for the <style>, <link>, <source>, and other HTML elements with the media= or sizes=" attributes. To test and monitor media states using the Window.matchMedia() and EventTarget.addEventListener() methods.

  6. Oct 2, 2020 · CSS Media queries are a way to target browser by certain characteristics, features, and user preferences, then apply styles or run other code based on those things. Perhaps the most common media queries in the world are those that target particular viewport ranges and apply custom styles, which birthed the whole idea of responsive design.

  7. Dec 12, 2023 · The CSS Media Query gives you a way to apply CSS only when the browser and device environment matches a rule that you specify, for example "viewport is wider than 480 pixels".

  8. Nov 3, 2021 · Media queries are initiated with the @media keyword (a CSS at-rule), and can be used for a variety of use cases. Target different types of output. Websites are often displayed on screens but CSS can also be used to style websites for other outputs too. You might want your web pages to look one way on a screen but different when printed out.

  9. Apr 4, 2024 · Media queries are a feature of CSS that apply specific styles based on the characteristics of the user’s device or viewport. These characteristics can include screen width, height, orientation, resolution, and more. The result of a media query is either true or false, and if true, the specified style sheet is applied.

  10. Jul 6, 2010 · The media attribute can be brought directly inside a CSS file, like this: @media screen { body { width: 75%; } } @media print { body { width: 100%; } } Likewise, you can use more advanced CSS media queries like: @media all and (max-width: 699px) and (min-width: 520px), (min-width: 1151px) { body { background: #ccc; } }