Skip to content

Update class-and-style.md #2045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/guide/essentials/class-and-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,20 @@ You can provide an array of multiple (prefixed) values to a style property, for
```

This will only render the last value in the array which the browser supports. In this example, it will render `display: flex` for browsers that support the unprefixed version of flexbox.

### CSS Functions
It is best to practice to use JavaScript objects to return CSS functions like `url()`:
```vue-html
<div :style=:style="{backgroundImage: this.myUrl}"></div>
```
```javascript
computed: {
myUrl() {
return 'url(https://www.foo.com' + this.icon + '.png)'
}
},
```
However, it is also possible to place them in-line using quotes:
```vue-html
<div :style=:style="{ 'backgroundImage': 'url(' + this.icon + '.png)' }"></div>
```