媒体查询无法在php文件中工作[关闭]

Hi in my php files media queries are not being read from my css, but if i save my php files as html files my media queries do work.

im using php so i can us the include function e.g.

is there a way to make my media queries still work in php files?

How are you calling mediaqueries css? Mediaqueries are independents from the page extension. I use mediaqueries in a php file without problems. I call them in the head of my php file: per example.:

<head>
...
<link rel="stylesheet" type="text/css" href="assets/css/style.css" />
<link rel="stylesheet" type="text/css" href="assets/css/mediaqueries.css" />
</head>

In the style.css are the general styles and is in the mediaqueries.css file where i apply my styles for any dispositive, for explample:

/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-width : 768px) 
and (max-width : 1024px) {
   /* specific CSS for IPad*/
}

Media queries is a CSS feature and should not be in a PHP file, it should be in an external CSS file and should be included by a <link> tag.

like in:

<link href="http://server.info/jquery.socialist.css" rel="stylesheet"/>

If, for a specific reason, you have to dynamically generate your media queries, using PHP, keep including your PHP script on a <link> tag.

<link href="http://server.info/your_css_generated_with_php.php" rel="stylesheet"/>

You have a media query that only looks for320px to 480px. But you are giving a width of 980px to the .container. Obviously, it doesn't look right to me. You may want to re-visit your styles.