I still struggle with making websites responsive. I know beginners surf the web (or at least, that's what I did) in an attempt to learn how to make websites responsive, but what you'll find is fragmented explanations of smaller concepts.
In this post, I'm going to try my best to explain the 8 responsive web design best practices that have helped me master this element of web development, and might help you make your websites responsive in 2021.
Responsive
Adaptive
Instead of using an absolute unit start using relative units.
Absolute units => Don't use {cm, mm, in, pc, px, pt}
Relative unit => Use {em, rem, lh, vw, vh}
Breakpoints are predefined areas of measurement that allow you to re-arrange your web layout dependent on the size of the browser or device.
Bootstrap responsive breakpoints
@media (min-width:576px) {...}
@media (min-width:768px) {...}
@media (min-width:992px) {...}
@media (min-width:1200px) {...}
Understand when to use Max and Min values.
@media (min-width: 1024px){
h1 {
font-size: 1rem;
}
}
@media (max-width: 1024px){
h1 {
font-size: 0.5rem;
}
}
Nested objects or container are the objects that are inside another object.
It allows controlling the nested element instead of constantly having to control each element.
<div class="parent>
<span class="nested-element-1">Read</span>
<p class="nested-element-1">RAHULISM></p>
<p class="nested-element-1">Articles</p>
</div>
<!-- STYLE -->
<style>
.parent span {
color: black;
}
.parent p {
color: blue;
}
</style>
When Desktop First is Appropriate
When Mobile First is Appropriate
SOME SAFE WEB FONTS THAT ARE RENDERED CORRECTLY
Georgia, Times New Roman/Times, Arial / Helvetica, Comic Sans, Lucida Sans Unicode, Tahoma / Geneva, Courier New.
Bitmap images are stored as a series of tiny dots called pixels,
A vector image is an artwork made up of points, lines and curves that are based upon mathematical equations, rather than solid coloured square pixels.
What to use?
VECTOR IMAGE: More scalable than bitmap, Ability to increase the size of the graphic without pixelation and Better Quality.
😎Thanks For Reading | Happy Coding 🤓
Also published here.