27 Best Flyer Design Ideas Using a Flyer Maker (With Photo)

Let’s face it, sometimes even the most creative of souls among us hits a dry spell, but when this happens to you, you can feel like the only person on earth it has ever happened to. Well, here’s a little secret. The best solution to heading off these dry spells is to prepare for them by building a toolbox of design ideas and templates you can turn to, to get your creative juices flowing again. 

To get you started, here are the 27 best flyer design ideas for you to add to your toolbox. All of the flyers I’m featuring here have been created using an awesome flyer maker with photo (my term for flyers that build their effectiveness around great photos), found at Placeit. Now, Placeit is one of the largest collections of flyer templates on the internet, and it’s a great resource for helping you create the best flyers in the shortest time possible. 

So if you’ve been wondering how to make a flyer online, you should check it out. For a single affordable monthly fee, it also helps you make a bunch of other really cool and useful stuff, which you can download and reuse as often as you like, so it’s a good idea to add it to your toolbox as well. 

27 Best Flyer Design Ideas Using a Flyer Maker With Photo

1. Non-Profit Flyer

If you’re looking for flyer design ideas for a charity or non-profit, this Non-Profit Flyer template is a great place to start. First, it gives you the ability to upload a powerful, iconic photo to get the attention of your audience. Next, it offers a great selection of bold fonts designed for a simple, powerful, eye-catching message overlay. 

It also provides a selection of reading fonts for a longer explanatory message and a good selection of icons you can use or swap out for an organisation’s own logo. 

Non-Profit Flyer

2. Interior Design Flyers

Here’s some flyer design inspiration for creating a gorgeous interior design flyer. The Interior Design Flyers template uses an interesting geometric pattern created from squares to arrest the eye. The flyer template is super easy to customise—just enter your information in the flyer creator, choose a photo to feature on your flyer, select an icon from the graphic options available or upload your own, select your colour scheme, and you’re ready to download and print. 

Interior Design Flyers

3. Design Tutoring Flyers

Plenty of people use their expertise in a given subject to tutor others, and they want their marketing flyers to look professional and attractive. The Design Tutoring Flyers template is the easiest and quickest way to accomplish that without using Adobe or other design programs. The template uses a structure of photo, colour bar and contrasting text to help you deliver your message in a simple but interesting way. 

Design Tutoring Flyers

4. Concert Flyers

Whether you’re creating a flyer for a rock, jazz, pop, classical, reggae or other concert, the Concert Flyers template’s design will make your flyer look fabulous. Just make sure you have a great mood-setting photo to add to the background, or use one of the excellent ones that come with the template. Then all you need to do is fill in the details of the concert, and you’ve got a flyer you can be proud of.

Concert Flyers

5. Landscaping Flyers

If you’re trying to come up with great flyer design ideas for landscaping businesses, Landscaping Flyers has got you covered. The template uses photos of landscapes and flora and fauna, under a simple banner that highlights key pieces of information about the business. Definitely a winner. 

Landscaping Flyers

6. Wedding Planner Flyer Template

Check out the amazing design of the Wedding Planner Flyer Template to create the best flyers for weddings, engagement parties, and other important events. The flyer uses a wonderful combination of photos, gorgeous fonts, beautifully executed icons and subtle colours to create a polished and attractive final product.

Wedding Planner Flyer Template

7. Basic Flyer Template to Design Modern Flyers

In this article, I cover the best flyer design ideas for specific types of flyers, but what I like best about Basic Flyer Template to Design Modern Flyers is that you can use it to create just about any flyer you choose, from creative to business flyers and everything in-between. It features a stylish and clean design and gorgeous background images for any occasion. As is the case with the other flyer templates here, it is very easy to customise.

Basic Flyer Template to Design Modern Flyers

8. Custom Party Flyer

For party flyer design inspiration, look no further than Custom Party Flyer. Use the background photos to indicate what kind of party it is, e.g. a photo of cocktails would suggest a cocktail party, and gummy bears and jellybeans a kid’s party. With the photo selected, all you need to do is modify the colour of the text banner to suit the theme, choose your font, and you’ve got the perfect party flyer. 

Custom Party Flyer

9. Sports Flyer Maker

What makes the Sports Flyer Maker template so great is that everything about it communicates action. The photos of athletes in motion, the bold text and bright colour accents, and the awesome graphic flourishes that you can choose to overlay each template, all work together to make this a great flyer template.

Sports Flyer Maker

10. Food Flyer Maker

If you’re creating a flyer for food promotion, you want people to salivate when they see it. Happily, that’s exactly what people are going to do when they see the flyers you make with the Food Flyer Maker. Not only does this template come with mouthwatering photos of food, but it has great graphics and strong, colourful fonts that call attention to the fact that there’s a special discount or a new menu on offer. Definitely one for the toolbox. 

Food Flyer Maker

11. Event Flyer Maker for Conventions

If you need to create a flyer for an event or convention, Event Flyer Maker for Conventions can help. The template and the presets below it give you plenty of examples of what makes a great Events Flyer. Customise it to add your own twist.

Event Flyer Maker for Conventions

12. Contemporary Dance Flyer Maker

Stunning images of dancers in motion, choice placement of text and a large selection of colourful gradient overlays are the stand-out features of Contemporary Dance Flyer Maker. If you’re looking for flyer design ideas to announce a dance competition or performance in a visually compelling way, look no further. 

 Contemporary Dance Flyer Maker

13. House Cleaning Service Flyer Maker

There are many ways to communicate effectiveness in your house-cleaning flyers, and the House Cleaning Service Flyer Maker gives you a few great ideas. The clean, modern design is easy to customise to suit your message, and if you ever get stuck, just help yourself to one of the beautiful presets that come along with the template.

House Cleaning Service Flyer Maker

14. Flyer Maker App for Vacation Packages

The best flyers for travel agents, hotels, tour operators and others working in the travel industry promise fun, relaxation, adventure and/or discovery. Flyer Maker App for Vacation Packages says all these things. Take a look. I dare you not to be captivated.

Flyer Maker App for Vacation Packages

15. Summer Camp Flyers

Flyers for summer camp are another genre of flyers that need to communicate exuberance if they’re going to attract kids and entice parents. Summer Camp Flyers keeps the emphasis on fun with great images and playful text in vibrant banners.

Summer Camp Flyers

16. Promotion Flyers

If you’re looking for flyer design ideas for a sales event, Online Flyer Maker for Promotion Flyers has you covered. This template uses the three components of a great sales promotion well: great images of exuberant or stylish customers, bold text to announce the offerings, and vibrant colours and patterns. 

Promotion Flyers

17. Halloween Party Flyer Maker

Halloween comes every year, so be ready to create scary Halloween Party announcement flyers with the Halloween Party Flyer Maker. The template provides all those wonderfully macabre photos that you need, as well as fonts that hint at dark pleasures to be had. 

