Styling inner HTML with Angular special selectors

In this post I show how to style the HTML in Angular’s [innerHtml] using special style selectors ::ng-deep and :host.

The problem

In an application I’m working, we’re using an open source text editor that saves text as HTML in the backend for certain product descriptions. To display the saved HTML we used the [innerHTML] directive, however, some of the styles saved to the backend did match the CSS theme on the front end, making for ugly looking typography. To fix this, I tried styling the HTML blocks as I normally would but to no avail! There must be another way to target the embedded HTML.

Inner HTML directive Angular

The solution

After some research and looking through the Angular styling documentation, I found that I was able to successfully target and style the HTML blocks inside of the [innerHtml] with the :host and ::ng-deep special style selectors.

Styling with Angular special selectors

I needed both the :host and ::ng-deep pseudo-selectors because I wanted to keep the scope of this style to the current component and all its descendants. If I just used ::ng-deep pseudo-selector without :host , then the style can bleed into other components.

Source

https://angular.io/guide/component-styles

4 Simple Things To Make Your Personal Website More Aesthetic

The purpose of this article is to highlight some small adjustments you can make to your personal site that will make a huge difference in usability and aesthetics. You don’t need to be an expert web designer or developer to make these changes. I’ve written this article after reviewing 100+ personal websites across the web which were custom built, WordPress, Square Space, etc. sites

1. Standardize your typography

Creating a standard typography for your site will make it easier for your users to recognize if the text on the page represents links/anchor tags, paragraph text, annotations, titles, and navigation links. Setting a standard typography means that the font and style used for paragraphs should be the same on every page of your application. (i.e. All paragraph text will be of font size 16px in Helvetica-Neue font. All text contained within buttons will be uppercase size 14px font.). That being said, all text with the same meaning or function should have the same font and text style.

Here is a simple typography generated via
Type Scale

type-scale

The folks over at Material Design also have a detailed typography scale you can use for reference.

2. Color scheme

For those who want to create a more aesthetically pleasing experience while users navigate your site, it may be worth spending a few minutes to create a matching color scheme for your website. I use often coolors.co to generate color schemes for my website builds.

Screenshot from coolors.co:

coolorsco

After picking a color scheme make sure you’re consistently making sure all your elements of the same function have the same styles. (i.e. All button on your page are green with white text which. Once your user sees this button once they will recognize all other green blobs with white on the page as buttons.)

3. Set max content width

All content on the page should be kept within a certain max with. When is last time you were on a web page on your desktop and your eyes had to move from the left side of the screen all the way to the right side of the screen to read a paragraph?

max-content

All content should be focused in one section so that it’s easier for a user to read.

4. Favicon

For those of you building a personal brand, I think having a favicon on your site will make you look that much more official and serious. Not having a favicon on your web page may make your personal site look incomplete and give the impression that it’s still under construction.

no-favicon

My top 5 Sketch plugins to increase productivity

The purpose of this article is to share what I think are the most valuable sketch plugins to my workflow when designing desktop and mobile screens. Enjoy!

1. Runner

Sketch Runner Plugin

Regardless of what you’re designing on Sketch, you will need Sketch runner to speed up your Sketch workflow. With this plugin, you will be able to search through all available plugins and Sketch menu commands without having to navigate through those long drop downs. You can also insert symbols, jump to any page, apply text & layer styles, and install new plugins.

2. Content Generator

Sketch Content Generator Plugin

Almost every client or project I’ve worked on has required me to populate my screens with fake data such as names, phone numbers, geo locations, profile images, etc which took a lot of my time because I had to come up with believable data off the top of my head for at least 50 rows of data. The content generator allows you to populate any number of rows of dummy data such as avatars, names, photos, geodata, etc in seconds.

3. Spell Check Whole Page

Sketch Content Generator Plugin

There are few mistakes more embarrassing allowing a spelling error slip through the cracks from design all the way into production. Spell check whole page allows you to spell check all text of every layer on the current page you are on. I also supplement this plugin by typing all of my screen text into Grammarly to check my grammar as well.

4. Merge Duplicate Symbols

Sketch Content Generator Plugin

As I have become savvier utilizing the power of Sketch symbols this tool has saved me a lot of time cleaning up my duplicate symbols from copying and pasting other symbols. This plugin allows you to merge symbols with the same name. You simply choose the one you want to keep and press OK. The other symbols will be removed, and all of their instances will be replaced by the one you choose to keep.

5. Symbol Organizer

Sketch Symbol Organizer Plugin

There comes a point where you have 50+ symbols throughout your Sketch file and you are dreading looking at the symbols page because of how messy you know it will be. Fortunately, the symbol organizer plugin organizes your symbols page alphabetically into groupings determined by symbols names in a clean grid.

Final Notes

I hope that these Sketch plugins add value to your daily workflow. What Sketch plugins have either changed the way you design or increase your productivity? Write them below!