Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use a different stylesheet for iphone or android? I can modify only html later on
    primarykey
    data
    text
    <p>I'm trying to make a page where some elements will be visible only for android and iphone. I was thinking of using simple css properties to hide the elements e.g.:</p> <p>HTML:</p> <pre><code>&lt;style&gt;img{ display:none;} &lt;/style&gt; &lt;img src="img1.jpg" class="other"&gt; &lt;img src="img2.jpg" class="iphone android"&gt; &lt;img src="img3.jpg" class="iphone"&gt; &lt;img src="img4.jpg" class="android"&gt; &lt;img src="img5.jpg" class="iphone android other"&gt; </code></pre> <p>CSS 1 (for devices different than iphone / android)</p> <pre><code>.other{ display:inline;} </code></pre> <p>CSS 2 (for iphones)</p> <pre><code>.iphone{ display:inline;} </code></pre> <p>CSS 3 (for androids) </p> <pre><code>.android{ display:inline;} </code></pre> <p>All I need now is to detect the device somehow ( I belive it can be done by jQuery and implement the correct CSS stylesheet). </p> <p>So the effect will be:</p> <p>img1: displayed only on devices other than iphone and android</p> <p>img2: displayed only on iphone and android devices</p> <p>img3: displayed only on iphones</p> <p>img4: displayed only on android devices</p> <p>img5: displayed only on all devices</p> <p>I have done another subject here <a href="https://stackoverflow.com/questions/15221520/how-to-use-a-different-stylesheet-for-iphone-or-android">another question</a>, but there is one important tricky thing. <strong>After applying everything, I will later need to change only HTML, I won't be able to touch jquery and css files later, so as I will do them they must remain untouched. I will be able to manually add classes to each image only</strong>, so I only thing I can manipulate is manually adding and removing classes from the pure html. How can I do it? So, if I add class="iphone android", then the image will be displayed on these two systems. <strong>Also can I do it by iOX generally? So it will work on iphones, ipods, ipads, etc?</strong>. Thx for your help and time.</p> <p>BTW. I know how to do it for different resolutions, but here I need specifically for the each operating systems, so if I have a button which leads the user to the android market, I need the specific button/image to be displayed only on Android devices... etc. Thanks</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.
 

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