Halloween Party Flyer Maker

18. Jewelry Store Flyer Design Template

Looking for an innovative approach to designing a flyer for selling merchandise like jewellery and watches? The Jewelry Store Flyer Design Template combines great photos with a cool grid pattern to create a standout flyer.

Jewelry Store Flyer Design Template

19. Casting Flyer for Dance Auditions

Casting Flyer for Dance Auditions helps you create the perfect audition flyer for dance, theatre, modelling and other performance-related roles. With this Flyer Creator template, you have the usual choice of font styles and wonderful background photos, but also a terrific selection of colourful banners, all of which can be customised.

Casting Flyer for Dance Auditions

20. Online Flyer Maker for Drink Promos

Create an amazing flyer to promote bars and cocktail lounges in a matter of minutes with Online Flyer Maker for Drink Promos. Use the background colour feature to highlight the colourful images of exotic-looking cocktails and pints of cold beer. 

Online Flyer Maker for Drink Promos

21. Gym Flyer Maker for Fitness Classes

Gym Flyer Maker for Fitness Classes is a great template for designing the best flyers for a fitness business. This template and its presets offer gorgeous images of bodies exercising, vibrant colours, and bold, eye-catching fonts. Perfect for gyms, fitness centres, yoga studios, or any other fitness business. 

Gym Flyer Maker for Fitness Classes

22. Design Architecture Flyers

Design Architecture Flyers is a gorgeous flyer maker template that is perfect for businesses related to the designing or constructing of buildings. The template is versatile, eye-catching, and of course very easy to customise. 

Design Architecture Flyers

23. Auto Repair Flyer Maker for Auto Shops

Creating flyers for car dealerships, auto repair shops and related businesses has never been easier. Take a look at the Auto Repair Flyer Maker for Auto Shops template and you’ll see what I mean. All you need to do is select a background image or upload one, type in the relevant information, and your professional automotive flyer is ready to be printed.

Auto Repair Flyer Maker for Auto Shops

24. Design Real Estate Flyers

One of the best flyer templates for real estate businesses, Design Real Estate Flyers stands head and shoulders above the competition. Aside from the stellar layout, great images, and large font selection, the template includes a number of beautifully designed icons which add a nice touch to the design.

Design Real Estate Flyers

25. Online Flyer Maker for a Recruitment Agency

A wonderful flyer template that uses shapes in an interesting and engaging way, Online Flyer Maker for a Recruitment Agency can be used to create flyers for recruitment agencies but is equally suited for other types of flyers as well. 

Online Flyer Maker for a Recruitment Agency

26. Barber Shop Flyers

Desperate for flyer design ideas to create the best flyer for a barber shop? Look no further than the Barber Shop Flyers template. This well-thought-out template will have you producing your own fabulous flyers for local barber shops in no time. 

 Barber Shop Flyers

27. Organic Market Flyers

A simply wonderful template for some flyer design inspiration, Organic Market Flyers is packed full of organic and eco-friendly graphics including fruits, vegetables, plants, and flowers. It’s just perfect for advertising produce, farmer’s markets, and anything else dealing with fresh and wholesome food. 

Organic Market Flyers

Time to Put These Flyer Design Ideas to Work

So there you have my 27 best flyer design ideas using a flyer maker with photo. If you’re looking for more flyer design inspiration, there are tons more amazing flyer templates available at Placeit. I’d love to know your favourites, so leave a comment below and tell me which flyer templates are going into your toolbox. Can’t wait to see what you choose.

{excerpt}
Read More

Boost Your Vue.js Workflow With Vue CLI 3

We can hardly imagine modern web development without the help of Command Line Interface (CLI) tools. They tremendously facilitate and speed up the development workflow by reducing the amount of repetitive and tedious tasks. Setting up a project manually, with all the linting, building, testing, preprocessing, optimizing, and dependencies tracking features doesn’t sound like a fun job, does it?

That’s why all modern client-side development frameworks (such as Angular, React, etc.) offer their own version of CLI tools, and Vue.js is no exception. But with its latest third version, Vue CLI is going one step ahead of the others. It’s now not only highly powerful and flexible, but also comes with a full-blown GUI. Yeah, you heard right. Vue CLI 3 offers a full graphical user interface out-of-the-box.

Starting new Vue.js projects is now easier than ever with the new Vue CLI and it’s Vue UI GUI. This tutorial will show you how to put Vue CLI to use and how Vue UI can speed your workflow up even further. Let’s get started!

What Is Vue CLI?

Vue CLI is a set of tools for rapid prototyping, easy application scaffolding, and efficient project management. It’s composed of three main tool belts:

  • CLI is a globally installed npm package, which provides core functionality via the vue command. It allows us to scaffold a new project easily (vue create), or just quickly prototype raw ideas (vue serve). If we want more concrete and visual control over our projects, we can open the GUI version of the CLI by running vue ui command.
  • CLI Service is a development dependency (a vue-cli-service binary file), installed locally into every project created with the CLI. It allows us to develop our project (vue-cli-service serve), pack it for production (vue-cli-service build), and also to inspect the internal webpack project’s configuration (vue-cli-service inspect).
  • CLI Plugins are npm packages that provide additional features to our projects. Their names start with either @vue/cli-plugin- (for built-in plugins) or vue-cli-plugin- (for community plugins). We can add them at any time of the development process via vue add command.

In the next sections, we’ll explore all nuts and bolts of the above tools and utilities, but first, let’s see the actual features that make Vue CLI so powerful and flexible.

Vue CLI is a Full-Featured System for Boosting Our Vue.js Development Workflow

Vue CLI accelerates and eases Vue.js project development thanks to its great collection of features. Let’s see what those features are:

  • Plugin-based architecture. Vue CLI is totally built around plugins, which makes it very flexible and extensible. We can choose which ones of the built-in plugins to add during the project creation’s process. But we are not limited only to these, we can add any number of plugins at any time after creation of the project.
  • Vue CLI is completely configurable, extensible, and upgradable.
  • A set of official pre-installed plugins, which integrates first-class tools from the front-end ecosystem (Babel, ESLint, TypeScript, PWA, Jest, Mocha, Cypress, and Nightwatch).
  • A single default preset, which we can modify to our needs during the project creation or afterwards.
  • No need to eject. In contrast to React and Angular CLI tools, we can safely inspect and tweak our project’s webpack configuration at any time after creation without the need of ejecting the app and switching to manual configuration.
  • Multi-page support.
  • Instant prototyping without any configuration.
  • Different build targets allow us to produce different versions of our project—we can use one and the same code base and build it as an app, a library, or web components.
  • Modern mode feature. This will build our app for modern browsers, but with automatic fallback for older ones. Cool, huh?
  • A full-blown GUI for creating, updating, and managing complex projects with ease.
  • UI Plugin API. Vue UI exposes a plugin API which we can use to add custom functionality to the GUI version of the CLI.
  • Lots of useful plugins from community.

