Skip to main content

Simplifying Life with CSS Frameworks

Simplifying Life with CSS Frameworks

Responsive Design, Mobile First, Material Design, UX, IxD... 

You can choke on technology. It's coming fast and furiously. The biggest challenge of the 21st century may be how to simplify life. How to do one thing at a time when you have five LCD screens blinking at you all the time each with multiple notifications, announcements, ticker tapes, breaking news and all the rest of it.

I can't solve all your life's problems but can share a little trick or two here and there. If you gather all these tricks, you could actually simplify life. 

Mobile First

 This is a recent approach to website design. In Kenya 97% of web users use their mobiles.  Few have computers, many have smartphones. Therefore, why make websites for computers when these are the minority? Why not make them for mobile first and adjust to fit the few who visit with computers.

The chart below shows the data from Google Barometer for Kenya:

Mobile access is at 97% compared to 17% for computers. 

One of the ways to handle this task of creating web pages for everyone is to use CSS (Cascading Style Sheets) frameworks or libraries. If you ask web developers what are the best CSS frameworks, you are likely to get a list such as the following:
  •     Bootstrap
  •     Materialize CSS
  •     Foundation
  •     Semantic UI
  •     UIKIT  
 For the gurus, these are probably fine. But for the one trying to do a page here and there or learning CSS and web design for the first time, I recommend W3.CSS. Its a beautiful new CSS Framework that can solve a web developer's nightmares with some elegant tricks. I will cite one example of such a nightmare I faced this very week.

The site was a placeholder page for a new savings cooperative called Mhadhiri.  The nightmare was that the logo on the home page displayed well in a PC screen but overflowed a smartphone screen. If you look for solutions online, you will see discussions about the CSS @media directive. The idea is to tell the browser:
  1. For devices with small screens, display the logo using this size
  2. For devices with medium screens, use this other size
  3. For devices with large screens, use the full size logo etc.

The logo was inserted using a standard <img > tag. Some of the traditional responsive code looks like this (click to enlarge):

But it did not work. The mobile still displayed a huge logo while the computer displayed a logo that was acceptable. What to do?

It turns out that W3.CSS has (simple)  tools to  handle this kind of thing. You can specify whether to display or not display some content depending on the screen size of the device used to access the web site. Examples (actually used in Mhadhiri):

 class="w3-hide-medium" applies a directive that means "do not show this item in medium-sized devices". What constitutes medium is defined by break points which are the screen sizes in pixels that define the boundaries as you move from one size to another. Google's Material Design recommends the following break points: 480, 600, 840, 960, 1280, 1440, and 1600dp. A dp (device-independent pixel) is related to a pixel though they are not identical.

In the code above, the logo file is called "Mhadhiri SACCO.jpg". In the first segment, the W3.CSS class directive says: w3-hide-large w3-hide-medium. There are only three categories: small, medium and large. It means this logo, set to display with a width of 320px, will not display in a medium and large screen but will display in a small screen.

The second segment of code will display the logo at 450px only in a medium screen while the last will display only in a large screen at 1000px. W3.CSS uses the break points 0 - 600 for small, 601 - 991 for medium  and 992+ for large.

In summary, the Mobile First web design philosophy takes the view that it is better to design for mobile access first then adjust for PC access simply because the majority of web users now access the web principally via mobile. In designing for such a scenario, responsive designs become mandatory. CSS frameworks provide a way to implement responsiveness without getting into complex code. It is analogous to the debate of declarative versus procedural programming that programming theorists sometimes engage in. The truth is that few want to get into complex code if a few libraries and APIs offer an easier, quicker and more elegant way to do the job. In conclusion, after messing around with CSS for quite some time, it did not work. But a couple of W.CSS directives did the job in less than a minute. The moral of the story: Simplify your life. John the Baptist had only one suit. He never ate a cooked meal. Yet he ushered in the Messiah. Simplify. 

And finally, I must tell you that this same John the Baptist, this same Elijah, is here crying again in the wilderness: The Messiah is coming! Prepare the way.  

Be most blessed today.


Popular posts from this blog

Acer Aspire V5-471 Solution to "Operating System Not Found" After Changing From UEFI to BIOS

If you deliberately or accidentally change an Acer Aspire V5-471 (probably other Acers as well) boot setting from UEFI to BIOS, then you may be in for a shock when you try to start the laptop.

You may get the message Operating System Not Found on the top left corner of your screen or something similar.

Ideally you can press F2 during booting and get into booting settings and change them but in my case F2 does not work! Nothing works - neither a bootable DVD, bootable USB drive or whatever else you throw at it to try to get the machine to wake from coma.

You could spend a year searching various forums. You will learn very little. Some will call you dumb for messing up your BIOS settings.

The answer came from a very smart guy from Nakuru, Kenya called Weru (it means Savannah as in Savannah Institute for Business and Informatics). Open the machine's casing. Pull out the motherboard. Remove the BIOS button battery.

In the laptop motherboard above, the battery in the round whitish obj…

How to Install RIOT Plugin for GIMP

How to Install RIOT Plugin for GIMP:: Since this article was first written a stand-alone version of RIOT has been made available Download the plugin from the download link titled "RIOT as plug-in for other applications"   Launch the Riot-plugin.exe file by double clicking.The installer installs all the files including Riot.exe, Riot.dll, and FreeImage.dll in the location where you installed GIMP  If GIMP is open, close it and re-launch it.To optimise an image, open it then save with menu File-&gt;Save for web with RIOT  You can set the target file size by selecting "Compress to size" button  on bottom right corner of optimised image pane and providing the size in kilobytes. Alternatively you can use a slider provided to allow you to change the quality while showing you a preview of the resulting image.


How to Stream Live With Your Smartphone

Using Larix Broadcaster , you can stream live video and audio from a smartphone running Android, IOS or Windows. The steps are:
Download and install Larix from the link above.Configure LarixTest with the streaming server provided by whomever is hosting your live streamWhen requested, start sending your stream.
Before giving details explanations of how to configure Larix, its important to note one of two things about the stream:
Many people may be watching worldwide and its important to test and then, during the live stream, ensure only acceptable video and audio are sent to the server. The Larix website illustrates the connection between your phone, server and the viewer devices. Clear video requires planning your shot - from which direction? is the lighting good? will bright lights interfere? Is there traffic noise or other interference.Maintain your smartphone in  landscape orientationIf more than one person are to stream to the same server, be on standby and start your stream promptly…