0 votes
in Website Optimization by
What are media queries and how are they used in web design?

1 Answer

0 votes
by (47.6k points)

Media Queries are CSS codes that provide display instructions according to screen size.
Examples of a media query is a CSS code that instructs browsers to load website images depending on the screen size.

Load 720 px banner image in the header of desktops and loads 350 px banner image in the header of mobile devices”

Example  1

p {
font-size:15px;
}

Example 2

@media only screen and (min-width: 450px) {
p {
font-size: 18px ;
}
}


Example 1 is a normal CSS which says the font size for the text is 15 px.

Example 2 is a Media Query which says that if the screen size is more than 450px then the font size of the text should be 18px.

 Media queries are used to design responsive mobile web pages.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Mar 10, 2021 in General by anonymous
+1 vote
1 answer
Register, ask, and answer questions to earn more points and privileges. Some features are disabled for users with few points.
Welcome to Kenyayote Q&A, the largest community site in Kenya where you can ask any question and receive answers from Kenyayote staff and other members of the community.

Before you ask, search the website to make sure your question has not been answered.

If you are ready to ask, provide a title about your question and a detailed description of your problem.

Register to join Kenyayote Ask Community.
...