Wireless Army
This is a blog / tips and tricks website for web developers and security researchers.
follow us in feedly

Change content for screen size
by admin
 at 2019-03-06 04:30:00.

we have a html page but it because it’s hard to use on a small screen. So in this example we will change a font size and make content of a div change. For example if you use ads and need to have a compliantly different code for size change.

We will have a .html and a .css file

<!DOCTYPE html>
<link rel="stylesheet" href='main.css' />
<meta charset="utf-8">
<meta name="viewport" content="initial-scale = 1.0,maximum-scale = 1.0" />

<div id="primaryContainer" class="primaryContainer clearfix">
<div id="ad1">
ad number 1
<div id="ad2">
ad number 2
<div id='box2' class='clearfix'>
<h1>big text for larger screen becomes small text for smaller screen</h2>

 #ad2 {
@media only screen and (max-width: 480px) { 
h1 { 
font-size: 18px; 
#ad1 { 
#ad2 {