Complete introduction of CSS media queries for beginners
Thread π§΅
The biggest misconception among beginners are they think that media queries are for making a website responsive.
Though that's the one use case of media queries. You can use them modifying your site according to device media type. Let's see this in bit more details
Media types describe the general category of a device.
They are useful when you want to modify your site or app depending on a device's general type (such as print vs. screen) or specific characteristics and parameters (such as screen resolution or browser viewport width).
Let's see the media types first ππ»
1. all 2. Print 3. Screen 4. Speech
There are some deprecated media types as well but they are not in use nowadays like tty, tv, projection, embossed, aural etc...
Alright moving forward, next thing we need to understand is media features.
As the tern suggests, they are features of a particular media. They specifies the characteristic of the output device.
For example, width, height, color, aspect-ratio etc...
I hope this helped you understand that media queries are not just to make websites responsive. Although this is the biggest use case of media queries. when I was first learning it, I found some difficulties. Let see how can we use it in order to create a responsive website ππ»
Let's start with the syntax first (See attached image)
Let's see an example into action. So that we can build strong hold on the concept
"""
@ media screen and (min-width: 600px) {
div {
background: green;
}
}
"""
In this case the background will be green whenever the screen width is 600px of greater than 600px;
You can also combine two media features using "And", "Not" or ","
For example:
"""
@ media screen and (min-width: 600px) and (max-width: 900px) {
div {
background: green;
}
}
"""
In this case, the background will be green between 600px to 900px width
If you start with the right course then the process becomes a little easier
I found some amazing YouTube videos and courses that will help you start your Web Development journey
π§΅ππ»
HTML and CSS
- A great way to arouse your web dev journey with Gary's (@designcoursecom) course on YouTube
π
JavaScript
- Although it's impossible to learn JavaScript in 2 hours but JavaScript mastery is one the best YouTube chanel for JavaScript. This 2 hours long crash course will help you start your journey and gives you quick overview.
Websites for all kind of learning resources for web developers
- Fundamentals
- Accessibility
- Web components
- Progressive web apps
- Frameworks and libraries
- Testing
- Architecture and Paradigm
- UI and UX
- DS and Algo
I joined Tech Twitter 11 months ago and during this time I made around 72K audience.
Everyone can do this. Let me share how π§΅
1οΈβ£ Find your niche
Evaluate your passions and skills. And share something in the community in which you are good at. This is how you can let the people know that new member joined in the community recently
This is how I started ππ»
2οΈβ£ Use big accounts smartly π
I have noticed many people tag big accounts in their tweet in order to get impressions. This is not the right thing.
You can reply on the posts of big accounts and by doing so there might be some chances of getting impressions on your reply....