Skip to content

Commit 2b7d5e0

Browse files
authored
docs: clarify that :style can coexist with regular style attributes like class (#3173)
* docs: clarify that :style can coexist with regular style attributes like class * docs: clarify that :style can coexist with regular style attributes like class
1 parent 2e0dbe0 commit 2b7d5e0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: src/guide/essentials/class-and-style.md

+14
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,20 @@ data() {
323323

324324
Again, object style binding is often used in conjunction with computed properties that return objects.
325325

326+
`:style` directives can also coexist with regular style attributes, just like `:class`.
327+
328+
Template:
329+
330+
```vue-html
331+
<h1 style="color: red" :style="'font-size: 1em'">hello</h1>
332+
```
333+
334+
It will render:
335+
336+
```vue-html
337+
<h1 style="color: red; font-size: 1em;">hello</h1>
338+
```
339+
326340
### Binding to Arrays {#binding-to-arrays-1}
327341

328342
We can bind `:style` to an array of multiple style objects. These objects will be merged and applied to the same element:

0 commit comments

Comments
 (0)