Verify:
I am interested in designing a responsive layout as illustrated below:
Desktop View:
https://i.sstatic.net/vzSpz.png
Mobile View:
https://i.sstatic.net/0a8Q5.png
To achieve this design, I have implemented the following CSS and HTML structure:
<style>
@media only screen and (min-width:1220px){ #mobile,.mobile{display:none} }
@media only screen and (max-width:1220px){ #pc,.pc{display:none} #mobile,.mobile{display:block} }
@media handheld{ #pc,.pc{display:none} #mobile,.mobile{display:block} }
</style>
<div class="pc text">
<table><tr><td><table><tr><td width="100px"><span class="thumb"><img src="http://img.wapkafile.com/software/thumb/43908225/2696215/935beea5c2c820f5a5e54a65cc7fcc52/240.jpg" /></span></td><td width="*"><h2>ChatAdda</h2>
<ul><li><strong>Size : 13.11 MB</strong></li>
<li><strong>Downloads : 12</strong></li>
<li><strong>Category :<a href="http://apkapp.in/software/list/1430431"> Communication</a></strong></li>
<li><strong>Price : Free</strong></li>
</ul></td></tr></table></td>
<td><script data-cfasync="false" type="text/javascript" src="http://www.adnetworkperformance.com/a/display.php?r=449076"></script></td></tr></table>
</div>
<div class="mobile text">
<table><tr><td width="100px"><span class="thumb"><img src="http://img.wapkafile.com/software/thumb/43908225/2696215/935beea5c2c820f5a5e54a65cc7fcc52/240.jpg" /></span></td><td width="*"><h2>ChatAdda</h2>
<ul><li><strong>Size : 13.11 MB</strong></li>
<li><strong>Downloads : 12</strong></li>
<li><strong>Category :<a href="http://apkapp.in/software/list/1430431"> Communication</a></strong></li>
<li><strong>Price : Free</strong></li>
</ul></td></tr></table>
</div>
<div class="mobile text"><script data-cfasync="false" type="text/javascript" src="http://www.adnetworkperformance.com/a/display.php?r=449076"></script></div>
One challenge I'm facing is that I'm using the @media
CSS to alternate between mobile and desktop views by toggling display:none
, which requires me to include the ad code (
<script data-cfasync="false" type="text/javascript" src="http://www.adnetworkperformance.com/a/display.php?r=449076"></script>
) for the second block twice. How can I achieve the same result with the ad code included only once and without relying on tables?