Edit this page

up.Preview up.Preview.prototype.setStyle([element], styles)
Instance method

Temporarily sets inline CSS styles on an element.

Example

This preview temporarily changes the background and foreground colors of the targeted fragment:

up.preview('highlight', function(preview) {
  preview.setStyle({
    'color': 'yellow',
    'background-color': 'red'
  })
})

Parameters

[element=this.fragment] Element|string optional

The element or selector to change.

If omitted, the targeted fragment will be changed.

styles Object

One or more CSS properties with kebab-case keys.