Some super fast CSS tips

 

 

Website Design

Have you thought about the size of your site’s CSS? If your style sheet is ballooning, it could be delaying page rendering.

Though CSS isn’t the largest asset type you’ll serve, it’s one of the first that the browser discovers. Because the browser is blocked from rendering the page until CSS is downloaded and parsed, it must be as lean as possible.

We’ve taken a close look at some of the most useful CSS tips, ideas, methods, techniques and coding solutions and listed them below.

Here are five CSS tips to help you get there

1.Use shallow selectors

Your parents told you that shallowness isn’t a virtue, but when it comes to CSS, they’re wrong. Used consistently, shallow selectors can trim kilobytes off big style sheets. Take this selector:

nav ul li.nav-item

This could be expressed more succinctly:

.nav-item

As well as helping to keep your CSS svelte, the browser will also render the elements targeted by shallow selectors faster. Browsers read selectors from right to left. The deeper the selectors are, the longer it takes for the browser to render and re-render the elements those selectors are applied to. For complex DOMs that reflow often, short selectors can also cut down on jank.

Ideally, you want selectors to be as shallow as possible, but this doesn’t mean you should cut everything down to the bone. Sometimes you need additional specificity to extend components. Strike the right balance, but be pragmatic, too.

2. Use shorthand properties

Using shorthand CSS tips will speed up your site

This seems like common sense, but you’ll be surprised at how often longhand properties are used needlessly. Here’s an example of some longhand properties in use:

font-size: 1.5rem;

line-height: 1.618;

font-family: “Arial”, “Helvetica”, sans-serif;

That’s a lot of CSS! Let’s tidy that up:

font: 1.5rem/1.618 “Arial”, “Helvetica”, sans-serif;

The font shorthand property condenses several declarations into a handy one-liner that takes up much less space.

In the example shown above, the shorthand uses about 40 per cent less space than its longhand equivalent. It’s not as readable at first glance, but the syntax becomes second nature after you’ve spent some time using it.

Of course, font isn’t the only shorthand available to you. For example, margin can be used in place of longer properties such as margin-top, margin-right and so on.

The padding property of css tips works the same way.

What if you need to override a value further down in the cascade? For example, let’s say you have a heading element that needs to change its font size for larger displays.

In this case, you should use the more specific font-size property instead:

h1{

font: 1.5rem/1.618 “Arial”, “Helvetica”, sans-serif;

}

@media (min-width: 60rem){

h1{

font-size: 2rem;

}

}

This isn’t only convenient, it also increases component flexibility. If any other part of the underlying font property is modified, those changes will percolate up to larger displays. This works great for component overrides where a new context requires a different treatment.

3. Use the preload resource hint

The preload resource hint can give the browser a head start on loading your site’s CSS. The preload resource hint tells the browser to initiate an early fetch for an asset.

You can set it as a <link> tag in HTML:

<link rel=”preload” href=”/css/styles.css” as=”style”>

Or as an HTTP header in your server configuration:

Link: </css/styles.css>; rel=preload; as=style

In both of these scenarios, preload gives the browser a head start on loading /css/styles.css. Using preload in an HTTP header is preferable, since this means the browser will discover the hint earlier in the response headers, instead of later on in the response body.

Another reason to use preload in an HTTP header is that it will initiate a server push event on most HTTP/2 implementations. Server push is a mechanism by which assets are preemptively pushed to the client when requests for content are made, and it offers performance benefits similar to inlining CSS.

Server push isn’t available on HTTP/1. However, using preload in an HTTP/1 environment can still improve performance.

4. Cull redundancies with csscss

csscss will analyse any CSS files you give it and let you know which rulesets have duplicated declarations

It can pay to check your CSS for duplicate rules with a redundancy checker. Take the Ruby-based tool csscss, for example.

Ruby users can install it with:

gem install csscss

Once installed, you can examine your CSS for redundancies like so:

csscss -v styles.css

This command lists which selectors share rules that you can de-duplicate to save space:

{h1} AND {p} share 3 declarations

– color: #000

– line-height: 1.618

