Explore more such useful questions here - 10 Most Common Interview Questions and Answers of HTML5 and CSS3
ADMEC Multimedia is a leading institute and ISO Certified center in Delhi. It is a leading institute in the multimedia industry for the professional and practical training for the training of Web Designing, Web Development, 3D Animation, Graphic Designing, Advertising Designing, Video Editing, Visual Effects, Motion Graphics, SEO, Architecture & Interior Designing, AutoCAD etc.
Showing posts with label HTML & CSS. Show all posts
Showing posts with label HTML & CSS. Show all posts
Thursday, March 19, 2020
Most Frequently Asked HTML & CSS Interview Questions and Answers to Crack Any Interview
Explore more such useful questions here - 10 Most Common Interview Questions and Answers of HTML5 and CSS3
Tuesday, August 21, 2018
Use of Media Query in HTML & CSS
HTML is really an amazing language used in all around the world for creating beautiful and stunning websites. One who wants to build their career in web design and development should have sound knowledge of HTML so that they can go for advanced level web courses. Now, with the arrival of HTML5, responsive websites are started designing too. This has increased the popularity of HTML5 among the web designers in the industry. But how we can create a responsive website in HTML that can be accessed on different devices. Well, this is possible with Media query on which we are going to discuss in this blog.
An Insight to Media Query in HTML & CSS
Media Query is a CSS 3 feature to change the properties of the content of the screen according to a device such as a screen resolution, viewport width etc.
Use of Media Query in HTML & CSS
- The most commonly used media feature is width and height. CSS media query is a W3C recommendation and it uses CSS rules to adopt different conditions.
- Most commonly CSS media query is used when we use mobile screen instead of a computer screen.
- It uses @media rule in our CSS to include certain CSS properties only when a certain condition is holding true. We include media query with help of HTML and CSS to make a responsive web design which provides flexibility to the contents of the website and enhance the webpage for viewing in different devices like Desktop, smartphone, tablet etc.
How to use Media Query?
To use a media query, we should have an idea about the resolution of different devices
- Mobile:320px
- Tablet:780px
- Desktop:1600px
We can use a media query in the head tag of our HTML code by using style tag or we use it in our external CSS.
Syntax for HTML:
<head>
<style>
body{background-color:red;}
@media screen (min-width:450px){background-color:orange;}
</style>
</head>
This code changes the colour of the background from red to orange when we use device resolution of the width greater than 450px.
Syntax for CSS media query:
@media <media-type> and (expression/media feature){ CSS properties}
For ex: @media screen and (max-width:1500px){width:100%; height:auto}
Here screen refers to the screen of the device like mobile, tablet, desktop.
Using CSS of a media query, we can change font size, margin, padding, colour
width, animation etc.
Basically, we can change the style of header, navigation, and footer according to the media type of the device. We can also add and remove elements of the website according to different devices and for our convenience.
For ex: @media screen and (max-width:800px)
{
footer p{display:none;}
}
This is how we can use media query in HTML & CSS. You can explore more about media query from online resources or by joining Web Development Institute (an education partner of ADMEC ). which offers in-depth training on every aspect of web designing and development.
Author Section: I Akash Jain successfully completed HTML5 CSS3 Master Course from ADMEC. This blog is the part of my practical project. Hope it would be helpful for you.
Subscribe to:
Posts (Atom)
Featured Post
ADMEC Multimedia Institute Scholarship Program
The ADMEC Multimedia Institute scholarship program aims to select and trained talented non working female, married woman and non married m...
-
Selection is the most important and very first thing to do in a designing application or any other field like programming. There are 10 ...
-
Colors is most valuable things in our life. Without colors be cannot express our ideas . In electronic things (TV and computer display) u...
-
Computer designing software used for 2D, 3D and drafting. Developed and marketed by Autodesk. First released: - December, 1992...