Getting Started With Vue CLI

After we learn about the Vue CLI magic, it’s time to see it in practice. First, we need to install Vue CLI 3. It requires Node.js 8.9+ (8.11.0+ recommended), so we need to make sure we have it on our machines. Then we just open our terminal or command prompt, and run:

npm install -g @vue/cli

After the installation finished, we can start using the vue command. To check if everything works correctly, we run vue --version. This should display the installed Vue CLI version. Now, let’s explore what we can actually do with Vue CLI.

Instant Prototyping

Even though Vue CLI is designed primarily for working with complex projects, it allows us to try out our raw ideas quickly and effortlessly. Its instant prototyping feature can be activated by installing the global Vue CLI Service addon:

npm install -g @vue/cli-service-global

From now on, we can use vue serve command whenever we want. Let’s try it. We create an App.vue file with the following content:

<template>
  <h1>Hello, Vue!</h1>
</template>

Then, in the same directory, we run:

vue serve

This will start the Vue CLI development server and will run the app on http://localhost:8080/. When we open the browser at this address, we should see a nice Hello, Vue! heading.

Creating a New Project

The previous section was only a warm up. Let’s now make something more complex.

vue create command uses an interactive process for selecting the options for a new project. Let’s run it and go throughout its options.

vue create vuecli-project

Create a New Project With Vue CLI

In the first window, we are invited to pick a preset. There is only one preset available out of the box, called default. We’ll choose the second option, which is to manually select the features we need for the project, and press Enter to continue.

Create a project with Vue CLI Manually select features

In the next window, we use the arrow keys to navigate up and down the list of features and the spacebar to select what we want. Here, along with the already selected Babel and Linter/Formatter, I checked also Router and Vuex. Once you have selected the needed features, press Enter to move on.

Create a project with Vue CLI Use history mode

In the next window, we are asked whether to use history mode for the router. I just pressed Enter to accept the default of Yes.

Create a project with Vue CLI Pick a linter

In the next window, we need to choose how we want to be configured the Linter. I selected ESLint + Prettier.

Create a project with Vue CLI Additional lint features

In the next window, we choose when the Linter is used to inspect the project. I chosen Lint on save, which applies each time a file is saved.

Create a project with Vue CLI Dedicated config file or config in packagejson

In the next window, we need to decide how we want to configure our project. Choose whether you want to use separate configuration files for each of the features, or to include all configuration setting in the package.json file. I prefer a single file, and have selected the In package.json option.

Create a project with Vue CLI Save these settings as a preset

In the last window, we have the ability to save the whole project creation configuration as an easy to use preset for future projects. I saved mine as spa-simple. Presets are saved in the user folder inside .vuerc file.

When we complete the creation process the project will be created and configured, and the packages that are required will be downloaded and installed.

Create a project with Vue CLI Generating project files

Exploring the Project Structure

In this section, we’ll explore what Vue CLI has created for us.

Create a project with Vue CLI The project structure

In the project folder shown above, we have the following files and folders:

  • The node_modules folder contains the packages that the app and development tools require.
  • The public folder contains static project assets, which will not be included in the bundling process.
  • The src folder contains the Vue.js application with all resources.
  • .gitignore contains a list of files and folders that are excluded from the Git version control.
  • babel.config.js contains the configuration settings for the Babel compiler.
  • package.json contains a list of the packages required for Vue.js development as well as the commands used for the development tools.
  • package-lock.json contains a complete list of the packages, required by the project, and their dependencies.
  • README.md contains a general information about the project.

The Newly-Created src Folder

Let’s now take a closer look into the src folder:

Create a project with Vue CLI the src folder

In the src folder shown above, we have the following files and folders:

  • The assets folder is used for static resources required by the app and which will be included in the bundling process.
  • The components folder is used for the application’s components.
  • The views folder is used for components which will be displayed using the URL routing feature.
  • App.vue is the root component.
  • main.js is the JavaScript file that create the Vue instance object.
  • router.js is used to configure the Vue router.
  • store.js is used to configure the data store created with Vuex.

Changing the Project Configuration

The default project configuration contains sensible settings, but if we need, we can change them by adding a file vue.config.js in the project folder, or by adding a vue section to the package.json file. Let’s try the first one: We create a vue.config.js file and put the following option in it:

module.exports = {
  runtimeCompiler: true
}

This will allow components to define their templates as strings, rather than using template elements. To explore the complete set of configuration options you can use visit Vue CLI Config page.

Developing the Project

As we saw above, Vue CLI Service comes with three default scripts: serve, build, and inspect. The first one is used for the development process. We run our project with npm run serve command:

Starting the development server

When we open our app in the browser, we should see the following page:

Running the new app

This is the Home.vue page, which uses the HelloWorld.vue component.

The serve command starts a development server, based on webpack-dev-server, with a working Hot Module Replacement (HMR) feature. This means that when we make changes in our components and save them, they will be immediately reflected and the page will be updated in the browser.

Adding New Functionality to the Project With Vue CLI Plugins

At some point of our app development, we may need to add some additional functionality to the project, and for that we’ll need to install Vue CLI plugins. A Vue CLI plugin can modify the webpack configuration and injects new commands to vue-cli-service. To install a plugin, we use the vue add command.

Let’s suppose that we want to use Bootstrap components for our project. Fortunately, there is a bootstrap-vue plugin, which can provide them for us. To install it, we run:

vue add bootstrap-vue

After plugin’s installation, in the src folder, we’ll find a new plugins folder where the new plugin is placed.

Now, to test the plugin’s functionality, let’s modify the About.vue file:

<template>
  <div class="about">
    <b-jumbotron text-variant="success" header="Vue CLI 3" lead="Standard Tooling for Vue.js Development">
        <p>For more information visit website</p>
      <b-btn variant="primary" href="https://cli.vuejs.org/">More Info</b-btn>
    </b-jumbotron>
  </div>
</template>

And when we point to About page in the browser, we should see the page updated and styled with the Bootstrap:

App updated with Bootstrap

Building the Project for Production

When the app is ready to deploy you need to create a set of bundles containing only the app code and content, along with the modules they depend on, so that these files can be deployed to a production HTTP server.

Building the App

To build our app, we run:

npm run build --modern

The --modern argument creates two versions of the application. One of them is targeted for modern browsers that support the latest JavaScript features, and the other is a fallback for older browsers that need additional libraries to handle those features. The cool thing is that after we deploy the app, the selection of which one version to be used is completely automagical!