– margin: 0 0 1.5rem

You can move duplicate rules under one selector:

h1, p{

color: #000;

line-height: 1.618;

margin: 0 0 1.5rem;

}

You’d be surprised at how much space this process can save in large projects. Use the –help option to see more commands you can use to tweak things further.

5. Go the extra mile with cssnano

cssnano takes your nicely formatted CSS and runs it through many focused optimisations

For the cherry on top, you can use cssnano – a node and PostCSS-dependent tool. cssnano not only minifies CSS, it makes many focused optimisations that can reduce your CSS even further.

Install it on your system with npm like so:

npm i -g cssnano-cli

Then use it to optimise your CSS:

cssnano styles.css optimized-styles.css

If running commands ad hoc isn’t your style, you can automate cssnano with a build system. Here’s how to use cssnano in a gulpfile:

const gulp = require(“gulp”);

const postcss = require(“gulp-postcss”);

const cssnano = require(“cssnano”);

 

const buildCSS = ()=>{

return gulp.src(“css/styles.css”)

.pipe(postcss([cssnano()])

.pipe(gulp.dest(“css/optimized”));

};

const watch = ()=>{

gulp.watch(“css/styles.css”, buildCSS);

};

exports.buildCSS = buildCSS;

exports.watch = watch;

The buildCSS task reads the CSS you write in css/styles.css, then pipes the optimised output to the css/optimized directory. The watch task kicks off buildCSS whenever changes occur in css/styles.css.

The watch task can then be invoked in the terminal like so:

gulp watch

 

With some tweaking, you can also build a workflow that performs this specific optimisation in addition to other CSS-related tasks, such as building Sass/Less files, autoprefixing and more.

These CSS tips will help you to create a design

Some super fast CSS tips

4 Programming languages

Thinking of pursuing a career in web development? These are the programming language that employers are looking for.

It’s no secret that software developers are in high demand around the world. The digital skills crisis has meant that good developers are not only hard to find, but often have the luxury of choosing from more than one job offer.

Here are four programing language that just keep on cropping up…

programming language

 

Not all programming languages are equal

Top 4 programming languages

1.C#

C# is an incredibly popular language among developers and employers alike. It is relatively easy and straightforward. It is primarily uses to develop web, mobile and enterprise applications while supporting imperative, functional and object-orientated paradigms.

C# developers are highly in demand for employers , because of its some couple of reasons. The first is because of the language’s flexibility and usability, which makes it a hit for businesses worldwide.

The second is, Microsoft develops it to build apps on the Microsoft platform. As a result, it fits in with most common Microsoft IT infrastructure, which many companies have embedded at their core.

2. PHP

Another hugely popular option is PHP, an open source, server-side scripting language. Millions of websites across the world are powered by PHP, including high-profile sites such as Facebook and Wikipedia.

PHP is a language that is popular among employers because it’s all over the web and is used extensively in the development of open source projects, such as WordPress.

There has been a marked increase in PHP’s popularity over the years. And now it’s so popular that many companies are competing against one another to get their hands on good PHP talent. The good news for PHP developers is that there are no signs of this demand slowing down.

3. Java

Java is an old favorite among developers (and we use the word ‘old’ because it’s over 20 years old). It’s popular because it’s relatively easy and versatile – an attractive proposition for corporations and developers. It also has many users, many existing applications and such a vast ecosystem.

In 2015, The Daily Telegraph reported that of 105,000 IT jobs available in the UK, 13,000 of them were in Java-specific roles. Java also has a reputation for being a stable language, which is one key reason why the job market is showing sustained hunger for developers in this field.

Furthermore, employers who have been on the block for a long time tend to seek Java developers because they have Java integrated into their systems.

4. JavaScript

JavaScript’s popularity is unrelenting. It’s a versatile object-orientated programming language, it is built with most major browsers, including Firefox and Safari. Despite having been around for a while, JavaScript has managed to hold its own against the onslaught of new programming language that have emerged. Many would regard it as a ‘need to know’ language to help further a career.

A significant number of developer jobs out there have some kind of requirement for JavaScript, which is why they are so popular among employers.

But if you’re a JavaScript developer, you shouldn’t get too comfortable. Its popularity and the fact that many roles have a basic JavaScript requirement means that you’ll need to work hard to stand out from the crowd.

 

4 Programming languages

Necessary tips to manage a freelance design business

Take control of your freelance workflow with these tools and tips.

Whether you’re just starting out or you’re 20 years deep, running a creative freelance business isn’t easy. It takes time, dedication and resources. But luckily, there are a few things you can do to make things a little easier, without breaking your budget.

In this article, we’ll run down our top tips to help you to take charge of different parts of your freelance business, with suggested resources or tools to help with each aspect.

  1. Keep track of your projects

keep track

 

Trello helps you juggle multiple projects at once

As a freelancer, it’s not uncommon to work on more than one project at once. With tools such as Trello and Asana, you can keep track of everything in one place using boards, lists and cards.

Trello is a free online collaboration tool that allows you to add multiple users, all of whom can track changes in real-time. You can add images and files, set due dates and keep things organised and color-coded. There’s even a mobile companion app for when you’re on the go!

  1. Manage your money

manage money

Wave apps are a (mostly) free way to manage your money

Keeping tabs on your money is another key part of running a successful freelancing business. Using tools such as Wave and Xero, you’ll be able to do just that.

And most of the Wave apps are free, including features to help with accounting, invoicing, and personal finance and tracking receipts. And if you need to add payroll and credit card payments, there’s a paid option for that.

  1. Value your time properly

value your time

This tracker shows you what’s eating up too much of your time

As a freelancer, time is just as important as money, so time trackers such as Toggl and Harvest are ideal.

Toggl is an online service that helps you manage and track your time. With a few simple clicks, you’ll be able to split your time between different projects and track exactly which tasks take the most time to complete. You’ll also be able to share professional-looking reports with your clients.

  1. Get the word out

get the word out

Set up a website to help people find you

You can have the best product or service on the planet, but if nobody knows about it, it’ll never sell. One of the best ways to advertise what you do is by having a website. With a website, people can find out what you offer, and more importantly, how to contact you.

WordPress is a great platform for this, and there are plenty of WordPress tutorials to help you get up and running. Alternatively, take look at out roundup of the best free blogging platforms and also consider setting up Facebook Pages for business.

  1. Connect with the community

connect community

A newsletter is a good way to connect with your community

Once you have your website up and running, it’s time to start a newsletter. With a service like MailChimp, you can easily create professional-looking newsletters that you’ll be able to plug in to your new WordPress site.

Newsletters are a great way to let your clients know what you’re working on next, as well as advertising any news or public appearances. Another way to get your news out there, perhaps on a more ad hoc basis, is to start a blog.

  1. Stay in sync

stay in sync

Sync your calendars and share your files with Google’s G Suite

Scheduling and document sharing between multiple clients and collaborators can be a headache for freelancers. But it’s easy when you use the suite of tools provided by Google’s G Suite. Not only can you use Google to keep track of your important calendar events and reminders, but you’ll be able to collaborate and share documents with your clients and other team members.

  1. Find new work

find new work

There are many services to help you find freelance gigs

When it feels like you’re rushed off your feet with current jobs, it can be hard to find the time to tout for new work. But if you don’t, you could end up with uncomfortably long gaps between paying gigs.

Although there’s a small monthly fee to use it, FlexJobs is one of the better sites for finding guaranteed, legitimate freelance work. With a variety of different job categories to explore, you’re likely to find something to match your needs. And because FlexJobs acts as an aggregator, you won’t need to spend hours online searching every corner of the web.

  1. Take time for yourself

take time

 

This app is sure to liven up your exercise break

Freelancers tend to work long hours, but it’s important to take frequent breaks in order to recharge your internal battery. For many, exercise is the first choice. However, just walking about gets boring.

If you’re looking to liven up your break time, have a look at Zombies, Run!, an exercise app that adds mild zombie threat to your exercise routine.

 

Necessary tips to manage a freelance design business