# `ngStyle` (directive in module `ng` )

Improve this doc

## Description

The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.

## Usage

as attribute

    <ANY ng-style="{expression}">
       ...
    </ANY>

as class

    <ANY class="ng-style: {expression};">
       ...
    </ANY>

### Parameters

- `ngStyle – {expression} –`

  Expression which evals to an object whose keys are CSS style names and values are corresponding values for those CSS keys.

## Example

#### Source

#### Demo