• Home
  • About
  • Fav Books
  • Tools
  • Journal
  • Hire Me
  • Contact
Small Biz Geek

Small Biz Geek

Small Business Design, Marketing & Technology Journal

Website design services

A Journal on Small Business Design, Marketing and Technology

  • The Internet
  • Marketing
  • Graphic Design
  • Web Dev
  • Web Design
  • Social Media
  • Technology
  • Miscellaneous

Delete Blank Lines in CSS Stylesheet & Increase Website Speed

By Small Biz Geek on May 5, 2015 · Filed Under: Video, Web Development Updated: June 12, 2017

In this post I’ll reveal a quick method to remove blank lines in your CSS stylesheet using Dreamweaver. This will help speed up the time it takes to load your site.

Dreamweaver Find & Replace Screenshot

The same fix can be used if you’ve experienced the unfortunate problem of having lots of unwelcome spaces mysteriously inserted in your source code.

Less lines in the source code results in an improved load time. You can use the free Notepad++ instead of Dreamweaver and you can learn more about that here.

 

The Problem: CSS Stylesheet Blank Lines

I’m a big fan of WordPress but even their stylesheets have some blank lines.

By default, a typical WP theme has a single line space after every closing brace.

I’ve highlighted these spaces in the screenshot below:

WordPress CSS Stylesheet Line Breaks

This isn’t anything to worry about. There are a gazillion websites with stylesheets just like it and it’s not a problem.

But it would be better to remove the spaces and achieve a slightly faster load.

It Gets Messy

While single blank lines between CSS rules isn’t problematic, lots and lots of spaces are.

Multiple blank lines tend to appear when numerous customisations are made to the CSS.

In the past I’ve made the mistake of not closing the gaps, potentially adding unwanted load time.

Here’s a screenshot:

CSS Rules Stylesheet Blank Lines

Look familiar?

This is a situation you might encounter if you’re asked to update a website another designer/developer has previously worked on.

I believe in leaving things in a better state than you found it which is another reason to run the fix shown at the end of the post.

It Gets Worse

Ok, one more anecdote before I tell you how to delete these pesky lines.

The other day I downloaded my stylesheet from my server with the intention of making a few changes.

I copied style.css to my desktop using FileZilla.

However, when I opened the stylesheet in Dreamweaver I was confronted by this horror:

Stylesheet Gaps on Every Other Godamn Line

Yep. An extra blank line had been inserted between every line. The stylesheet was now twice as long!

2582 lines of code had become 5164 lines of code!

 

The Fix: Remove Blank Lines from Stylesheet in Dreamweaver

I have two solutions.

Fix 1

In Dreamweaver go to Commands > Apply Source Formatting.

The blank lines should immediately close up. If this doesn’t work, try the following alternative method.

Fix 2

Here’s what you need to do:

  1. Open your stylesheet in any version of Dreamweaver.
  2. Press CTRL & F (Or select Find and Replace from the Edit menu).
  3. Enter [\r\n]{2} in the Find field.
  4. Enter \n in the Replace field.
  5. Check the box “Use regular expression”.
  6. Click Replace All.

Dreamweaver will then spend 1 – 2 minutes automatically removing the blank lines.

You’ll end up with a stylesheet which is shorter and faster loading.

Save it and copy back to your website directory.

Watch this video for a run through:

Watch video on YouTube

 

If the first solution does not work, try this instead:

  1. Enter \r\n\r\n in the Find field
  2. Enter \n in the Replace field.
  3. Click Replace All.

Analysis

For the amount of time it takes, you’d might as well employ the tactic of removing blank lines.

It’s especially important if you’ve been making lots of edits and have forgotten to close up those spaces. It makes it easier if you’re working with other web designers.

Related Posts

  • Claw Back Time and Improve Business Communications with Private Videos
  • WordPress Duplicator Plugin ZipArchive Failure… My Solution
  • 2 Advantages of Using PNG instead of JPEG on Your Website

Filed Under: Video, Web Development Tagged With: CSS, Dreamweaver, Site speed, Stylesheet, Websites

About Small Biz Geek

I'm Darren, helping small businesses with design, marketing & tech.
Read more about me and follow me on Twitter.

Small Business Website Design

Do you need help with something web related?

To hire me see the page about my services.

Get Updated by Email

If you liked this article, consider subscribing to the RSS feed by email.
Your email address won't be shared. Read the privacy policy.
* indicates required field.
Are you human? (Spam check)

Comments

  1. omid says

    August 6, 2016 at 6:59 am

    tanx

    Reply

Add Your Thoughts Cancel reply

Your email address is safe and will NOT be shared with anyone else.

Hateful, spammy or abusive comments will not be tolerated.

For more information please see the comment policy.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About the Webmaster

Hello, my name is Darren, a 35-year-old business enthusiast eager to learn and do good work.

I’m a website builder for hire working with small to medium businesses.

I network in Derby, Ilkeston and Nottingham in the East Midlands, England.

Search Website

Let’s Connect

  • LinkedIn
  • Twitter
  • YouTube

Recently Read Book

Don't Make Me think - Steve Krug

“Don’t Make Me Think: Revisited” – Steve Krug (Book Review)

A person of average technical ability must be able to navigate your website easily. This is required reading for anyone wanting to create a better experience for their visitors…

Latest Journal Entries

  • Competitors Can Easily Edit Your Google & Facebook Business Listings
  • Waiting on Final Images for a WordPress Website? Use Temporary Placeholders & Design Around Them
  • GoDaddy Loves Spamming Branded Footer Links to WordPress Installatron Sites
  • Dealing with Negative Comments on Your Paid Social Media Posts
  • Childhood Business Ventures: What Was Yours?
  • Local Business Websites: “About” Pages Done Right Will Attract and Delight Readers
  • Magazine Advertising Scam: Rogues Impersonate Crime Prevention Officers
  • Privacy and Data Protection is a Matter of Life and Death for Some
  • Magazine Advertising Scam: Bogus Children’s Cancer Charity Misleading Small Businesses
  • UK Businesses Electronically Processing Data Are Legally Required to Register with the ICO
  • Stolen Credit Card Email Scam Targets Small Businesses and Service Providers
  • Nuisance Calls, Emails and Empty Promises: The Bungling Incompetence of Yell.com

Primary Navigation

Home
About Darren
Good Books
My Tools
Blog Posts
Hire Me
Contact Me

Secondary Navigation

The Internet
Marketing
Graphic Design
Website Development
Website Design
Social Media
Technology
Miscellaneous

Derby & Nottingham Area

Small Biz Geek
Office 897
109 Vernon House
Friar Lane
Nottingham
NG1 6DQ

Telephone

Tel: +44 (0) 115 714 3290
Tel: +44 (0) 7951 897 243

VoIP

Skype: ilkestonwebdesign
WhatsApp: 07519 897 243

Email

[email protected]

Let’s Connect

Twitter
YouTube
LinkedIn
RSS

Subscribe to Blog by Email

Subscribe to Blog By Email

Social Calendar

WordPress Nottingham Meetup
WordPress Derby Meetup
Genesis Framework by StudioPress


Copyright © 2019 · Small Biz Geek · Privacy Policy · Commenting Policy · Website Disclaimer · ICO number: ZA305900


Written and designed by Ilkeston Web Design

This site uses cookies More info