In this article, we will discuss best practices for web designing, which will make web designing easier, faster, and more effective.
We have discovered some useful guidelines for web designing and applied the same while designing our website and achieved surprising results.
Today, I would like to share those useful tips with you guys. You can apply them to your website design.
Note — These are guidelines from my own experience. It may vary for others.
We believe that everyone deserves the opportunity to succeed and thrive, and Justly is designed to provide the guidance and support needed to make that a reality.
It’s not enough to know HTML or CSS for any front-end design. It’s always better to divide the design into small modules(components) rather than designing a full page into one!
Ex — Consider designing a home page for a site, consisting of a header, footer, content…etc sections.
Rather than designing all the sections into separate files/components, keeping them separate is recommended. It makes our life easier!
Similarly, if any sub-component is large enough to design, we can further divide it into small components.
See the below example.
I’ll go with
vue
, You can apply this to your preferred framework.
<template>
<Header />
<LandingSection />
<MiddleSection />
<CTASection />
<Footer />
</template>
Tip — Divide the whole page into separate components.
Perfection is good to manage things. But sometimes it requires time to achieve results with it.
Instead of going with perfection while designing, we can apply rough-design approach
.
Whenever we try to design perfectly as given, it takes more time to design. Later on, when we start with a new div, we have to adjust the perfect design also and it becomes cyclic 😨.
Ex — You want to design the below section.
I am seeing two horizontal divs (description
and image
) in it. It can be designed in two different ways.
Perfection — Will take time, don’t waste time
<template>
<div class="flex">
<div class="description">
We develop amazing products to help
Startups
bring their ideas to life.
<router-link :to="contactURL">
<span>Let's talk</span>
<font-awesome-icon
class="fa"
icon="arrow-right"
/>
</router-link>
<small class="v2-canopas-gradient-text pt-1">
100% MONEY BACK GUARANTEE
</small>
</div>
</template>
Rough Design — Quick and easy to do
<template>
<div class="flex">
<div class="description">
<!-- description will be here -->
</div>
<div class="image">
<!-- image will be here. currenlty, can apply any background color here -->
</div>
</div>
</template>
Tip — First do the rough design of each div, later you can make them perfect.
Done > Perfect
People are using mobiles more than desktops nowadays. We need equal focus on page responsiveness on mobiles, too.
We need to design pages that will compatible with all devices from mobile to desktops (You can consider TVs and Wearables also).
Mobile-first design: Write CSS for smaller(mobile) devices first, then go with larger(desktop) devices.
From my experience, I found some advantages of mobile-first design.
Tip — Start writing CSS from smaller resolutions
and scale them to the larger
ones!
Don’t judge me wrong. I am saying about using available frameworks like bootstrap or tailwind.
Bootstrap: It is a very well-known and most used framework for CSS. It comes up with predefined classes. By using this, we can design anything with fewer styles.
Tailwind: This lightweight CSS framework is a buzzword among developers recently. It has classes for all CSS properties, so we don’t need to write any custom classes. and we can build our website without CSS.
There are many other frameworks though like Bulma, Skeleton, UIKit, etc… Go ahead with your favorite one!
However, I personally recommend using Tailwind over any other, as it’s too lightweight comparatively.
Tip — Use frameworks to design websites faster.
On websites, around 70% of the content is occupied by images. Fit images to the page, that will be responsive is a quite tricky task.
We have applied the following things when designing images,
A div or container should not depend on image
size, instead image size should resize according to the container's size.
We should use responsive images for website design according to device size(Ex: 400px, 800px, 1200px, 1600px).
Resize the image in given sizes and use it according to device size. See the below example.
<template>
<picture>
<img
:src="images[2]"
:srcset="`${images[0]} 400w, ${images[1]} 800w, ${images[2]} 1200w`"
sizes="33vw"
alt="image"
/>
</picture>
</template>
I have used img
tag. Alternatively, the source
tag can also be used. Based on device size, the img tag will choose an image and display it.
Attributes the example has used are,
Explore more about Responsive images, pictures, img, and source tags from MDN.
Note: Don’t create more than 5 responsive images. srcset will use nearby-sized images as per devices.
Tip —Image size should be equal to or slightly more than the given container size, for that use responsive images
.
Lazy loading is helpful for a better user experience, and also for SEO kinds of stuff.
What will happen if we don’t apply it?
Lazy loading makes images or any resources non-blocking
. It identifies those resources and only renders them when needed. Ultimately, it won’t load all the images on page load, rather than it will load images as we scroll the page.
Lazy loading example for images,
<img src="image.jpg" alt="..." loading="lazy">
Similar way we can apply it to other resources like fonts
, iframe
, or even on CSS
and JS
links.
Tip — Use lazy loading for larger-resolution images.
Why do we load an image if it’s not needed in the design?
Sometimes we need to hide images on mobile devices and show them in desktop browsers.
There are two ways to do it.
i. Load image every time and show/hide from CSS — Bad practice
Hiding images from CSS will not remove images from DOM. And it will affect the performance of the website eventually.
ii. Load image when needed — Good practice
Conditional image loading removes the extra overhead of loading unused images from DOM and the page loads fast.
Tip — Use conditional rendering instead of permanent rendering.
Testing is the most important phase of software development, no matter if it’s design or development.
While testing a website, the designer must have to consider user experience, responsiveness, loading time, SEO ranking, etc.
Here are some notes on it,
We have found these tricks and applied them to our website, and you won’t believe it, it has improved the performance score on Pagespeed Insights by ~50% 😳.
We’re Grateful to have you with us on this journey!
Suggestions and feedback are more than welcome!
Please reach us at Canopas Twitter handle @canopas_eng with your content or feedback. Your input enriches our content and fuels our motivation to create more valuable and informative articles for you.
Keep improving for the best✌️!!
Whether you need...