Note: When we run build command, Vue CLI allows us to specify an --target option, which allows us to use our code base for different use cases. The default build target is set for building an app. We have two more options to choose from: to build our code as a library or as web components. Check the Build Targets page for more details.

Exploring the dist Folder

When the build process is completed, a dist folder is created in the project root. Let’s explore its contents:

The dist folder

The index.html file will be the entry point for the application. It contains link and script elements that will load all needed CSS and JavaScript files from the css and js folders.

So now, we are ready to deploy our app to a production server. There are plenty of options to choose from. You can learn about many of them by visiting the Deployment page.

Let’s GUI-fy Our Project With Vue UI

Vue CLI 3 is a very powerful, but this comes with a price. There are too many choices, commands, and options to configure and remember. This make it more complex and hard to work with. To bring things back to an easy-and-happy state Guillaume Chau created Vue UI, which significantly simplify the development experience and make it more approachable. At first it may sounds a bit strange to combine a CLI tool with a graphical interface, but as you’ll see later on, this exceptional symbiosis is quite powerful and efficient.

Recreating Our Project With Vue UI

In this section, we’ll go throughout the creation of the same project we created before, but this time we’ll use Vue UI.

Vue UI is made with its own UI framework and no Electron is needed to run it in the browser. Just run the vue ui command, no matter in which directory:

vue ui
The Vue UI homescreen

Vue Project Manager is launched with the Projects tab selected. There are no existing projects yet. To have some projects listed here, we need either to create them via the UI, or to import projects created with the CLI. Let’s see how we can create a new project.

The Vui UI create project tab

We switch to Create tab, navigate to desired directory for our app, and click Create a new project here button.

Create a new project with Vue UI pick a folder

In the next screen, we give a name to the project folder and choose the package manager we prefer.

Create a new project with Vue UI Select a preset

In the next screen, we are allowed to choose a preset for the project. It can be the default, manual, a remote, or a custom preset we’ve created before. spa-simple is an example of a custom preset. Here, we choose Manual.

Create a new project with Vue UI Select project features

In the next screen, we select the plugins we want to install.

Create a new project with Vue UI Select plugins

Finally, we set the configuration settings for the plugins we have chosen to install. When we are ready, we hit the Create Project button.

Create a new project with Vue UI Welcome to your new project

Now the project will be created and we will be redirected to the project’s dashboard.

Vue UI Project Dashboard

Using the Vue UI Project Dashboard

In the Plugins section all the installed plugins are listed. To install a new plugin, we hit the Add plugin button.

Project Dashboard Plugins section

Here, we can search for the plugin we need and when we find it, we hit Install button. In our case, we search and install the bootstrap-vue plugin.

Project Dashboard add a plugin

When the plugin is installed, in the Configuration tab, we can set the provided options.

Project Dashboard Configuration tab

In Files changed tab, we can inspect which files are affected and how. Here, I don’t want to commit any changes, so I hit the Skip button.

Project Dashboard Dependencies tab

In the Dependencies section we have listed all main and development dependencies. To add dependency, we click the Install dependency button.

Project Dashboard Install new dependency

In the modal window, we can search for main or development dependencies and install them.

Project Dashboard Plugin settings

In the Configuration section, we can customize the settings provided for the plugins we’ve added. Here, we have settings for Vue CLI itself and for ESLint plugin.

Project Dashboard Project tasks tab

Tasks section give us convenient way to use all available commands provided from Vue CLI and from other plugins. In this screen, the serve task is selected. We can change its parameters by hitting the Parameters button.

Project Dashboard serve tasks parameters

In the modal window, we select the parameters we want to run the task with.

Project Dashboard Running the serve task

When we run the serve task, the dashboard will update with some useful information.

Project Dashboard serve task output

When we switch to the Output tab, we get the logs for the task process.

Project Dashboard serve task analyzer

When we switch to the Analyzer tab, we get a nice graph which summarize information for the whole project.

The build task is almost similar to the serve task with the exception that the former produces a production bundle that can be used to deploy the application.

Project Dashboard build task parameters

We can set parameters for the build task in the same way as with the serve task.

Project Dashboard build task output

The Output field of the inspect task give us information about the resolved webpack configuration.

And that’s it. We successfully recreated our project with the Vue UI. But as we saw the creation and configuration processes are easier and much more pleasant when we use a GUI.

Conclusion

In this tutorial we learned that Vue CLI is a complete system for modern web development. It allows us to operate with the whole Vue ecosystem and 3rd party tools quickly and easily. Of course, we are not required to use Vue CLI for our Vue.js projects. This is completely our choice. But when we aim for speed and quality, Vue CLI is here to help in creating, managing, and deploying our projects in a professional manner.

Source:: Net Tuts

Boost Your Vue.js Workflow With Vue CLI 3

We can hardly imagine modern web development without the help of Command Line Interface (CLI) tools. They tremendously facilitate and speed up the development workflow by reducing the amount of repetitive and tedious tasks. Setting up a project manually, with all the linting, building, testing, preprocessing, optimizing, and dependencies tracking features doesn’t sound like a fun job, does it?

That’s why all modern client-side development frameworks (such as Angular, React, etc.) offer their own version of CLI tools, and Vue.js is no exception. But with its latest third version, Vue CLI is going one step ahead of the others. It’s now not only highly powerful and flexible, but also comes with a full-blown GUI. Yeah, you heard right. Vue CLI 3 offers a full graphical user interface out-of-the-box.

Starting new Vue.js projects is now easier than ever with the new Vue CLI and it’s Vue UI GUI. This tutorial will show you how to put Vue CLI to use and how Vue UI can speed your workflow up even further. Let’s get started!

What Is Vue CLI?

Vue CLI is a set of tools for rapid prototyping, easy application scaffolding, and efficient project management. It’s composed of three main tool belts:

  • CLI is a globally installed npm package, which provides core functionality via the vue command. It allows us to scaffold a new project easily (vue create), or just quickly prototype raw ideas (vue serve). If we want more concrete and visual control over our projects, we can open the GUI version of the CLI by running vue ui command.
  • CLI Service is a development dependency (a vue-cli-service binary file), installed locally into every project created with the CLI. It allows us to develop our project (vue-cli-service serve), pack it for production (vue-cli-service build), and also to inspect the internal webpack project’s configuration (vue-cli-service inspect).
  • CLI Plugins are npm packages that provide additional features to our projects. Their names start with either @vue/cli-plugin- (for built-in plugins) or vue-cli-plugin- (for community plugins). We can add them at any time of the development process via vue add command.

In the next sections, we’ll explore all nuts and bolts of the above tools and utilities, but first, let’s see the actual features that make Vue CLI so powerful and flexible.

Vue CLI is a Full-Featured System for Boosting Our Vue.js Development Workflow

