css中的媒體查詢_CSS中的媒體查詢

css中的媒體查詢

CSS | 媒體查詢 (CSS | Media Queries)

Creating a web page is not an easy task as it requires loads of content and data so that it becomes strongly responsive to the users. To do that various contents are even added e.g.: resources, informative content, blogs, line of codes, etc. but most importantly the factor that attracts users to any web page is media.

創建網頁不是一件容易的事,因為它需要加載內容和數據,以使其對用戶產生強烈的響應。 為此,甚至添加了各種內容,例如:資源,信息內容,博客,代碼行等,但最重要的是,吸引用戶訪問任何網頁的因素是媒體。

Trivia:

瑣事:

On that note let us talk about media queries. Media queries are the tools to implement media on your web page. For example, the @media rule which was introduced in CSS2 helped in making it possible to define style rules for different media types.

關于這一點,讓我們談談媒體查詢。 媒體查詢是在網頁上實現媒體的工具 。 例如,CSS2中引入的@media規則有助于為不同的媒體類型定義樣式規則。

But CSS2's idea did not get much support as it got obsolete. So CSS3 came into play by extending the CSS2 media type ideas. In this idea, they did not focus on the type of device but its capability.

但是CSS2的想法由于已經過時而沒有得到太多的支持。 因此,CSS3通過擴展CSS2媒體類型概念而發揮作用。 在這種想法下,他們并不關注設備的類型,而是關注其功能。

Purpose:

目的:

Media Queries are used to check many things also,

媒體查詢還用于檢查許多內容,

  • Width as well as the height of the viewport

    視口的寬度和高度

  • Width and height of the device as well orientation (whether the tablet/phone is in landscape or portrait mode?)

    設備的寬度和高度以及方向(平板電腦/手機處于橫向還是縱向模式?)

  • Resolution of the device

    設備分辨率

In fact, using media queries is a great practice in order to deliver tailored style desktops, laptops, phones, etc.

實際上,使用媒體查詢是提供定制樣式的臺式機,筆記本電腦,電話等的好習慣。

Media Queries come in with a media type and can have one or more expressions like true or false.

媒體查詢帶有一種媒體類型,可以有一個或多個表達式,如true或false。

Ways to implement:

實施方式:

There are various ways to implement Media Queries,

有多種方法可以實施媒體查詢,

One way is to have a backup CSS section right underneath your style sheet.

一種方法是在樣式表的下面有一個備用CSS部分。

So if someone wishes to include Media type files into your web page then one must opt for Media Queries.

因此,如果有人希望將媒體類型文件包含在您的網頁中,則必須選擇“媒體查詢”。

It is an enhanced version of @media that was earlier used in CSS2. So this property might come in handy to one and all who wish to create responsive and presentable web pages.

它是CSS2之前使用的@media的增強版本。 因此,此屬性可能對希望創建響應式和可呈現網頁的所有人都派上用場。

No one wishes to stick to the olde tools for so long, so why not adapt to something better?

沒有人愿意長期使用舊工具,為什么不適應更好的東西呢?

And, that better is Media Queries.

而且,更好的是媒體查詢。

There are various CSS3 Media Types and with the help of the table mentioned below, it can be easily understood.

有多種CSS3媒體類型,借助下面提到的表格,可以很容易地理解它。

Syntax:

句法:

@media not | only mediatype and(expressions) {
//CSS CODE
}

Example:

例:

<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: green;
}
@media screen and (min-width: 520px) {
body {
background-color: pink;
}
}
</style>
</head>
<body>
<p>Media query will only if the media type is screen and viewport is 520px wide or wider.</p>
</body>
</html>

Output

輸出量

Media Queries in CSS | Example 1

In the above example, the media type is screen and min width is 520px.

在上面的示例中,媒體類型為screen,最小寬度為520px 。

Other values,

其他值

