Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
css属性中媒体的使用_Css_Media Queries - Fatal编程技术网

css属性中媒体的使用

css属性中媒体的使用,css,media-queries,Css,Media Queries,CSS 我的CSS正文中有三个用于移动、桌面和平板电脑的Format。在这种情况下,我该怎么说呢。我是否需要在我的css属性中放置多个媒体标签。是的,它是相关的 您可以通过几种方式使用媒体查询 编写时,您可以在CSS正文中声明一些Styles: @media only screen (max-width: 480px) 或者,您可以在html中指定在何种情况下使用哪个.css文件: <link rel="stylesheet" type="text/css" media="screen

CSS

我的CSS正文中有三个用于移动、桌面和平板电脑的Format。在这种情况下,我该怎么说呢。我是否需要在我的css属性中放置多个媒体标签。

是的,它是相关的

您可以通过几种方式使用媒体查询

编写时,您可以在CSS正文中声明一些Styles:

@media only screen (max-width: 480px)
或者,您可以在html中指定在何种情况下使用哪个.css文件:

<link rel="stylesheet" type="text/css"  media="screen and (max-width: 480px)"  href="example.css">
因此,您可以以多种方式使用媒体查询。 我建议你们,当你们有几行css代码要放在媒体中时,在css正文中使用这个内联表单。当你想输入大量的代码时,最好将其重构成不同的文件。代码将更加干净和体面

@media only screen (max-width: 480px)
<link rel="stylesheet" type="text/css"  media="screen and (max-width: 480px)"  href="example.css">