Vue CLI accelerates and eases Vue.js project development thanks to its great collection of features. Let’s see what those features are:

  • Plugin-based architecture. Vue CLI is totally built around plugins, which makes it very flexible and extensible. We can choose which ones of the built-in plugins to add during the project creation’s process. But we are not limited only to these, we can add any number of plugins at any time after creation of the project.
  • Vue CLI is completely configurable, extensible, and upgradable.
  • A set of official pre-installed plugins, which integrates first-class tools from the front-end ecosystem (Babel, ESLint, TypeScript, PWA, Jest, Mocha, Cypress, and Nightwatch).
  • A single default preset, which we can modify to our needs during the project creation or afterwards.
  • No need to eject. In contrast to React and Angular CLI tools, we can safely inspect and tweak our project’s webpack configuration at any time after creation without the need of ejecting the app and switching to manual configuration.
  • Multi-page support.
  • Instant prototyping without any configuration.
  • Different build targets allow us to produce different versions of our project—we can use one and the same code base and build it as an app, a library, or web components.
  • Modern mode feature. This will build our app for modern browsers, but with automatic fallback for older ones. Cool, huh?
  • A full-blown GUI for creating, updating, and managing complex projects with ease.
  • UI Plugin API. Vue UI exposes a plugin API which we can use to add custom functionality to the GUI version of the CLI.
  • Lots of useful plugins from community.

Getting Started With Vue CLI

After we learn about the Vue CLI magic, it’s time to see it in practice. First, we need to install Vue CLI 3. It requires Node.js 8.9+ (8.11.0+ recommended), so we need to make sure we have it on our machines. Then we just open our terminal or command prompt, and run:

npm install -g @vue/cli

After the installation finished, we can start using the vue command. To check if everything works correctly, we run vue --version. This should display the installed Vue CLI version. Now, let’s explore what we can actually do with Vue CLI.

Instant Prototyping

Even though Vue CLI is designed primarily for working with complex projects, it allows us to try out our raw ideas quickly and effortlessly. Its instant prototyping feature can be activated by installing the global Vue CLI Service addon:

npm install -g @vue/cli-service-global

From now on, we can use vue serve command whenever we want. Let’s try it. We create an App.vue file with the following content:

<template>
  <h1>Hello, Vue!</h1>
</template>

Then, in the same directory, we run:

vue serve

This will start the Vue CLI development server and will run the app on http://localhost:8080/. When we open the browser at this address, we should see a nice Hello, Vue! heading.

Creating a New Project

The previous section was only a warm up. Let’s now make something more complex.

vue create command uses an interactive process for selecting the options for a new project. Let’s run it and go throughout its options.

vue create vuecli-project

Create a New Project With Vue CLI

In the first window, we are invited to pick a preset. There is only one preset available out of the box, called default. We’ll choose the second option, which is to manually select the features we need for the project, and press Enter to continue.

Create a project with Vue CLI Manually select features

In the next window, we use the arrow keys to navigate up and down the list of features and the spacebar to select what we want. Here, along with the already selected Babel and Linter/Formatter, I checked also Router and Vuex. Once you have selected the needed features, press Enter to move on.

Create a project with Vue CLI Use history mode

In the next window, we are asked whether to use history mode for the router. I just pressed Enter to accept the default of Yes.

Create a project with Vue CLI Pick a linter

In the next window, we need to choose how we want to be configured the Linter. I selected ESLint + Prettier.

Create a project with Vue CLI Additional lint features

In the next window, we choose when the Linter is used to inspect the project. I chosen Lint on save, which applies each time a file is saved.

Create a project with Vue CLI Dedicated config file or config in packagejson

In the next window, we need to decide how we want to configure our project. Choose whether you want to use separate configuration files for each of the features, or to include all configuration setting in the package.json file. I prefer a single file, and have selected the In package.json option.

Create a project with Vue CLI Save these settings as a preset

In the last window, we have the ability to save the whole project creation configuration as an easy to use preset for future projects. I saved mine as spa-simple. Presets are saved in the user folder inside .vuerc file.

When we complete the creation process the project will be created and configured, and the packages that are required will be downloaded and installed.

Create a project with Vue CLI Generating project files

Exploring the Project Structure

In this section, we’ll explore what Vue CLI has created for us.

Create a project with Vue CLI The project structure

In the project folder shown above, we have the following files and folders:

  • The node_modules folder contains the packages that the app and development tools require.
  • The public folder contains static project assets, which will not be included in the bundling process.
  • The src folder contains the Vue.js application with all resources.
  • .gitignore contains a list of files and folders that are excluded from the Git version control.
  • babel.config.js contains the configuration settings for the Babel compiler.
  • package.json contains a list of the packages required for Vue.js development as well as the commands used for the development tools.
  • package-lock.json contains a complete list of the packages, required by the project, and their dependencies.
  • README.md contains a general information about the project.

The Newly-Created src Folder

Let’s now take a closer look into the src folder:

Create a project with Vue CLI the src folder

In the src folder shown above, we have the following files and folders:

  • The assets folder is used for static resources required by the app and which will be included in the bundling process.
  • The components folder is used for the application’s components.
  • The views folder is used for components which will be displayed using the URL routing feature.
  • App.vue is the root component.
  • main.js is the JavaScript file that create the Vue instance object.
  • router.js is used to configure the Vue router.
  • store.js is used to configure the data store created with Vuex.

Changing the Project Configuration

The default project configuration contains sensible settings, but if we need, we can change them by adding a file vue.config.js in the project folder, or by adding a vue section to the package.json file. Let’s try the first one: We create a vue.config.js file and put the following option in it:

module.exports = {
  runtimeCompiler: true
}

This will allow components to define their templates as strings, rather than using template elements. To explore the complete set of configuration options you can use visit Vue CLI Config page.

Developing the Project

As we saw above, Vue CLI Service comes with three default scripts: serve, build, and inspect. The first one is used for the development process. We run our project with npm run serve command:

Starting the development server

When we open our app in the browser, we should see the following page:

Running the new app

This is the Home.vue page, which uses the HelloWorld.vue component.

The serve command starts a development server, based on webpack-dev-server, with a working Hot Module Replacement (HMR) feature. This means that when we make changes in our components and save them, they will be immediately reflected and the page will be updated in the browser.

Adding New Functionality to the Project With Vue CLI Plugins

At some point of our app development, we may need to add some additional functionality to the project, and for that we’ll need to install Vue CLI plugins. A Vue CLI plugin can modify the webpack configuration and injects new commands to vue-cli-service. To install a plugin, we use the vue add command.

Let’s suppose that we want to use Bootstrap components for our project. Fortunately, there is a bootstrap-vue plugin, which can provide them for us. To install it, we run:

vue add bootstrap-vue

After plugin’s installation, in the src folder, we’ll find a new plugins folder where the new plugin is placed.

