Home >Web Front-end >CSS Tutorial >What is the use of resize attribute in css

What is the use of resize attribute in css

青灯夜游
青灯夜游Original
2021-01-06 15:50:303691browse

The role of the resize attribute: Specifies whether an element is resized by the user; if the value is "none", the user cannot adjust the size of the element, and if the value is "both", the height and width of the element can be adjusted. A value of "horizontal" adjusts the width of the element, and a value of "vertical" adjusts the height of the element.

What is the use of resize attribute in css

The operating environment of this tutorial: windows7 system, css3 version, Dell G3 computer.

Tutorial recommendation: css video tutorial

css resize attribute

The resize attribute is a new addition to CSS3 Property that specifies whether an element is resized by the user.

Note: The resize attribute is suitable for calculating whether the overflow value of other elements is "visible".

What is the use of resize attribute in css

Syntax

resize: none|both|horizontal|vertical;

Attribute values:

  • none: The user cannot resize the element.

  • both: The user can adjust the height and width of the element.

  • horizontal: The width of the element can be adjusted by the user.

  • vertical: The user can adjust the height of the element.

Note: If you want this attribute to take effect, you need to set the overflow attribute of the element. The value can be auto, hidden or scroll.

Example: Specify a div element that allows users to resize

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<style> 
div
{
border:2px solid;
padding:10px 40px; 
width:300px;
resize:both;
overflow:auto;
}
</style>
</head>
<body>
<div>resize 属性规定是否可由用户调整元素尺寸。</div>
<p><b>注释:</b> Firefox 4+、Safari 以及 Chrome 支持 resize 属性。</p>
</body>
</html>

Rendering:

What is the use of resize attribute in css

##More For programming related knowledge, please visit:

Programming Teaching! !

The above is the detailed content of What is the use of resize attribute in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn