react/docs/tips/06-style-props-value-px.ru-...

47 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: style-props-value-px-ru-RU
title: Краткая форма значений в пикселях для атрибута style
layout: tips
permalink: tips/style-props-value-px-ru-RU.html
prev: maximum-number-of-jsx-root-nodes-ru-RU.html
next: children-props-type.html
---
React автоматически добавляет "px" для значений, которые указаны в числовом виде и находятся внутри встроенного стиля атрибута `style`, например:
```js
var divStyle = {height: 10}; // получится "height:10px"
ReactDOM.render(<div style={divStyle}>Hello World!</div>, mountNode);
```
Подробная информация о [встроенных стилях](/react/tips/inline-styles-ru-RU.html).
Иногда бывает нужно указать значение *без* единицы измерения. Для этих свойств "px" не добавляется автоматически:
- `animationIterationCount`
- `boxFlex`
- `boxFlexGroup`
- `boxOrdinalGroup`
- `columnCount`
- `fillOpacity`
- `flex`
- `flexGrow`
- `flexPositive`
- `flexShrink`
- `flexNegative`
- `flexOrder`
- `fontWeight`
- `lineClamp`
- `lineHeight`
- `opacity`
- `order`
- `orphans`
- `stopOpacity`
- `strokeDashoffset`
- `strokeOpacity`
- `strokeWidth`
- `tabSize`
- `widows`
- `zIndex`
- `zoom`