Now, to test the plugin’s functionality, let’s modify the About.vue file:

<template>
  <div class="about">
    <b-jumbotron text-variant="success" header="Vue CLI 3" lead="Standard Tooling for Vue.js Development">
        <p>For more information visit website</p>
      <b-btn variant="primary" href="https://cli.vuejs.org/">More Info</b-btn>
    </b-jumbotron>
  </div>
</template>

And when we point to About page in the browser, we should see the page updated and styled with the Bootstrap:

App updated with Bootstrap

Building the Project for Production

When the app is ready to deploy you need to create a set of bundles containing only the app code and content, along with the modules they depend on, so that these files can be deployed to a production HTTP server.

Building the App

To build our app, we run:

npm run build --modern

The --modern argument creates two versions of the application. One of them is targeted for modern browsers that support the latest JavaScript features, and the other is a fallback for older browsers that need additional libraries to handle those features. The cool thing is that after we deploy the app, the selection of which one version to be used is completely automagical!

Note: When we run build command, Vue CLI allows us to specify an --target option, which allows us to use our code base for different use cases. The default build target is set for building an app. We have two more options to choose from: to build our code as a library or as web components. Check the Build Targets page for more details.

Exploring the dist Folder

When the build process is completed, a dist folder is created in the project root. Let’s explore its contents:

The dist folder

The index.html file will be the entry point for the application. It contains link and script elements that will load all needed CSS and JavaScript files from the css and js folders.

So now, we are ready to deploy our app to a production server. There are plenty of options to choose from. You can learn about many of them by visiting the Deployment page.

Let’s GUI-fy Our Project With Vue UI

Vue CLI 3 is a very powerful, but this comes with a price. There are too many choices, commands, and options to configure and remember. This make it more complex and hard to work with. To bring things back to an easy-and-happy state Guillaume Chau created Vue UI, which significantly simplify the development experience and make it more approachable. At first it may sounds a bit strange to combine a CLI tool with a graphical interface, but as you’ll see later on, this exceptional symbiosis is quite powerful and efficient.

Recreating Our Project With Vue UI

In this section, we’ll go throughout the creation of the same project we created before, but this time we’ll use Vue UI.

Vue UI is made with its own UI framework and no Electron is needed to run it in the browser. Just run the vue ui command, no matter in which directory:

vue ui
The Vue UI homescreen

Vue Project Manager is launched with the Projects tab selected. There are no existing projects yet. To have some projects listed here, we need either to create them via the UI, or to import projects created with the CLI. Let’s see how we can create a new project.

The Vui UI create project tab

We switch to Create tab, navigate to desired directory for our app, and click Create a new project here button.

Create a new project with Vue UI pick a folder

In the next screen, we give a name to the project folder and choose the package manager we prefer.

Create a new project with Vue UI Select a preset

In the next screen, we are allowed to choose a preset for the project. It can be the default, manual, a remote, or a custom preset we’ve created before. spa-simple is an example of a custom preset. Here, we choose Manual.

Create a new project with Vue UI Select project features

In the next screen, we select the plugins we want to install.

Create a new project with Vue UI Select plugins

Finally, we set the configuration settings for the plugins we have chosen to install. When we are ready, we hit the Create Project button.

Create a new project with Vue UI Welcome to your new project

Now the project will be created and we will be redirected to the project’s dashboard.

Vue UI Project Dashboard

Using the Vue UI Project Dashboard

In the Plugins section all the installed plugins are listed. To install a new plugin, we hit the Add plugin button.

Project Dashboard Plugins section

Here, we can search for the plugin we need and when we find it, we hit Install button. In our case, we search and install the bootstrap-vue plugin.

Project Dashboard add a plugin

When the plugin is installed, in the Configuration tab, we can set the provided options.

Project Dashboard Configuration tab

In Files changed tab, we can inspect which files are affected and how. Here, I don’t want to commit any changes, so I hit the Skip button.

Project Dashboard Dependencies tab

In the Dependencies section we have listed all main and development dependencies. To add dependency, we click the Install dependency button.

Project Dashboard Install new dependency

In the modal window, we can search for main or development dependencies and install them.

Project Dashboard Plugin settings

In the Configuration section, we can customize the settings provided for the plugins we’ve added. Here, we have settings for Vue CLI itself and for ESLint plugin.

Project Dashboard Project tasks tab

Tasks section give us convenient way to use all available commands provided from Vue CLI and from other plugins. In this screen, the serve task is selected. We can change its parameters by hitting the Parameters button.

Project Dashboard serve tasks parameters

In the modal window, we select the parameters we want to run the task with.

Project Dashboard Running the serve task

When we run the serve task, the dashboard will update with some useful information.

Project Dashboard serve task output

When we switch to the Output tab, we get the logs for the task process.

Project Dashboard serve task analyzer

When we switch to the Analyzer tab, we get a nice graph which summarize information for the whole project.

The build task is almost similar to the serve task with the exception that the former produces a production bundle that can be used to deploy the application.

Project Dashboard build task parameters

We can set parameters for the build task in the same way as with the serve task.

Project Dashboard build task output

The Output field of the inspect task give us information about the resolved webpack configuration.

And that’s it. We successfully recreated our project with the Vue UI. But as we saw the creation and configuration processes are easier and much more pleasant when we use a GUI.

Conclusion

In this tutorial we learned that Vue CLI is a complete system for modern web development. It allows us to operate with the whole Vue ecosystem and 3rd party tools quickly and easily. Of course, we are not required to use Vue CLI for our Vue.js projects. This is completely our choice. But when we aim for speed and quality, Vue CLI is here to help in creating, managing, and deploying our projects in a professional manner.

Source:: Net Tuts

Create a CSS Grid Image Gallery (With Blur Effect and Interaction Media Queries)

In this tutorial we’re going to take a bunch of ordinary thumbnail links and turn them into a responsive CSS grid gallery with a blurred hover effect. We’ll also use a great CSS trick to make sure touch screen users don’t miss out!

Here’s what we’ll be creating:

A Little Background

Recently, Rachel McCollin wrote a tutorial explaining how to add a gallery of thumbnail links in WordPress themes.

  • WordPress
    Create a WordPress Image Gallery: Code the Plugin
    Rachel McCollin

     

The links act as navigation for child pages of whichever page the user is on (or whichever page you specify) and the resultant plugin outputs something a bit like this:

wordpress thumbnail links to child pages

Grab the plugin and theme files from the repo on Github.

Using the markup generated by Rachel’s plugin, we’re going to do the following:

  • Arrange the thumbnails using CSS Grid, giving us a responsive gallery.
  • Create a hover effect using CSS filters and transitions.
  • Use a nifty CSS media query to make sure touch screen users can still see each thumbnail title, even without hovering.