ValueDescription
allIt is for all media type devices
printIt is for printers
screenIt is for computer screens, tablets, smart-phones etc.
speechIt is for screen readers that "reads" the page out.
描述
所有 適用于所有媒體類型的設備
打印 適用于打印機
屏幕 它用于計算機屏幕,平板電腦,智能手機等。
言語 它是供屏幕閱讀器“讀取”頁面的。

翻譯自: https://www.includehelp.com/code-snippets/media-queries-in-css.aspx

css中的媒體查詢

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/377291.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/377291.shtml
英文地址,請注明出處:http://en.pswp.cn/news/377291.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

SharePoint2013安裝組件時AppFabric時出現1603錯誤,解決方法:

采用PowerShell命令批量下載必備組件: 下載完成后&#xff0c;采用批處理命令安裝必備組件。 注&#xff1a;SPS2013安裝必備組件及批處理下載地址&#xff1a; 需要將必備組件放在安裝文件的PrerequisiteInstallerFiles文件夾中&#xff0c;將PreReq2013.bat放在安裝文件根目錄…

《MySQL——數據表設計三大范式》

目錄數據表設計范式第一范式第二范式第三范式數據表設計范式 第一范式 數據表中的所有字段都是不可分割的原子值。 字段值還可以繼續拆分的&#xff0c;就不滿足第一范式&#xff0c;如下&#xff1a; 下面這個&#xff0c;更加貼合第一范式&#xff1a; 范式設計得越詳細&…

三道簡單樹型dp+01背包~~hdu1561,poj1947,zoj3626

以前學樹型dp就是隨便的看了幾道題&#xff0c;沒有特別注意樹型dp中的小分類的總結&#xff0c;直到上次浙大月賽一道很簡單的樹型dp都不會&#xff0c;才意識到自己太水了&#xff5e;&#xff5e;come on&#xff01; hdu1561&#xff1a;題目給出了很多棵有根樹&#xff0c…

css 字體圖標更改顏色_在CSS中更改字體

css 字體圖標更改顏色CSS字體屬性 (CSS font properties ) Font properties in CSS is used to define the font family, boldness, size, and the style of a text. CSS中的字體屬性用于定義字體系列 &#xff0c; 粗體 &#xff0c; 大小和文本樣式 。 Syntax: 句法&#xf…

深入new/delete:Operator new的全局重載

Operator new 的全局重載 原文地址&#xff1a;http://blog.csdn.net/zhenjing/article/details/4354880 我們經常看到這么一句話&#xff1a; operator new 可以重載&#xff0c; placement new 不可重載。其實此處所說的不可重載應該是指全局的 placement new 不可重載&#…

C++基礎知識點整理

基本語法 1、static關鍵字的作用 1、全局靜態變量 加了static關鍵字的全局變量只能在本文件中使用。 存儲在靜態存儲區&#xff0c;整個程序運行期間都存在。 2、局部靜態變量 作用域仍為局部作用域。 不過離開作用域之后&#xff0c;并沒有銷毀&#xff0c;而是貯存程序中&a…

Haskell學習筆記

《learn you a Haskell》這書的結構與常見的語言入門教材完全不一樣。事實上&#xff0c;即使學到第八章&#xff0c;你還是寫不出正常的程序…因為到現在為止還沒告訴你入口點模塊怎么寫&#xff0c;IO部分也留在了最后幾章才介紹。最重要的是&#xff0c;沒有系統的總結數據類…

組合問題 已知組合數_組合和問題

組合問題 已知組合數Description: 描述&#xff1a; This is a standard interview problem to make some combination of the numbers whose sum equals to a given number using backtracking. 這是一個標準的面試問題&#xff0c;它使用回溯功能將總和等于給定數字的數字進…

可變參數模板、右值引用帶來的移動語義完美轉發、lambda表達式的理解

可變參數模板 可變參數模板對參數進行了高度泛化&#xff0c;可以表示任意數目、任意類型的參數&#xff1a; 語法為&#xff1a;在class或者typename后面帶上省略號。 Template<class ... T> void func(T ... args) {// }T:模板參數包&#xff0c;args叫做函數參數包 …

BI-SqlServer

