Connect with us
inline small javascript css inline small javascript css


Website Performance Tip – Inline Your CSS and JS

One way to improve your page load speed is to inline CSS and JavaScript and all this means is that you include both in your HTML file.



One way to improve your page load speed is to inline CSS and JavaScript and all this means is that you include both in your HTML file.

You should have the inline small CSS inside the ‘’ tag while the inline JS can be in the ‘’ or ‘’ tag. Most of the time, best practice dictates that you should call JS and CSS using an external file, but you can include snippets of both in the HTML, saving multiple round trips, and speeding things up a little.

Many of the top site speed test tools recommend inlining CSS and JS and it is relatively easy to do. However, you do need to be careful that you don’t overdo it and inline too much.

Example of Inline Small CSS and JS

To give you an idea how to do it, this example shows you what your HTML file may look like when CSS and JS are inlined. We’ve enclosed the CSS inside ‘



<title>Inline Small CSS & JS Example</title>

## Start Inline CSS


body{background: #f5f5f5;}

a{color: #24890d; text-decoration: none;}

h1{font-size: 26px;line-height: 1.3846153846;}


## End Inline CSS





## Start Inline JavaScript


JavaScript code…


## End Inline JavaScript



If you have got several small CSS or JS files, the code from each one may be inlined in the HTML file but do keep an eye on the overall size of the file.


As with everything, there are a couple of drawbacks to inlining CSS and JS, more specifically, a tradeoff between caching and requests.

When you include the resources in the HTML file, you don’t need to make the extra requests to the resource but, where your resource file is quite large and mostly static (it doesn’t change much), it is probably best not to inline it, so the browser can cache it.

The biggest drawback of inlining is that CSS and JS can’t be cached because the browser can’t store what is in the HTML file.

This means that the entire HTML file needs to be fetched every time and, if it is full of CSS and JS, then it could be far more detrimental than retrieving the CSS or JS individually.

For this reason, you must be careful about how much you inline and don’t bloat the HTML file out.


The benefits of inlining CSS and JS include fewer round trips thus reducing loading time so, if you some files that have only a little CSS or JS in them, it is worth adding to them to the HTML to make page loading more efficient.

This is also the recommended method to use if you want to cut down the latency caused by CSS, resulting in the critical path being optimized.

As said earlier, don’t overdo this. If the CSS and JS files are too large it is better to let them be cached rather than having to call a bloated HTML file every time.

Alternatively, if you can’t inline then another way is to combine small CSS into one external file and JS into another and call them that way – this also cuts down on round trips and boost page speed.

Anne-Marie is a staff writer and successful blogger at Learn About The Web. When she's not busy discussing Wordpress performance tips with friends, you’ll find her surfing at the beach in California or discovering new restaurants in Los Angeles.

Click to comment


A Failure of imagination – Apple release new iPhone XR iPhone XS and iPhone XS Max

Apple have taken the easy way out, avoided innovation and are dependent on incremental upgrades



Apple iPhone XS

I have an iPhone and I love it so I absolutely hate to be THAT guy.

I hate to be the guy who’s going against the grain, who seems to be contrarian where others celebrate but unfortunately, this is one of those articles.

Apple released their new iPhones today.

They released three new models – the iPhone XR, iPhone XS and iPhone XS Max.

The new iPhone XS and XS Max are priced at $999 and $1,099 and start shipping out at the end of this month. The iPhone XR starts at $749 and begins shipping out in October.

Apple iPhone XS

Apple iPhone XS (Image Credit – The Verge)

The iPhone XS has a 5.8-inch OLED display with a 2436 x 1125 resolution. Meanwhile, the iPhone XS Max has a 6.5-inch OLED display with a 2688 x 1242 resolution. The iPhone XR, which you can basically think of as this year’s lower-end offering, has a 6.1-inch LCD display with a 1792 x 828 resolution.

At the end of the day, the screen size is the main difference between these three new models.

  • The XS is smaller than the iPhone 8 Plus but the screen is as big as the screen on the 8 Plus.
  • The iPhone XS Max is as big as the iPhone 8 Plus, and its screen is larger.
  • The iPhone XR has a larger display than the iPhone 8 Plus, while its overall size is just slightly smaller.

The iPhone XS and XS Max have dual rear 12-megapixel cameras and improved True Tone flash, and a front 7-megapixel camera. The iPhone XR, as the more budget option, has one 12-megapixel camera on the back, with True Tone flash.

All the new phones are powered by a new seven-nanometer A12 Bionic chip which can handle 512GB of storage. The iPhone XS and XS Max also have faster Face ID, True Tone display, and 3D Touch. They have support for Dolby Vision and HDR10 video.

The iPhone XS and XS Plus come in gold, silver, or space gray. The iPhone XS starts at $999 for the 64GB option, and has 256GB and 512GB options as well. The iPhone XS Max starts at $1,099, with the same storage options. The 512GB option goes for $1,449.

The Apple iPhone XS Promo Video

My opinion

Unfortunately, this is just more of the same.

Apple have made a larger phone, added more storage and made the camera better. The phone OS will be improved as well but that is really all that happened.

As someone who has an iPhone 7 Plus, I will upgrade at some point but the truth is there is STILL no rush.

I have been waiting for a compelling upgrade from Apple that would force me to head to the store and/or pre-order a new phone and the truth is, this isn’t the one.

The Samsung Galaxy Note 9 seems way more exciting from a consumer point of view because of the screen, the pen and the TONS of innovative new features they bring to the table.

When Steve Jobs died, there was a fervent argument among the faithful that innovation at the worlds most valuable company would start to slow.

Unfortunately I fear this is the case.

The most exciting features of the iPhone (IMHO) are FaceID and the upcoming multi-user FaceTime. Beyond those two features, it seems like Apple is just keeping up with the competition.

Let’s be really clear, these are REALLY GOOD PHONES.

But unfortunately, Apple is in a Michael Jackson type situation where they seem to be unable to do anything better than their greatest hit.

Apple continues to live in Steve Job’s shadow and unfortunately, his genius is really the anchor against which the company’s level of innovation will be measured. Using that yardstick, the company fails to measure up.

Preorders for both phones begin on September 14 and ship on September 21st in select countries, with rollout in other countries to follow.

What do you think? Will you buy an iPhone XS?

Continue Reading


Elon Musk interview with Joe Rogan – a deep conversation about AI and more..

Joe Rogan gets a really interesting interview with the Tesla and Space X founder and CEO



Elon Musk Interview

Elon Musk sat down with Joe Rogan in a wide-ranging interview for his Joe Rogan Experience podcast broadcast live Thursday night on YouTube.

The interview included the two men drinking whiskey and smoking weed.

It’s a really amazing and deep interview where he talks about the hyperloop, VTOL aircraft and artificial Intelligence.

Worth watching if you want to learn something new and deep about the future of the web.

You can watch this below…

Continue Reading

Digital Marketing Training

Digital Marketing Tip – 4 tips for finding and approaching a mentor

Unfortunately however, in my opinion, the topic of mentoring is grossly misunderstood.



Finding a mentor

No matter what business you’re in or how successful you are, you should have mentors and you should be actively mentoring people who are trying to learn from you.

I have been fortunate enough to have picked up both mentors and mentees over the years and it was an active process that has helped me immeasurably as a digital marketing professional over the years.

Unfortunately however, in my opinion, the topic of mentoring is misunderstood.

What is a mentor?

The dictionary defines a mentor as “an experienced and trusted adviser.” I believe that while that is technically accurate, it’s a minimalist definition of a very important word.

A lot of professionals have an older person who will meet with them for lunch or dinner once in a while, give them some tips and shoot the sh$t for a little bit. That in my opinion is not a mentor. That’s an older professional who will meet with you once in a while.

The analogy is somewhat like meeting a member of the opposite sex for lunch or dinner once in a while and saying that’s a boyfriend/girlfriend. That’s not how it works.

My definition of a mentor

My definition of a mentor is I believe a little more accurate for what most of us need. A mentor is “an experienced and trusted adviser who is INVESTED in your success.” the operative word here is INVESTED.

A real mentor is someone who has bought into your goals and dreams on your behalf, is an advocate and would be PERSONALLY invested in the outcome of your journey, one way or another. Basically, a mentor is a personal connection to your goals.

Real mentors are hard to find because it requires WORK on their end and the truth is, most people are busy, they usually only have time for things that are really important.

So, here are four tips to help you find and approach a mentor.

Understand your strengths and weaknesses

You need to be really honest with yourself and understand what you’re good at and where you need improvement. If you’re great at marketing but suck at sales, you should be spending time trying to find seasoned sales professionals to learn from.

While it’s awesome to network and meet as many professionals as you can (“you never know”), since time is limited, you need to be efficient with your outreach.

Understand your goals

Where do you want to be long term? Where are you in your journey and what questions do you have about getting to the end zone? If you don’t know or haven’t given this serious thought, how the heck can anyone help you?

Without a clear sense of direction, you will keep meeting well meaning and sincere people who will give you advice that will swing you back and forth and leave you no better off than when you started. Not their fault, it’s yours for not having a goal.

Communicate clearly

Share the points above with someone you want to mentor you so that it’s clear how they can add value. This has a bunch of benefits.

First, it shows them that you are a serious professional who thinks things through. Second, it gives them a clear picture of who you are and what you are looking for so they can start thinking of a roadmap they can share with you early.

Third, it gives them the opportunity to sincerely say no if they’re not a good fit. Maybe they can refer you to someone who can be a better guide for you.

Be respectful

If that person agrees to meet with you, they are doing YOU the favor. Be grateful. Send emails thanking them. Pay attention to what they say whether or not you agree.

Don’t argue with that person but try and raise your points or objections respectfully. Once again YOU need them, not the other way around.

That doesn’t mean you have to do what they say, after all you are ultimately going to do whatever YOU decide. It does mean that you should make sure they feel like they were heard and their input was valuable.

Make it easy

In marketing, one of the ways to get someone to review your products (and hopefully endorse them) is to make it easy. Provide a writeup of the product, images and everything they need to share it. This is a more effective way of getting your product or service reviewed.

Likewise, for a mentor, do your homework and make things easy. Offer to drive out to meet near where they are. Offer to buy lunches or dinners. Provide a clear synopsis of what you want to discuss.

Give them credit whenever you can. Show that you are someone worth endorsing and mentoring and try and make it a no-brainer for them to want to partner with you for your success.

The bottom line

Finding a mentor is actually like finding a job. You have to do the research and be focused to find and keep that person’s attention. If you treat the process as seriously as it deserves to be treated, you will see results.

Let me know what your experience has been with this in the comments below.

Continue Reading



Digital Marketing Job Board