1. Change the Markup (a Bit)

Let’s a have a quick look at the markup generated by Rachel’s code. When cleaned up it looks effectively like this:

<div class="child-page-listing">

  <h2>Our Locations</h2>

  <article class="location-listing">
    <a class="location-title" href="#">San Francisco</a>
    <div class="location-image">
      <a href="#">
        <img src="image.jpg" alt="san francisco">
      </a>
    </div>
  </article>

  <!-- more articles -->

</div>

We have a parent

, which holds an

and a few

elements. When we’re using CSS Grid we first define a grid container. In this case we could use the parent

 

, but that would make each direct child–including the

–a grid item, so we need to change things a little.

We’ll wrap all the

elements in another

 

(feel free to use whatever element you feel most suitable) which we’ll imaginatively give a class of grid-container. Use this starter pen as a basis.

2. Responsive CSS Grid, in Three Lines

With just a few rules we can turn our thumbnails into a grid:

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  grid-gap: 1em;
}

The easy lines here are the display: grid; (which turns all direct children into grid items and lays them out) and the grid-gap: 1em; (which defines our gutters).

The slight complexity comes from the value we’ve given to the grid-template-columns property, which defines our columns. You might normally expect to see something like repeat(3, 200px) which would give us three columns of 200px. In this case we’ve used the auto-fill keyword for repeat(), and then some values. This gives us as many columns with a minimum of 300px and maximum of 1fr as will fit in the grid container.

  • CSS Grid Layout
    CSS Grid Layout: Going Responsive With auto-fill and minmax()
    Ian Yates

     

Resize your browser window and see how it behaves!

One last detail you’ll need to add:

img {
  width: 100%;
  height: auto;
}

This will make sure the images fill their containers properly (particularly necessary for use with Rachel’s demo, as we need to overwrite the inline width and height properties WordPress outputs).

3. Hover Effect

We’re going to use the titles as overlays for the thumbnails, revealing them on hover. We’ll also give the hovered images a red effect, and a slight blur to help readability of the overlaid text.

Overlay the Title

To overlay the title we need to position it, so we’ll begin by making the article position: relative; and the title position: absolute;. We’ll also give it a red background and make it fill the available space:

.location-listing {
  position: relative;
}

.location-title {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: rgba(90,0,10,0.4);
}

Good start!

thumbs step 1

There are one or two things to improve already, including that extra space at the bottom (the title is slightly larger than the thumbnail). This can be solved by removing any line-height on the image’s container:

.location-image {
  line-height: 0;
}

Style the Title

Some typographic styles will improve the look of our title, and three lines of flexbox magic will align it centrally for us:

.location-title {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: rgba(90,0,10,0.4);
  
  /* typographic styles */
  color: white;
  font-size: 1.5em;
  font-weight: bold;
  text-decoration: none;
  
  /* position the text centrally*/
  display: flex;
  align-items: center;
  justify-content: center;
}

Much better:

Hide the Title

Now let’s hide the title by removing its opacity so that we can only see it on hover. A couple more rules underneath the ones we’ve already added to our .location-title should do it:

  /* hide the title by default */
  opacity: 0;
  transition: opacity .5s;

Here we also set a transition rule so that when we do bring the opacity back it will happen gradually (over the course of 0.5 seconds). Let’s bring it back now:

.location-listing:hover .location-title {
  opacity: 1;
}

Great! Now our title appears again on hover:

title back on hover

Blurred Lines

We’ve created a great-looking hover effect already, but let’s take things a step further shall we? Let’s add a blur filter to the image too. We’ll begin by setting the blur filter on the normal state, in order to give us something to transition from. Then we’ll blur things by 2px for the hover state (make this number as extreme as you wish, but I think 2px gives us a great visual):

.location-image img {
  filter: blur(0px);
  transition: filter 0.3s ease-in;
}

.location-listing:hover .location-image img {
  filter: blur(2px);
}

Here’s what that gives us:

A couple of things to note:

  1. The title has disappeared because the browser is now rendering the blurred graphic over the top of it.
  2. The blurred effect looks good, but it gives us a blurred edge too (we can do better than that).

Fixing the hidden title is as simple as adding z-index: 1; to the .location-title.

Fixing the blurred edge is a little more involved. To begin with we scale the image to make it a bit larger, then we set overflow: hidden; on the image container (.location-listing) so that when the larger image blurs its edges are effectively cropped. Here are the finished properties for the two elements in question:

.location-image img {
  filter: blur(0px);
  transition: filter 0.3s ease-in;
  transform: scale(1.1);
}

.location-listing {
  position: relative;
  overflow: hidden;
}

The transform: scale(1.1); rule scales our image in all directions to 1.1 (where 1.0 would keep things exactly the same size). Here’s the much neater result:

no more blurred lines

4. The Problem With Touch Screens

So there we have it! A great-looking image grid with a blurred hover effect on each thumbnail. The only thing is that the titles are hidden to anyone who can’t hover over the images (a good number of tablets and smartphones don’t emulate hover with a prolonged “press”) which isn’t very accessible.

Fortunately, CSS has some very useful interaction media queries which can help us out (and they enjoy fairly decent browser support too). These queries will detect a browser’s input mechanism–the pointing device quality, the ability to hover, and some other special definitions–so we can fairly accurately determine if our thumbnails are being viewed on a touch screen device.

Take this media query for example (it does exactly what you might expect):

@media (hover: none) { }

Within these curly braces we’d put any styles we want to apply to a browser which can’t handle :hover. Let’s do that–we’ll state that for devices where hover is either impossible, or at least inconvenient, the thumbnail image will always be blurred and the title will always be visible:

/* for touch screen devices */
@media (hover: none) { 
  .location-title {
    opacity: 1;
  }
  .location-image img {
    filter: blur(2px);
  }
}

Take a look:

Note: As mentioned, support for this is pretty reasonable, but discussions about the implementation of interaction media queries are still ongoing. There’s a good chance this spec will change, or have parts removed.

Conclusion

And we’re done! Thanks for following along, I hope you’ve learned one or two things and enjoyed playing around with CSS (who doesn’t enjoy that?). Here’s one more look at the final demo–enjoy adding it to the theme files created by Rachel in part one!

Source:: Net Tuts

Create a CSS Grid Image Gallery (With Blur Effect and Interaction Media Queries)

In this tutorial we’re going to take a bunch of ordinary thumbnail links and turn them into a responsive CSS grid gallery with a blurred hover effect. We’ll also use a great CSS trick to make sure touch screen users don’t miss out!

Here’s what we’ll be creating:

A Little Background

Recently, Rachel McCollin wrote a tutorial explaining how to add a gallery of thumbnail links in WordPress themes.

  • WordPress
    Create a WordPress Image Gallery: Code the Plugin
    Rachel McCollin

     

