How to Create a Web Application Without CSS Framework?
The CSS framework is part of my everyday activities at work. Whether it is to develop a website or an application, it is an indispensable tool! But what to do when restricted to developing without it?
I recently designed an interactive quiz as part of a new product launch campaign for a new client. One of the main challenges of the project: to develop a responsive application without the use of a CSS framework!
The Advantages of the CSS Framework
The use of a CSS framework brings several advantages in the creation of a responsive application. This is what makes it so popular.
- Easily positions items in a grid
- Solves compatibility problems between browsers
- Facilitates responsive development by managing all device sizes (mobile, tablet, and desktop)
A Customized Strategy
But sometimes we can’t use it. This can be a client’s specific requirement for a new development, or simply a technical reason (e.g. maintenance on a site already developed without a CSS framework).
So, my questioning about the difficulty of positioning design elements responsively led me to seek advice from our team of developers.
Here is the strategy developed to solve this problem:
First, the definition of the following classes:
- container: to contain the elements of the page
- row: to place items in a row as on a grid
- tile: to define a content block
Now let’s go through the magic solution:
1. Use the CSS float positioning technique for the row and tile classes.
The float method is a way of positioning elements out of the normal flow of the HTML page—they become floating elements.
2. Use media queries to manage the responsiveness on different types of devices.
A media query is a CSS rule used to apply styles per specific conditions. For example, if you don’t want the browser to display an item on mobile, then specify the condition in the media query (for mobile). If the device size is smaller than 750px, don’t show the element (if the size is greater than 750px, the element will be displayed).
3. Place each section of the quiz in a container.
The minimum size of the container must be defined in the media query specific to each type of device to contain the elements of the page. The dimensions of the tiles also need to be defined.
A Simple Method for Making a Mini Custom Framework
Through the realization of this project, I learned several interesting things. First, to use media queries, it is necessary to determine break points for mobiles, tablets, and desktops.
In addition, it is necessary to make a careful QA of all scenarios and to manage exceptions for specific supported devices, for example: iPhone 4, iPhone 5, iPhone 6. The incongruities can vary, but watch out for:
- Items placed with the relative or absolute positioning method; they may need tweaking for each type of device.
- The result on a tablet in landscape mode versus portrait
In conclusion, the solution implemented was an effective strategy to get through the challenge of the project. With our team’s expertise, we developed a customized product adapted to the needs of our client. There is always a solution to every problem. Challenge yourself!