Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy my responsive CSS is not taking media width?
    primarykey
    data
    text
    <p>As the title's saying, I can't set media screen width-specific CSS for my PHP webpage.</p> <p>Here is my <code>&lt;head&gt;</code> section of my <code>index.php</code>:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;&lt;?php echo SITENAME; ?&gt; - &lt;?php echo SITEDESC; ?&gt;&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0; minimumscale=1.0, maximum-scale=1.0; user-scalable=0;" /&gt; &lt;!-- for responsive coding, the "Viewport" meta tag --&gt; &lt;!--[if lt IE 9]&gt; &lt;script src="//html5shiv.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt; &lt;![endif]--&gt; &lt;script type='text/javascript' src='scripts/respond.min.js'&gt;&lt;/script&gt; &lt;!-- for responsive mobile themes --&gt; &lt;link type="text/css" rel="stylesheet" href="style.css"/&gt; &lt;/head&gt; </code></pre> <p>For my HTML element <code>&lt;header&gt; ... &lt;/header&gt;</code>, in my CSS (in <code>style.css</code>), I specified:</p> <pre><code>header{ background: #1e5799; min-height: 40px; max-height: 136px; } </code></pre> <p>But using "Web Developer" toolbar's <em>Resize</em> &raquo; <em>View Responsive Layouts</em> is showing some fall in different width device layouts.</p> <p>For example:<br/> In my <code>&lt;header&gt;</code> tag, the inner elements are getting out, so I need to increase the height of the header. So I specified in <code>style.css</code>:</p> <pre><code>/* Media Queries for Different Types of Mobile Devices */ /* Mobile portrait (320 x 480) */ @media all and (max-device-width: 320px) { header{ height: 136px !important; background-color: #FF0000; } } </code></pre> <p>But it's not working. :(</p> <p>What am I missing about responsive CSS?</p> <h3>EDIT</h3> <p>After the first 2 answers, with their suggestions, I tried using:</p> <pre><code>@media screen and (max-width: 320px) { header{ height: 136px !important; background-color: #FF0000; } } </code></pre> <p>And yes, I put my media CSS at the bottom of <code>style.css</code>.</p> <p>I also tried separating the <code>mobile.css</code> as:</p> <pre><code>&lt;link type="text/css" rel="stylesheet" media="screen and (max-device-width: 480px)" href="css/mobile.css" /&gt; </code></pre> <p>Where I tried placing the following code:</p> <pre><code>header{ height: 130px; } </code></pre> <p>Still it's not working.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload