CSS resize Свойство
Пример
Здесь пользователь может изменить размер как высоты, так и ширины элемента <div>:
div {
resize: both;
overflow: auto;
}
Подробнее примеры ниже.
Определение и использование
Свойство resize
определяет, является ли элемент изменяемым по размерам пользователем.
Примечание: Свойство resize
не применяется к встроенным элементам или блокировать элементы, где переполнение = "видимый". Таким образом, убедитесь, что переполнение установлено на "прокрутки", "Авто", или "скрытый".
Значение по умолчанию: | none |
---|---|
Inherited: | no |
Animatable: | no. Читайте о animatable |
Version: | CSS3 |
Синтаксис JavaScript: | object.style.resize="both" |
Поддержка браузера
Номера в таблице указывают первую версию браузера, которая полностью поддерживает свойство.
Номера следуют -МОЗ- укажет первую версию, которая работала с префиксом.
Свойство | |||||
---|---|---|---|---|---|
resize | 4.0 | Не поддерживается | 5.0 4.0 -moz- |
4.0 | 15.0 |
Синтаксис CSS
resize: none|both|horizontal|vertical|initial|inherit;
Значения свойств
Значение | Описание | |
---|---|---|
none | Значение по умолчанию. Пользователь не может изменить размер элемента | |
both | Пользователь может изменять размер как высоты, так и ширины элемента | |
horizontal | Пользователь может изменить ширину элемента | |
vertical | Пользователь может изменить размер высоты элемента | |
initial | Присваивает этому свойству значение по умолчанию. (Читайте о initial) | |
inherit | Наследует это свойство из родительского элемента. (Читайте о inherit) |
Другие примеры
Пример
Пусть пользователь изменяет размер только высоты элемента <div>:
div
{
resize: vertical;
overflow: auto;
}
Пример
Пусть пользователь изменяет размер только ширины элемента <div>:
div
{
resize: horizontal;
overflow: auto;
}
Пример
Во многих браузерах <textarea> изменяется по умолчанию. Здесь мы использовали свойство Resize для отключения ресизабилити:
textarea {
resize: none;
}
Похожие страницы
CSS Справочник: CSS User Interface
HTML DOM Справочник: resize Свойство