How to make Simple Responsive Website Design Using CSS3 Media Query

By | December 27, 2013

Responsive Webpage is the webpage design, which will automatically resize based on screen resolution. Responsive webpage design will ensure the user interface. Responsive webpage design can be done in many ways like media query, bootstrap design, jquery, etc. Here is the tutorial for how to make simple responsive website design Using CSS3 media query.

 

 

HTML CODE (index.php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body>
<div class="header">
<div class="container">
<div class="logo">
Logo
</div>
</div>
</div>
<!-- end of header-->

<div class="container">
<div class="content">
Audience and Device Aware is an approach aimed at ensuring that a site is
optimised to deliver what a user wants and that works effectively on the
device being used to access the site. Unlike Responsive web design (RWD),
which crafts a site visually for a range of devices, ADA aims to reflect
the many different elements that enhance and impact on the performance and
usability of a site. The predominant application for the ADA approach is
for mobile and smaller screen devices. The principle truly sees the adoption
of a “mobile first” strategy and focuses on the performance of a site and
value that it delivers to a user and the business. Mobile first, unobtrusive
JavaScript, and progressive enhancement "Mobile first", unobtrusive
JavaScript, and progressive enhancement (strategies for when a new
site design is being considered) are related concepts that predated RWD:
browsers of basic mobile phones
</div>
<!-- end of content-->

<div class="sidebar">
<div class="sidebar-title">Sidebar</div>
<ul>
<li><a href="#">Sidebar 1</a></li>
<li><a href="#">Sidebar 2</a></li>
<li><a href="#">Sidebar 3</a></li>
<li><a href="#">Sidebar 4</a></li>
<li><a href="#">Sidebar 5</a></li>
</ul>
</div>
<!-- end of sidebar-->

</div>
<!-- end of container -->

</body>
</html>
CSS CODE (style.css)

CSS, which are used inside the tag @media all and (max-width: 1000px) will be triggered when the window resolution is below 1000px

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
.header
{
height: 150px;
background: #FC3;
margin: -8px -8px 8px -8px;
}
.logo
{
font-size: 36px;
color: #333;
padding: 20px;
}
.container
{
width: 1000px;
margin: 0 auto;
}
.content
{
width: 672px;
float: left;
margin: 0 5px 0 0;
padding: 4px;
background: #E9E9E9;
color: #363636;
}
.sidebar
{
width: 300px;
float: left;
background: #5FA882;
}
.sidebar-title
{
font-size: 28px;
text-transform: uppercase;
margin: 10px;
}

.sidebar ul
{
padding: 0;
margin: 0;
}
.sidebar li
{
display:block;
}
.sidebar li a
{
text-decoration: none;
display: block;
padding: 5px 3px;
margin: 10px;
background: #FAFAFA;
color: #000;
}

/* Media query for responsive*/
@media all and (max-width: 1000px) {
.container, .content
{
width: 100%;
}
.sidebar
{
width: 100%;
margin: 10px 0 0 0;
}
.sidebar-title
{
text-align:center;
}
}

One thought on “How to make Simple Responsive Website Design Using CSS3 Media Query

Leave a Reply

Your email address will not be published. Required fields are marked *