Atrybut width w CSS
- poprzednia strona widows
- następna strona word-break
Definition and usage
The width property sets the width of the element.
Description
This property defines the width of the element's content area, where padding, borders, and margins can be added outside the content area.
Inline non-replaced elements will ignore this property.
See also:
CSS Tutorial:CSS Dimensions
CSS Tutorial:Przegląd modelu okien w CSS
CSS Reference Manual:height property
HTML DOM Reference Manual:width property
CSS syntax
width: auto|value|initial|inherit;
Attribute value
Value | Description |
---|---|
auto | Default value. The browser can calculate the actual width. |
length | Define width using units such as px, cm, etc. |
% | Specifies a percentage width based on the width of the containing block (parent element). |
inherit | Specifies that the width property should be inherited from the parent element. |
Technical details
Default value: | auto |
---|---|
Inheritance: | no |
Version: | CSS1 |
JavaScript syntax: | object.style.width="50px" |
Przykład TIY
- Ustawianie szerokości elementu za pomocą wartości pikseli
- Ten przykład pokazuje, jak używać wartości pikseli do ustawienia szerokości elementu.
- Ustawianie szerokości elementu za pomocą procentu
- Ten przykład pokazuje, jak używać procentowych wartości do ustawienia szerokości elementu.
Wspierane przeglądarki
Liczby w tabeli wskazują na pierwszą wersję przeglądarki, która w pełni obsługuje tę właściwość.
Chrome | IE / Edge | Firefox | Safari | Opera |
---|---|---|---|---|
1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
- poprzednia strona widows
- następna strona word-break