The links act as navigation for child pages of whichever page the user is on (or whichever page you specify) and the resultant plugin outputs something a bit like this:

wordpress thumbnail links to child pages

Grab the plugin and theme files from the repo on Github.

Using the markup generated by Rachel’s plugin, we’re going to do the following:

  • Arrange the thumbnails using CSS Grid, giving us a responsive gallery.
  • Create a hover effect using CSS filters and transitions.
  • Use a nifty CSS media query to make sure touch screen users can still see each thumbnail title, even without hovering.

1. Change the Markup (a Bit)

Let’s a have a quick look at the markup generated by Rachel’s code. When cleaned up it looks effectively like this:

<div class="child-page-listing">

  <h2>Our Locations</h2>

  <article class="location-listing">
    <a class="location-title" href="#">San Francisco</a>
    <div class="location-image">
      <a href="#">
        <img src="image.jpg" alt="san francisco">
      </a>
    </div>
  </article>

  <!-- more articles -->

</div>

We have a parent

, which holds an

and a few

elements. When we’re using CSS Grid we first define a grid container. In this case we could use the parent

 

, but that would make each direct child–including the

–a grid item, so we need to change things a little.

We’ll wrap all the

elements in another

 

(feel free to use whatever element you feel most suitable) which we’ll imaginatively give a class of grid-container. Use this starter pen as a basis.

2. Responsive CSS Grid, in Three Lines

With just a few rules we can turn our thumbnails into a grid:

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  grid-gap: 1em;
}

The easy lines here are the display: grid; (which turns all direct children into grid items and lays them out) and the grid-gap: 1em; (which defines our gutters).

The slight complexity comes from the value we’ve given to the grid-template-columns property, which defines our columns. You might normally expect to see something like repeat(3, 200px) which would give us three columns of 200px. In this case we’ve used the auto-fill keyword for repeat(), and then some values. This gives us as many columns with a minimum of 300px and maximum of 1fr as will fit in the grid container.

  • CSS Grid Layout
    CSS Grid Layout: Going Responsive With auto-fill and minmax()
    Ian Yates

     

Resize your browser window and see how it behaves!

One last detail you’ll need to add:

img {
  width: 100%;
  height: auto;
}

This will make sure the images fill their containers properly (particularly necessary for use with Rachel’s demo, as we need to overwrite the inline width and height properties WordPress outputs).

3. Hover Effect

We’re going to use the titles as overlays for the thumbnails, revealing them on hover. We’ll also give the hovered images a red effect, and a slight blur to help readability of the overlaid text.

Overlay the Title

To overlay the title we need to position it, so we’ll begin by making the article position: relative; and the title position: absolute;. We’ll also give it a red background and make it fill the available space:

.location-listing {
  position: relative;
}

.location-title {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: rgba(90,0,10,0.4);
}

Good start!

thumbs step 1

There are one or two things to improve already, including that extra space at the bottom (the title is slightly larger than the thumbnail). This can be solved by removing any line-height on the image’s container:

.location-image {
  line-height: 0;
}

Style the Title

Some typographic styles will improve the look of our title, and three lines of flexbox magic will align it centrally for us:

.location-title {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: rgba(90,0,10,0.4);
  
  /* typographic styles */
  color: white;
  font-size: 1.5em;
  font-weight: bold;
  text-decoration: none;
  
  /* position the text centrally*/
  display: flex;
  align-items: center;
  justify-content: center;
}

Much better:

Hide the Title

Now let’s hide the title by removing its opacity so that we can only see it on hover. A couple more rules underneath the ones we’ve already added to our .location-title should do it:

  /* hide the title by default */
  opacity: 0;
  transition: opacity .5s;

Here we also set a transition rule so that when we do bring the opacity back it will happen gradually (over the course of 0.5 seconds). Let’s bring it back now:

.location-listing:hover .location-title {
  opacity: 1;
}

Great! Now our title appears again on hover:

title back on hover

Blurred Lines

We’ve created a great-looking hover effect already, but let’s take things a step further shall we? Let’s add a blur filter to the image too. We’ll begin by setting the blur filter on the normal state, in order to give us something to transition from. Then we’ll blur things by 2px for the hover state (make this number as extreme as you wish, but I think 2px gives us a great visual):

.location-image img {
  filter: blur(0px);
  transition: filter 0.3s ease-in;
}

.location-listing:hover .location-image img {
  filter: blur(2px);
}

Here’s what that gives us:

A couple of things to note:

  1. The title has disappeared because the browser is now rendering the blurred graphic over the top of it.
  2. The blurred effect looks good, but it gives us a blurred edge too (we can do better than that).

Fixing the hidden title is as simple as adding z-index: 1; to the .location-title.

Fixing the blurred edge is a little more involved. To begin with we scale the image to make it a bit larger, then we set overflow: hidden; on the image container (.location-listing) so that when the larger image blurs its edges are effectively cropped. Here are the finished properties for the two elements in question:

.location-image img {
  filter: blur(0px);
  transition: filter 0.3s ease-in;
  transform: scale(1.1);
}

.location-listing {
  position: relative;
  overflow: hidden;
}

The transform: scale(1.1); rule scales our image in all directions to 1.1 (where 1.0 would keep things exactly the same size). Here’s the much neater result:

no more blurred lines

4. The Problem With Touch Screens

So there we have it! A great-looking image grid with a blurred hover effect on each thumbnail. The only thing is that the titles are hidden to anyone who can’t hover over the images (a good number of tablets and smartphones don’t emulate hover with a prolonged “press”) which isn’t very accessible.

Fortunately, CSS has some very useful interaction media queries which can help us out (and they enjoy fairly decent browser support too). These queries will detect a browser’s input mechanism–the pointing device quality, the ability to hover, and some other special definitions–so we can fairly accurately determine if our thumbnails are being viewed on a touch screen device.

Take this media query for example (it does exactly what you might expect):

@media (hover: none) { }

Within these curly braces we’d put any styles we want to apply to a browser which can’t handle :hover. Let’s do that–we’ll state that for devices where hover is either impossible, or at least inconvenient, the thumbnail image will always be blurred and the title will always be visible:

/* for touch screen devices */
@media (hover: none) { 
  .location-title {
    opacity: 1;
  }
  .location-image img {
    filter: blur(2px);
  }
}

Take a look:

Note: As mentioned, support for this is pretty reasonable, but discussions about the implementation of interaction media queries are still ongoing. There’s a good chance this spec will change, or have parts removed.

Conclusion

And we’re done! Thanks for following along, I hope you’ve learned one or two things and enjoyed playing around with CSS (who doesn’t enjoy that?). Here’s one more look at the final demo–enjoy adding it to the theme files created by Rachel in part one!

Source:: Net Tuts