一.概述 SqlServer數據倉庫ETL組件 IntegrationServiceOLAP組件 AnalysisService報表 ReportingServiceMDX(查多維數據集用的)和DMX(查挖掘模型用的)。二.商業智能-Analysis Services 項目 構建挖掘模型1構建挖掘模型2構建挖掘模型3三.商業智能-SqlServerAnalysis-Asp.net WebS…

python 子圖大小_Python | 圖的大小

python 子圖大小In some cases, the automatic figure size generated by the matplotlib.pyplot is not visually good or there could be some non-acceptable ratio in the figure. So, rather than allowing a pyplot to decide the figure size, we can manually define t…

《設計模式整理》

目錄常見設計模式如何保證單例模式只有一個實例單例模式中的懶漢與餓漢模式OOP設計模式的五項原則單例模式中的懶漢加載&#xff0c;如果并發訪問該怎么做常見設計模式 單例模式&#xff1a; 單例模式主要解決了一個全局使用的類頻繁的創建和銷毀的問題。 單例模式下確保某一個…

JSON學習資料整理

1.什么是JSON JSON(JavaScript Object Notation) 是一種輕量級的數據交換格式。它基于JavaScript的一個子集。 JSON采用完全獨立于語言的文本格式&#xff0c;但是也使用了類似于C語言家族的習慣&#xff08;包括C, C, C#, Java, JavaScript, Perl, Python等&#xff09;。這些…

OSI七層模型及其數據的封裝和解封過程

OSI(Open System Interconnection)參考模型把網絡分為七層: 1.物理層(Physical Layer) 物理層主要傳輸原始的比特流,集線器(Hub)是本層的典型設備; 2.數據鏈路層(Data Link Layer) 數據鏈路層負責在兩個相鄰節點間無差錯的傳送以幀為單位的數據,本層的典型設備是交換機(Switch)…

rss聚合模式案例_RSS的完整形式是什么?

rss聚合模式案例RSS&#xff1a;真正簡單的聯合 (RSS: Really Simple Syndication) RSS is an abbreviation of Really Simple Syndication. It is also called Rich Site Summary. It is quality attainment for the syndication of collection of web content and used to di…

《MySQL——38道查詢練習(無連接查詢)》

目錄一、準備數據1、創建數據庫2、創建學生表3、創建教師表4、創建課程表5、創建成績表6、添加數據二、查詢練習1、查詢 student 表的所有行2、查詢 student 表中的 name、sex 和 class 字段的所有行3、查詢 teacher 表中不重復的 department 列4、查詢 score 表中成績在60-80之…

工作經常使用的SQL整理,實戰篇(一)

工作經常使用的SQL整理&#xff0c;實戰篇&#xff08;一&#xff09; 原文:工作經常使用的SQL整理&#xff0c;實戰篇&#xff08;一&#xff09;工作經常使用的SQL整理&#xff0c;實戰篇&#xff0c;地址一覽&#xff1a; 工作經常使用的SQL整理&#xff0c;實戰篇&#xff…

XPth和XSLT的一些簡單用法

&#xff08;目的在于讓大家知道有這個東西的存在&#xff09; XPath:即XML Path語言(Xpath)表達式使用路徑表示法(像在URL中使用一樣)來為XML文檔的各部分尋址&#xff01; 關于XPath如何使用了&#xff0c;我們來看看&#xff01;當然這里面的代碼只是入門&#xff0c;更深層…

isc dhcp_ISC的完整形式是什么?

isc dhcpISC&#xff1a;印度學校證書 (ISC: Indian School Certificate) ISC is an abbreviation of the Indian School Certificate. It alludes to the 12th class examination or higher secondary examination conducted by the Council for the Indian School Certificat…

《MySQL——連接查詢》

內連接&#xff1a; inner join 或者 join 外連接 1、左連接 left join 或 left outer join 2、右連接 right join 或 right outer join 3、完全外連接 full join 或 full outer join 圖示理解 全連接 創建person表和card表 CREATE DATABASE testJoin;CREATE TABLE person (…